From 668bb0cb8682afa5332709e8f2257690e5d97612 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Mon, 4 Nov 2019 11:03:39 +0100 Subject: [PATCH 001/784] NEW add public and private notes in propal list --- htdocs/comm/propal/class/propal.class.php | 43 ++++++++++++++++++++++- htdocs/comm/propal/list.php | 13 +++---- 2 files changed, 46 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 0df1af873a8..1ec4567d774 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3536,9 +3536,10 @@ class Propal extends CommonObject * @param string $get_params Parametres added to url * @param int $notooltip 1=Disable tooltip * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @param int $addlinktonotes -1=Disable, 0=Just add label show notes, 1=Add private note (only internal user), 2=Add public note (internal or external user), 3=Add private (internal user) and public note (internal and external user) * @return string String with URL */ - public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1) + public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = -1) { global $langs, $conf, $user; @@ -3604,6 +3605,46 @@ class Propal extends CommonObject if ($withpicto != 2) $result.= $this->ref; $result .= $linkend; + if ($addlinktonotes >= 0) { + $txttoshow = ''; + + if ($addlinktonotes == 0) { + if (!empty($this->note_private) || !empty($this->note_public)) { + $txttoshow = $langs->trans('ViewPrivateNote'); + } + } elseif ($addlinktonotes == 1) { + if (!empty($this->note_private)) { + $txttoshow .= ($user->socid > 0 ? '' : dol_string_nohtmltag($this->note_private, 1)); + } + } elseif ($addlinktonotes == 2) { + if (!empty($this->note_public)) { + $txttoshow .= dol_string_nohtmltag($this->note_public, 1); + } + } elseif ($addlinktonotes == 3) { + if ($user->socid > 0) { + if (!empty($this->note_public)) { + $txttoshow .= dol_string_nohtmltag($this->note_public, 1); + } + } else { + if (!empty($this->note_private)) { + $txttoshow .= dol_string_nohtmltag($this->note_private, 1); + } + if (!empty($this->note_public)) { + if (!empty($txttoshow)) $txttoshow .= '
'; + $txttoshow .= dol_string_nohtmltag($this->note_public, 1); + } + } + } + + if ($txttoshow) { + $result .= ' '; + $result .= ''; + $result .= img_picto('', 'note'); + $result .= ''; + $result .= ''; + } + } + return $result; } diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index a83d7ee5161..b5a0d1d72aa 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -273,7 +273,7 @@ $sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.c $sql.= " typent.code as typent_code,"; $sql.= " ava.rowid as availability,"; $sql.= " state.code_departement as state_code, state.nom as state_name,"; -$sql.= ' p.rowid, p.entity, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,'; +$sql.= ' p.rowid, p.entity, p.note_private, p.note_public, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,'; $sql.= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,'; $sql.= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,"; $sql.= ' u.login'; @@ -764,6 +764,8 @@ if ($resql) $objectstatic->id=$obj->rowid; $objectstatic->ref=$obj->ref; + $objectstatic->note_private=$obj->note_private; + $objectstatic->note_public=$obj->note_public; $companystatic->id=$obj->socid; $companystatic->name=$obj->name; @@ -784,18 +786,11 @@ if ($resql) print ''; // Picto + Ref print ''; // Warning $warnornote=''; if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) $warnornote.=img_warning($langs->trans("Late")); - if (! empty($obj->note_private)) - { - $warnornote.=($warnornote?' ':''); - $warnornote.= ''; - $warnornote.= ''.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').''; - $warnornote.= ''; - } if ($warnornote) { print ''; } // Date end if (! empty($arrayfields['p.fin_validite']['checked'])) { - print ''; } // Date delivery if (! empty($arrayfields['p.date_livraison']['checked'])) { - print ''; } // Availability From e60b7a67fa61bea4591920739c16571f2f542555 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 7 Nov 2019 06:35:58 +0100 Subject: [PATCH 005/784] NEW Invoice list - Add date start & date end --- htdocs/compta/facture/list.php | 108 ++++++++++++++++++--------------- 1 file changed, 58 insertions(+), 50 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 75945106b72..2d06fa1f557 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -13,6 +13,7 @@ * Copyright (C) 2015-2016 Ferran Marcet * Copyright (C) 2017 Josep Lluís Amador * Copyright (C) 2018 Charlene Benke + * Copyright (C) 2019 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 @@ -98,12 +99,10 @@ $search_country=GETPOST("search_country", 'int'); $search_type_thirdparty=GETPOST("search_type_thirdparty", 'int'); $search_user = GETPOST('search_user', 'int'); $search_sale = GETPOST('search_sale', 'int'); -$search_day = GETPOST('search_day', 'int'); -$search_month = GETPOST('search_month', 'int'); -$search_year = GETPOST('search_year', 'int'); -$search_day_lim = GETPOST('search_day_lim', 'int'); -$search_month_lim = GETPOST('search_month_lim', 'int'); -$search_year_lim = GETPOST('search_year_lim', 'int'); +$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); +$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); +$search_datelimit_start = dol_mktime(0, 0, 0, GETPOST('search_datelimit_startmonth', 'int'), GETPOST('search_datelimit_startday', 'int'), GETPOST('search_datelimit_startyear', 'int')); +$search_datelimit_end = dol_mktime(23, 59, 59, GETPOST('search_datelimit_endmonth', 'int'), GETPOST('search_datelimit_endday', 'int'), GETPOST('search_datelimit_endyear', 'int')); $search_categ_cus=trim(GETPOST("search_categ_cus", 'int')); $search_btn=GETPOST('button_search', 'alpha'); $search_remove_btn=GETPOST('button_removefilter', 'alpha'); @@ -248,14 +247,12 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', $search_type=''; $search_country=''; $search_type_thirdparty=''; - $search_day=''; - $search_year=''; - $search_month=''; + $search_date_start=''; + $search_date_end=''; + $search_datelimit_start=''; + $search_datelimit_end=''; $option=''; $filter=''; - $search_day_lim=''; - $search_year_lim=''; - $search_month_lim=''; $toselect=''; $search_array_options=array(); $search_categ_cus=0; @@ -445,47 +442,49 @@ if ($filtre) $sql .= ' AND ' . $db->escape(trim($filt[0])) . ' = ' . $db->escape(trim($filt[1])); } } -if ($search_ref) $sql .= natural_search('f.ref', $search_ref); -if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer); +if ($search_ref) $sql .= natural_search('f.ref', $search_ref); +if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer); if ($search_type != '' && $search_type != '-1') $sql.=" AND f.type IN (".$db->escape($search_type).")"; -if ($search_project_ref) $sql .= natural_search('p.ref', $search_project_ref); -if ($search_project) $sql .= natural_search('p.title', $search_project); -if ($search_societe) $sql .= natural_search('s.nom', $search_societe); -if ($search_town) $sql.= natural_search('s.town', $search_town); -if ($search_zip) $sql.= natural_search("s.zip", $search_zip); -if ($search_state) $sql.= natural_search("state.nom", $search_state); -if ($search_country) $sql .= " AND s.fk_pays IN (".$db->escape($search_country).')'; -if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->escape($search_type_thirdparty).')'; -if ($search_company) $sql .= natural_search('s.nom', $search_company); -if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1); -if ($search_montant_vat != '') $sql.= natural_search('f.tva', $search_montant_vat, 1); +if ($search_project_ref) $sql .= natural_search('p.ref', $search_project_ref); +if ($search_project) $sql .= natural_search('p.title', $search_project); +if ($search_societe) $sql .= natural_search('s.nom', $search_societe); +if ($search_town) $sql.= natural_search('s.town', $search_town); +if ($search_zip) $sql.= natural_search("s.zip", $search_zip); +if ($search_state) $sql.= natural_search("state.nom", $search_state); +if ($search_country) $sql .= " AND s.fk_pays IN (".$db->escape($search_country).')'; +if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->escape($search_type_thirdparty).')'; +if ($search_company) $sql .= natural_search('s.nom', $search_company); +if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1); +if ($search_montant_vat != '') $sql.= natural_search('f.tva', $search_montant_vat, 1); if ($search_montant_localtax1 != '') $sql.= natural_search('f.localtax1', $search_montant_localtax1, 1); if ($search_montant_localtax2 != '') $sql.= natural_search('f.localtax2', $search_montant_localtax2, 1); -if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1); -if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); -if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; +if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1); +if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); +if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; if ($search_status != '-1' && $search_status != '') { if (is_numeric($search_status) && $search_status >= 0) { - if ($search_status == '0') $sql.=" AND f.fk_statut = 0"; // draft - if ($search_status == '1') $sql.=" AND f.fk_statut = 1"; // unpayed - if ($search_status == '2') $sql.=" AND f.fk_statut = 2"; // payed Not that some corrupted data may contains f.fk_statut = 1 AND f.paye = 1 (it means payed too but should not happend. If yes, reopen and reclassify billed) - if ($search_status == '3') $sql.=" AND f.fk_statut = 3"; // abandonned + if ($search_status == '0') $sql.=" AND f.fk_statut = 0"; // draft + if ($search_status == '1') $sql.=" AND f.fk_statut = 1"; // unpayed + if ($search_status == '2') $sql.=" AND f.fk_statut = 2"; // payed Not that some corrupted data may contains f.fk_statut = 1 AND f.paye = 1 (it means payed too but should not happend. If yes, reopen and reclassify billed) + if ($search_status == '3') $sql.=" AND f.fk_statut = 3"; // abandonned } else { $sql.= " AND f.fk_statut IN (".$db->escape($search_status).")"; // When search_status is '1,2' for example } } -if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode); -if ($search_paymentterms > 0) $sql .= " AND f.fk_cond_reglement = ".$db->escape($search_paymentterms); -if ($search_module_source) $sql .= natural_search("f.module_source", $search_module_source); -if ($search_pos_source) $sql .= natural_search("f.pos_source", $search_pos_source); -$sql.= dolSqlDateFilter("f.datef", $search_day, $search_month, $search_year); -$sql.= dolSqlDateFilter("f.date_lim_reglement", $search_day_lim, $search_month_lim, $search_year_lim); -if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'"; -if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .(int) $search_sale; +if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode); +if ($search_paymentterms > 0) $sql .= " AND f.fk_cond_reglement = ".$db->escape($search_paymentterms); +if ($search_module_source) $sql .= natural_search("f.module_source", $search_module_source); +if ($search_pos_source) $sql .= natural_search("f.pos_source", $search_pos_source); +if ($search_date_start) $sql.= " AND f.datef >= '" . $db->idate($search_date_start) . "'"; +if ($search_date_end) $sql.= " AND f.datef <= '" . $db->idate($search_date_end) . "'"; +if ($search_datelimit_start) $sql.= " AND f.date_lim_reglement >= '" . $db->idate($search_datelimit_start) . "'"; +if ($search_datelimit_end) $sql.= " AND f.date_lim_reglement <= '" . $db->idate($search_datelimit_end) . "'"; +if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'"; +if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .(int) $search_sale; if ($search_user > 0) { $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='facture' AND tc.source='internal' AND ec.element_id = f.rowid AND ec.fk_socpeople = ".$search_user; @@ -752,20 +751,29 @@ if ($resql) // Date invoice if (! empty($arrayfields['f.date']['checked'])) { - print ''; } // Date due if (! empty($arrayfields['f.date_lim_reglement']['checked'])) { - print ''; } // Project ref @@ -778,7 +786,7 @@ if ($resql) { print ''; } - // Thirpdarty + // Thirdparty if (! empty($arrayfields['s.nom']['checked'])) { print ''; From 5cf111120431d22f10a57b755c7bddc671171185 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 7 Nov 2019 08:44:09 +0100 Subject: [PATCH 006/784] NEW Salaries list - Add date start & date end --- htdocs/salaries/list.php | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 51fd8462180..ec859678911 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -40,6 +40,8 @@ $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; $search_ref = GETPOST('search_ref', 'int'); $search_user = GETPOST('search_user', 'alpha'); $search_label = GETPOST('search_label', 'alpha'); +$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); +$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); $search_amount = GETPOST('search_amount', 'alpha'); $search_account = GETPOST('search_account', 'int'); @@ -80,7 +82,10 @@ else 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_user=""; $search_label=""; + $search_date_start=''; + $search_date_end=''; $search_amount=""; $search_account=''; $typeid=""; @@ -111,11 +116,13 @@ $sql.= " WHERE u.rowid = s.fk_user"; $sql.= " AND s.entity = ".$conf->entity; // Search criteria -if ($search_ref) $sql.=" AND s.rowid=".$search_ref; -if ($search_user) $sql.=natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email'), $search_user); -if ($search_label) $sql.=natural_search(array('s.label'), $search_label); -if ($search_amount) $sql.=natural_search("s.amount", $search_amount, 1); -if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account; +if ($search_ref) $sql.=" AND s.rowid=".$search_ref; +if ($search_user) $sql.=natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email'), $search_user); +if ($search_label) $sql.=natural_search(array('s.label'), $search_label); +if ($search_date_start) $sql.= " AND s.datep >= '" . $db->idate($search_date_start) . "'"; +if ($search_date_end) $sql.= " AND s.datep <= '" . $db->idate($search_date_end) . "'"; +if ($search_amount) $sql.=natural_search("s.amount", $search_amount, 1); +if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account; if ($filtre) { $filtre=str_replace(":", "=", $filtre); $sql .= " AND ".$filtre; @@ -171,7 +178,7 @@ if ($result) print ''; // Ref - print ''; // Employee @@ -181,9 +188,18 @@ if ($result) // Label print ''; // Date - print ''; + print ''; // Type - print ''; // Account @@ -239,7 +255,7 @@ if ($result) // Label payment print "\n"; // Date payment - print '\n"; + print '\n"; // Type print ''; // Account @@ -269,7 +285,7 @@ if ($result) print ''; } // Amount - print ''; + print ''; print ''; print "\n"; @@ -281,7 +297,7 @@ if ($result) $colspan=5; if (! empty($conf->banque->enabled)) $colspan++; print ''; - print '"; + print '"; print ""; print "
'; - print $objectstatic->getNomUrl(1, '', '', 0, 1); + print $objectstatic->getNomUrl(1, '', '', 0, 1, $conf->global->PROPAL_LIST_SHOW_NOTES); print ''; From fefb4a7f95719d4ed74172996b5e858a579517e8 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Tue, 5 Nov 2019 15:13:44 +0100 Subject: [PATCH 002/784] FIX replace
by
--- htdocs/comm/propal/class/propal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 1ec4567d774..26f28aed9ea 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3630,7 +3630,7 @@ class Propal extends CommonObject $txttoshow .= dol_string_nohtmltag($this->note_private, 1); } if (!empty($this->note_public)) { - if (!empty($txttoshow)) $txttoshow .= '
'; + if (!empty($txttoshow)) $txttoshow .= '
'; $txttoshow .= dol_string_nohtmltag($this->note_public, 1); } } From bcafef42b0895ee310a13b3bae589f01e3d45598 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Wed, 6 Nov 2019 16:45:52 +0100 Subject: [PATCH 003/784] NEW tooltip notes with first public note and then private note --- htdocs/comm/propal/class/propal.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 26f28aed9ea..74da579e77e 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3626,13 +3626,13 @@ class Propal extends CommonObject $txttoshow .= dol_string_nohtmltag($this->note_public, 1); } } else { - if (!empty($this->note_private)) { - $txttoshow .= dol_string_nohtmltag($this->note_private, 1); - } if (!empty($this->note_public)) { - if (!empty($txttoshow)) $txttoshow .= '
'; $txttoshow .= dol_string_nohtmltag($this->note_public, 1); } + if (!empty($this->note_private)) { + if (!empty($txttoshow)) $txttoshow .= '

'; + $txttoshow .= dol_string_nohtmltag($this->note_private, 1); + } } } From 938d997e51f8930b73a906a39162d12108dc2a82 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 7 Nov 2019 06:33:33 +0100 Subject: [PATCH 004/784] NEW Propal list - Add date start & date end --- htdocs/comm/propal/list.php | 153 +++++++++++++++++++----------------- 1 file changed, 80 insertions(+), 73 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index bccc742aa8e..9a2721a51ea 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1,18 +1,19 @@ - * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2005-2013 Regis Houssin - * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2011 Juanjo Menent - * Copyright (C) 2010-2011 Philippe Grand - * Copyright (C) 2012 Christophe Battarel - * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2016-2018 Ferran Marcet - * Copyright (C) 2017-2018 Charlene Benke - * Copyright (C) 2018 Nicolas ZABOURI +/* Copyright (C) 2001-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005 Marc Barilley / Ocebo + * Copyright (C) 2005-2013 Regis Houssin + * Copyright (C) 2006 Andre Cianfarani + * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2010-2011 Philippe Grand + * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2016-2018 Ferran Marcet + * Copyright (C) 2017-2018 Charlene Benke + * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2019 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 @@ -75,15 +76,12 @@ $search_zip=GETPOST('search_zip', 'alpha'); $search_state=trim(GETPOST("search_state")); $search_country=GETPOST("search_country", 'int'); $search_type_thirdparty=GETPOST("search_type_thirdparty", 'int'); -$search_day=GETPOST("search_day", "int"); -$search_month=GETPOST("search_month", "int"); -$search_year=GETPOST("search_year", "int"); -$search_dayfin=GETPOST("search_dayfin", "int"); -$search_month_end=GETPOST("search_month_end", "int"); -$search_yearfin=GETPOST("search_yearfin", "int"); -$search_daydelivery=GETPOST("search_daydelivery", "int"); -$search_monthdelivery=GETPOST("search_monthdelivery", "int"); -$search_yeardelivery=GETPOST("search_yeardelivery", "int"); +$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); +$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); +$search_dateend_start = dol_mktime(0, 0, 0, GETPOST('search_dateend_startmonth', 'int'), GETPOST('search_dateend_startday', 'int'), GETPOST('search_dateend_startyear', 'int')); +$search_dateend_end = dol_mktime(23, 59, 59, GETPOST('search_dateend_endmonth', 'int'), GETPOST('search_dateend_endday', 'int'), GETPOST('search_dateend_endyear', 'int')); +$search_datedelivery_start = dol_mktime(0, 0, 0, GETPOST('search_datedelivery_startmonth', 'int'), GETPOST('search_datedelivery_startday', 'int'), GETPOST('search_datedelivery_startyear', 'int')); +$search_datedelivery_end = dol_mktime(23, 59, 59, GETPOST('search_datedelivery_endmonth', 'int'), GETPOST('search_datedelivery_endday', 'int'), GETPOST('search_datedelivery_endyear', 'int')); $search_availability=GETPOST('search_availability', 'int'); $search_categ_cus=trim(GETPOST("search_categ_cus", 'int')); $search_btn=GETPOST('button_search', 'alpha'); @@ -219,15 +217,12 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_type=''; $search_country=''; $search_type_thirdparty=''; - $search_year=''; - $search_month=''; - $search_day=''; - $search_yearfin=''; - $search_month_end=''; - $search_dayfin=''; - $search_yeardelivery=''; - $search_monthdelivery=''; - $search_daydelivery=''; + $search_date_start=''; + $search_date_end=''; + $search_dateend_start=''; + $search_dateend_end=''; + $search_datedelivery_start=''; + $search_datedelivery_end=''; $search_availability=''; $viewstatut=''; $object_statut=''; @@ -313,38 +308,41 @@ if (! $user->rights->societe->client->voir && ! $socid) //restriction { $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; } -if ($search_town) $sql.= natural_search('s.town', $search_town); -if ($search_zip) $sql.= natural_search("s.zip", $search_zip); -if ($search_state) $sql.= natural_search("state.nom", $search_state); -if ($search_country) $sql .= " AND s.fk_pays IN (".$db->escape($search_country).')'; -if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->escape($search_type_thirdparty).')'; -if ($search_ref) $sql .= natural_search('p.ref', $search_ref); -if ($search_refcustomer) $sql .= natural_search('p.ref_client', $search_refcustomer); -if ($search_refproject) $sql .= natural_search('pr.ref', $search_refproject); -if ($search_project) $sql .= natural_search('pr.title', $search_project); -if ($search_availability) $sql .= " AND p.fk_availability IN (".$db->escape($search_availability).')'; +if ($search_town) $sql.= natural_search('s.town', $search_town); +if ($search_zip) $sql.= natural_search("s.zip", $search_zip); +if ($search_state) $sql.= natural_search("state.nom", $search_state); +if ($search_country) $sql .= " AND s.fk_pays IN (".$db->escape($search_country).')'; +if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->escape($search_type_thirdparty).')'; +if ($search_ref) $sql .= natural_search('p.ref', $search_ref); +if ($search_refcustomer) $sql .= natural_search('p.ref_client', $search_refcustomer); +if ($search_refproject) $sql .= natural_search('pr.ref', $search_refproject); +if ($search_project) $sql .= natural_search('pr.title', $search_project); +if ($search_availability) $sql .= " AND p.fk_availability IN (".$db->escape($search_availability).')'; -if ($search_societe) $sql .= natural_search('s.nom', $search_societe); -if ($search_login) $sql .= natural_search("u.login", $search_login); -if ($search_montant_ht != '') $sql.= natural_search("p.total_ht", $search_montant_ht, 1); -if ($search_montant_vat != '') $sql.= natural_search("p.tva", $search_montant_vat, 1); -if ($search_montant_ttc != '') $sql.= natural_search("p.total", $search_montant_ttc, 1); +if ($search_societe) $sql .= natural_search('s.nom', $search_societe); +if ($search_login) $sql .= natural_search("u.login", $search_login); +if ($search_montant_ht != '') $sql.= natural_search("p.total_ht", $search_montant_ht, 1); +if ($search_montant_vat != '') $sql.= natural_search("p.tva", $search_montant_vat, 1); +if ($search_montant_ttc != '') $sql.= natural_search("p.total", $search_montant_ttc, 1); if ($sall) { $sql .= natural_search(array_keys($fieldstosearchall), $sall); } -if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); -if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; +if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); +if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; -if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$db->escape($search_product_category); -if ($socid > 0) $sql.= ' AND s.rowid = '.$socid; +if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$db->escape($search_product_category); +if ($socid > 0) $sql.= ' AND s.rowid = '.$socid; if ($viewstatut != '' && $viewstatut != '-1') { $sql.= ' AND p.fk_statut IN ('.$db->escape($viewstatut).')'; } -$sql.= dolSqlDateFilter("p.datep", $search_day, $search_month, $search_year); -$sql.= dolSqlDateFilter("p.fin_validite", $search_dayfin, $search_month_end, $search_yearfin); -$sql.= dolSqlDateFilter("p.date_livraison", $search_daydelivery, $search_monthdelivery, $search_yeardelivery); -if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$db->escape($search_sale); +if ($search_date_start) $sql.= " AND p.datep >= '" . $db->idate($search_date_start) . "'"; +if ($search_date_end) $sql.= " AND p.datep <= '" . $db->idate($search_date_end) . "'"; +if ($search_dateend_start) $sql.= " AND p.fin_validite >= '" . $db->idate($search_dateend_start) . "'"; +if ($search_dateend_end) $sql.= " AND p.fin_validite <= '" . $db->idate($search_dateend_end) . "'"; +if ($search_datedelivery_start) $sql.= " AND p.date_livraison >= '" . $db->idate($search_datedelivery_start) . "'"; +if ($search_datedelivery_end) $sql.= " AND p.date_livraison <= '" . $db->idate($search_datedelivery_end) . "'"; +if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$db->escape($search_sale); if ($search_user > 0) { $sql.= " AND c.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".$db->escape($search_user); @@ -594,34 +592,43 @@ if ($resql) // Date if (! empty($arrayfields['p.date']['checked'])) { - print '
'; - //print $langs->trans('Month').': '; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - //print ' '.$langs->trans('Year').': '; - $formother->select_year($search_year, 'search_year', 1, 20, 5); + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1); + print '
'; print '
'; - //print $langs->trans('Month').': '; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - //print ' '.$langs->trans('Year').': '; - $formother->select_year($search_yearfin, 'search_yearfin', 1, 20, 5); + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_dateend_start?$search_dateend_start:-1, 'search_dateend_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_dateend_end?$search_dateend_end:-1, 'search_dateend_end', 0, 0, 1); + print '
'; print '
'; - //print $langs->trans('Month').': '; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - //print ' '.$langs->trans('Year').': '; - $formother->select_year($search_yeardelivery, 'search_yeardelivery', 1, 20, 5); + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_datedelivery_start?$search_datedelivery_start:-1, 'search_datedelivery_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_datedelivery_end?$search_datedelivery_end:-1, 'search_datedelivery_end', 0, 0, 1); + print '
'; print '
'; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($search_year?$search_year:-1, 'search_year', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1); + print '
'; print '
'; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($search_year_lim?$search_year_lim:-1, 'search_year_lim', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); - print '
'.$langs->trans("Alert"); + print '
'; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_datelimit_start?$search_datelimit_start:-1, 'search_datelimit_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_datelimit_end?$search_datelimit_end:-1, 'search_datelimit_end', 0, 0, 1); + print '
'; print '
'; + print ''; print ''; print ' '; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1); + print '
'; + print '
'; + print ''; $form->select_types_paiements($typeid, 'typeid', '', 0, 1, 1, 16); print '".dol_trunc($obj->label, 40)."'.dol_print_date($db->jdate($obj->datep), 'day')."'.dol_print_date($db->jdate($obj->datep), 'day')."'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.''.price($obj->amount).''.price($obj->amount).'
'.$langs->trans("Total").''.price($total)."'.price($total)."
"; From b85dc0c5e5556618c0c3a328dc20fc32d3fbabfb Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 7 Nov 2019 09:19:48 +0100 Subject: [PATCH 007/784] NEW Various payment list - Add search date start & date end & subledger_account --- htdocs/compta/bank/various_payment/list.php | 96 +++++++++++++-------- 1 file changed, 62 insertions(+), 34 deletions(-) diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index d73d6d8a391..205df51d6a6 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2017-2019 Alexandre Spangaro * Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2018 Frédéric France * @@ -44,11 +44,15 @@ $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; $search_ref = GETPOST('search_ref', 'int'); $search_user = GETPOST('search_user', 'alpha'); $search_label = GETPOST('search_label', 'alpha'); +$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); +$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); $search_amount_deb = GETPOST('search_amount_deb', 'alpha'); $search_amount_cred = GETPOST('search_amount_cred', 'alpha'); $search_account = GETPOST('search_account', 'int'); -$search_date = dol_mktime(0, 0, 0, GETPOST('date_docmonth', 'int'), GETPOST('date_docday', 'int'), GETPOST('date_docyear', 'int')); -$search_accountancy_code = GETPOST("search_accountancy_code"); +$search_accountancy_account = GETPOST("search_accountancy_account"); +if ($search_accountancy_account == - 1) $search_accountancy_account = ''; +$search_accountancy_subledger = GETPOST("search_accountancy_subledger"); +if ($search_accountancy_subledger == - 1) $search_accountancy_subledger = ''; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); @@ -81,12 +85,14 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' { $search_ref=""; $search_label=""; + $search_date_start=''; + $search_date_end=''; $search_amount_deb=""; $search_amount_cred=""; $search_account=''; + $search_accountancy_account = ''; + $search_accountancy_subledger = ''; $typeid=""; - $search_date = ''; - $search_accountancy_code = ''; } /* @@ -100,7 +106,7 @@ $formaccounting = new FormAccounting($db); $variousstatic = new PaymentVarious($db); $accountstatic = new Account($db); -$sql = "SELECT v.rowid, v.sens, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank, v.accountancy_code,"; +$sql = "SELECT v.rowid, v.sens, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank, v.accountancy_code, v.subledger_account,"; $sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,"; $sql.= " pst.code as payment_code"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v"; @@ -110,14 +116,16 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.row $sql.= " WHERE v.entity IN (".getEntity('payment_various').")"; // Search criteria -if ($search_ref) $sql.=" AND v.rowid=".$db->escape($search_ref); -if ($search_label) $sql.=natural_search(array('v.label'), $search_label); -if ($search_amount_deb) $sql.=natural_search("v.amount", $search_amount_deb, 1); -if ($search_amount_cred) $sql.=natural_search("v.amount", $search_amount_cred, 1); -if ($search_account > 0) $sql.=" AND b.fk_account=".$db->escape($search_account); -if ($search_date) $sql.=" AND v.datep = '".$db->idate($search_date)."'"; -if ($search_accountancy_code > 0) $sql.=" AND v.accountancy_code=".$db->escape($search_accountancy_code); -if ($typeid > 0) $sql .= " AND v.fk_typepayment=".$typeid; +if ($search_ref) $sql.= " AND v.rowid=".$db->escape($search_ref); +if ($search_label) $sql.= natural_search(array('v.label'), $search_label); +if ($search_date_start) $sql.= " AND v.datep >= '" . $db->idate($search_date_start) . "'"; +if ($search_date_end) $sql.= " AND v.datep <= '" . $db->idate($search_date_end) . "'"; +if ($search_amount_deb) $sql.= natural_search("v.amount", $search_amount_deb, 1); +if ($search_amount_cred) $sql.= natural_search("v.amount", $search_amount_cred, 1); +if ($search_account > 0) $sql.= " AND b.fk_account=".$db->escape($search_account); +if ($search_accountancy_account > 0) $sql.= " AND v.accountancy_code=".$db->escape($search_accountancy_account); +if ($search_accountancy_subledger > 0) $sql.= " AND v.subledger_account=".$db->escape($search_accountancy_subledger); +if ($typeid > 0) $sql.= " AND v.fk_typepayment=".$typeid; if ($filtre) { $filtre=str_replace(":", "=", $filtre); $sql .= " AND ".$filtre; @@ -143,14 +151,16 @@ if ($result) $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); - if ($search_ref) $param.='&search_ref='.urlencode($search_ref); - if ($search_label) $param.='&search_label='.urlencode($search_label); - if ($typeid > 0) $param.='&typeid='.urlencode($typeid); - if ($search_amount_deb) $param.='&search_amount_deb='.urlencode($search_amount_deb); - if ($search_amount_cred) $param.='&search_amount_cred='.urlencode($search_amount_cred); - if ($search_account > 0) $param.='&search_amount='.urlencode($search_account); - //if ($search_date) $param.='&search_date='.$search_date; - if ($search_accountancy_code > 0) $param.='&search_accountancy_code='.urlencode($search_accountancy_code); + if ($search_ref) $param.='&search_ref='.urlencode($search_ref); + if ($search_label) $param.='&search_label='.urlencode($search_label); + if ($search_date_start) $param.='&search_date_start='.urlencode($search_date_start); + if ($search_date_end) $param.='&search_date_end='.urlencode($search_date_end); + if ($typeid > 0) $param.='&typeid='.urlencode($typeid); + if ($search_amount_deb) $param.='&search_amount_deb='.urlencode($search_amount_deb); + if ($search_amount_cred) $param.='&search_amount_cred='.urlencode($search_amount_cred); + if ($search_account > 0) $param.='&search_amount='.urlencode($search_account); + if ($search_accountancy_account > 0) $param.='&search_accountancy_account='.urlencode($search_accountancy_account); + if ($search_accountancy_subledger > 0) $param.='&search_accountancy_subledger='.urlencode($search_accountancy_subledger); if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); @@ -190,7 +200,13 @@ if ($result) // Date print ''; print '
'; - print $form->selectDate($search_date, 'date_doc', 0, 0, 1); + print $langs->trans('From') . ' '; + print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1); + print '
'; print ''; @@ -207,12 +223,20 @@ if ($result) print ''; } - // Accounting account + if (! empty($conf->accounting->enabled)) { + // Accounting account print ''; print '
'; - print $formaccounting->select_account($search_accountancy_code, 'search_accountancy_code', 1, array (), 1, 1, 'maxwidth200'); + print $formaccounting->select_account($search_accountancy_account, 'search_accountancy_account', 1, array (), 1, 1, 'maxwidth200'); + print '
'; + print ''; + + // Subledger account + print ''; + print '
'; + print $formaccounting->select_auxaccount($search_accountancy_subledger, 'search_accountancy_subledger', 1, array (), 1, 1, 'maxwidth200'); print '
'; print ''; } @@ -237,7 +261,8 @@ if ($result) print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "v.datep,v.rowid", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'left '); if (! empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder); - if (! empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, '', $sortfield, $sortorder, 'left '); + if (! empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccountingShort", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, '', $sortfield, $sortorder, 'left '); + if (! empty($conf->accounting->enabled)) print_liste_field_titre("SubledgerAccount", $_SERVER["PHP_SELF"], "v.subledger_account", "", $param, '', $sortfield, $sortorder, 'left '); print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "v.amount", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "v.amount", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); @@ -305,8 +330,15 @@ if ($result) if (! $i) $totalarray['nbfield']++; } + // Accounting subledger account + if (! empty($conf->accounting->enabled)) + { + print '' . length_accounta($obj->subledger_account) . ''; + if (! $i) $totalarray['nbfield']++; + } + // Debit - print ""; + print ''; if ($obj->sens == 0) { print price($obj->amount); @@ -314,10 +346,10 @@ if ($result) } if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['pos'][$totalarray['nbfield']]='total_deb'; - print ""; + print ''; // Credit - print ""; + print ''; if ($obj->sens == 1) { print price($obj->amount); @@ -325,17 +357,13 @@ if ($result) } if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['pos'][$totalarray['nbfield']]='total_cred'; - print ""; + print ''; print ""; $i++; } - $colspan=4; - if (! empty($conf->banque->enabled)) $colspan++; - if (! empty($conf->accounting->enabled)) $colspan++; - // Show total line include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; From 9ff10d430b643772d239b9889a113e3e17273483 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 7 Nov 2019 13:57:04 +0100 Subject: [PATCH 008/784] NEW Customer command list - Add date start & date end --- htdocs/commande/list.php | 136 ++++++++++++++++++++------------------- 1 file changed, 71 insertions(+), 65 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index dadc25737b6..a66731885a8 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -56,12 +56,10 @@ $confirm=GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'orderlist'; -$search_orderyear=GETPOST("search_orderyear", "int"); -$search_ordermonth=GETPOST("search_ordermonth", "int"); -$search_orderday=GETPOST("search_orderday", "int"); -$search_deliveryyear=GETPOST("search_deliveryyear", "int"); -$search_deliverymonth=GETPOST("search_deliverymonth", "int"); -$search_deliveryday=GETPOST("search_deliveryday", "int"); +$search_dateorder_start= dol_mktime(0, 0, 0, GETPOST('search_dateorder_startmonth', 'int'), GETPOST('search_dateorder_startday', 'int'), GETPOST('search_dateorder_startyear', 'int')); +$search_dateorder_end= dol_mktime(23, 59, 59, GETPOST('search_dateorder_endmonth', 'int'), GETPOST('search_dateorder_endday', 'int'), GETPOST('search_dateorder_endyear', 'int')); +$search_datedelivery_start= dol_mktime(0, 0, 0, GETPOST('search_datedelivery_startmonth', 'int'), GETPOST('search_datedelivery_startday', 'int'), GETPOST('search_datedelivery_startyear', 'int')); +$search_datedelivery_end= dol_mktime(23, 59, 59, GETPOST('search_datedelivery_endmonth', 'int'), GETPOST('search_datedelivery_endday', 'int'), GETPOST('search_datedelivery_endyear', 'int')); $search_product_category=GETPOST('search_product_category', 'int'); $search_ref=GETPOST('search_ref', 'alpha')!=''?GETPOST('search_ref', 'alpha'):GETPOST('sref', 'alpha'); $search_ref_customer=GETPOST('search_ref_customer', 'alpha'); @@ -197,12 +195,10 @@ if (empty($reshook)) $search_total_ht=''; $search_total_vat=''; $search_total_ttc=''; - $search_orderyear=''; - $search_ordermonth=''; - $search_orderday=''; - $search_deliveryday=''; - $search_deliverymonth=''; - $search_deliveryyear=''; + $search_dateorder_start=''; + $search_dateorder_end=''; + $search_datedelivery_start=''; + $search_datedelivery_end=''; $search_project_ref=''; $search_project=''; $viewstatut=''; @@ -311,22 +307,24 @@ if ($viewstatut <> '') $sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed } } -$sql.= dolSqlDateFilter("c.date_commande", $search_orderday, $search_ordermonth, $search_orderyear); -$sql.= dolSqlDateFilter("c.date_livraison", $search_deliveryday, $search_deliverymonth, $search_deliveryyear); -if ($search_town) $sql.= natural_search('s.town', $search_town); -if ($search_zip) $sql.= natural_search("s.zip", $search_zip); -if ($search_state) $sql.= natural_search("state.nom", $search_state); -if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; -if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; -if ($search_company) $sql .= natural_search('s.nom', $search_company); -if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; -if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user; -if ($search_total_ht != '') $sql.= natural_search('c.total_ht', $search_total_ht, 1); -if ($search_total_ttc != '') $sql.= natural_search('c.total_ttc', $search_total_ttc, 1); -if ($search_project_ref != '') $sql.= natural_search("p.ref", $search_project_ref); -if ($search_project != '') $sql.= natural_search("p.title", $search_project); -if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); -if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; +if ($search_dateorder_start) $sql.= " AND c.date_commande >= '" . $db->idate($search_dateorder_start) . "'"; +if ($search_dateorder_end) $sql.= " AND c.date_commande <= '" . $db->idate($search_dateorder_end) . "'"; +if ($search_datedelivery_start) $sql.= " AND c.date_livraison >= '" . $db->idate($search_datedelivery_start) . "'"; +if ($search_datedelivery_end) $sql.= " AND c.date_livraison <= '" . $db->idate($search_datedelivery_end) . "'"; +if ($search_town) $sql.= natural_search('s.town', $search_town); +if ($search_zip) $sql.= natural_search("s.zip", $search_zip); +if ($search_state) $sql.= natural_search("state.nom", $search_state); +if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; +if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; +if ($search_company) $sql .= natural_search('s.nom', $search_company); +if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; +if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user; +if ($search_total_ht != '') $sql.= natural_search('c.total_ht', $search_total_ht, 1); +if ($search_total_ttc != '') $sql.= natural_search('c.total_ttc', $search_total_ttc, 1); +if ($search_project_ref != '') $sql.= natural_search("p.ref", $search_project_ref); +if ($search_project != '') $sql.= natural_search("p.title", $search_project); +if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); +if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks @@ -402,34 +400,32 @@ if ($resql) if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); - if ($sall) $param.='&sall='.urlencode($sall); - if ($socid > 0) $param.='&socid='.urlencode($socid); - if ($viewstatut != '') $param.='&viewstatut='.urlencode($viewstatut); - if ($search_orderday) $param.='&search_orderday='.urlencode($search_orderday); - if ($search_ordermonth) $param.='&search_ordermonth='.urlencode($search_ordermonth); - if ($search_orderyear) $param.='&search_orderyear='.urlencode($search_orderyear); - if ($search_deliveryday) $param.='&search_deliveryday='.urlencode($search_deliveryday); - if ($search_deliverymonth) $param.='&search_deliverymonth='.urlencode($search_deliverymonth); - if ($search_deliveryyear) $param.='&search_deliveryyear='.urlencode($search_deliveryyear); - if ($search_ref) $param.='&search_ref='.urlencode($search_ref); - if ($search_company) $param.='&search_company='.urlencode($search_company); - if ($search_ref_customer) $param.='&search_ref_customer='.urlencode($search_ref_customer); - if ($search_user > 0) $param.='&search_user='.urlencode($search_user); - if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale); - if ($search_total_ht != '') $param.='&search_total_ht='.urlencode($search_total_ht); - if ($search_total_vat != '') $param.='&search_total_vat='.urlencode($search_total_vat); - if ($search_total_ttc != '') $param.='&search_total_ttc='.urlencode($search_total_ttc); - if ($search_project_ref >= 0) $param.="&search_project_ref=".urlencode($search_project_ref); - if ($search_town != '') $param.='&search_town='.urlencode($search_town); - if ($search_zip != '') $param.='&search_zip='.urlencode($search_zip); - if ($search_state != '') $param.='&search_state='.urlencode($search_state); - if ($search_country != '') $param.='&search_country='.urlencode($search_country); + if ($sall) $param.='&sall='.urlencode($sall); + if ($socid > 0) $param.='&socid='.urlencode($socid); + if ($viewstatut != '') $param.='&viewstatut='.urlencode($viewstatut); + if ($search_dateorder_start) $param.='&search_dateorder_start=' . urlencode($search_dateorder_start); + if ($search_dateorder_end) $param.='&search_dateorder_end=' . urlencode($search_dateorder_end); + if ($search_datedelivery_start) $param.='&search_datedelivery_start=' . urlencode($search_datedelivery_start); + if ($search_datedelivery_end) $param.='&search_datedelivery_end=' . urlencode($search_datedelivery_end); + if ($search_ref) $param.='&search_ref='.urlencode($search_ref); + if ($search_company) $param.='&search_company='.urlencode($search_company); + if ($search_ref_customer) $param.='&search_ref_customer='.urlencode($search_ref_customer); + if ($search_user > 0) $param.='&search_user='.urlencode($search_user); + if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale); + if ($search_total_ht != '') $param.='&search_total_ht='.urlencode($search_total_ht); + if ($search_total_vat != '') $param.='&search_total_vat='.urlencode($search_total_vat); + if ($search_total_ttc != '') $param.='&search_total_ttc='.urlencode($search_total_ttc); + if ($search_project_ref >= 0) $param.="&search_project_ref=".urlencode($search_project_ref); + if ($search_town != '') $param.='&search_town='.urlencode($search_town); + if ($search_zip != '') $param.='&search_zip='.urlencode($search_zip); + if ($search_state != '') $param.='&search_state='.urlencode($search_state); + if ($search_country != '') $param.='&search_country='.urlencode($search_country); if ($search_type_thirdparty != '') $param.='&search_type_thirdparty='.urlencode($search_type_thirdparty); if ($search_product_category != '') $param.='&search_product_category='.urlencode($search_product_category); if ($search_categ_cus > 0) $param.='&search_categ_cus='.urlencode($search_categ_cus); - if ($show_files) $param.='&show_files=' .urlencode($show_files); - if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); - if ($billed != '') $param.='&billed='.urlencode($billed); + if ($show_files) $param.='&show_files=' .urlencode($show_files); + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + if ($billed != '') $param.='&billed='.urlencode($billed); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -646,18 +642,28 @@ if ($resql) // Date order if (! empty($arrayfields['c.date_commande']['checked'])) { - print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($search_orderyear?$search_orderyear:-1, 'search_orderyear', 1, 20, 5); + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_dateorder_start?$search_dateorder_start:-1, 'search_dateorder_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_dateorder_end?$search_dateorder_end:-1, 'search_dateorder_end', 0, 0, 1); + print '
'; print ''; } if (! empty($arrayfields['c.date_delivery']['checked'])) { - print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($search_deliveryyear?$search_deliveryyear:-1, 'search_deliveryyear', 1, 20, 5); + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_datedelivery_start?$search_datedelivery_start:-1, 'search_datedelivery_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_datedelivery_end?$search_datedelivery_end:-1, 'search_datedelivery_end', 0, 0, 1); + print '
'; print ''; } if (! empty($arrayfields['c.total_ht']['checked'])) @@ -1044,7 +1050,7 @@ if ($resql) print ''; if (! $i) $totalarray['nbfield']++; } - // Plannned date of delivery + // Planned date of delivery if (! empty($arrayfields['c.date_delivery']['checked'])) { print ''; @@ -1055,7 +1061,7 @@ if ($resql) // Amount HT if (! empty($arrayfields['c.total_ht']['checked'])) { - print ''.price($obj->total_ht)."\n"; + print ''.price($obj->total_ht)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['pos'][$totalarray['nbfield']]='c.total_ht'; $totalarray['val']['c.total_ht'] += $obj->total_ht; @@ -1063,7 +1069,7 @@ if ($resql) // Amount VAT if (! empty($arrayfields['c.total_vat']['checked'])) { - print ''.price($obj->total_tva)."\n"; + print ''.price($obj->total_tva)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['pos'][$totalarray['nbfield']]='c.total_tva'; $totalarray['val']['c.total_tva'] += $obj->total_tva; @@ -1071,7 +1077,7 @@ if ($resql) // Amount TTC if (! empty($arrayfields['c.total_ttc']['checked'])) { - print ''.price($obj->total_ttc)."\n"; + print ''.price($obj->total_ttc)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['pos'][$totalarray['nbfield']]='c.total_ttc'; $totalarray['val']['c.total_ttc'] += $obj->total_ttc; From 55e3d7b89983f7af3b37da096793434ee0f77d41 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 7 Nov 2019 14:21:11 +0100 Subject: [PATCH 009/784] NEW Expedition list - Add date start & date end --- htdocs/expedition/list.php | 77 +++++++++++++++++++++++++++----------- 1 file changed, 56 insertions(+), 21 deletions(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index eeb05e8926c..961afb0191d 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -59,6 +59,10 @@ $search_state=trim(GETPOST("search_state")); $search_country=GETPOST("search_country", 'int'); $search_type_thirdparty=GETPOST("search_type_thirdparty", 'int'); $search_billed=GETPOST("search_billed", 'int'); +$search_datedelivery_start= dol_mktime(0, 0, 0, GETPOST('search_datedelivery_startmonth', 'int'), GETPOST('search_datedelivery_startday', 'int'), GETPOST('search_datedelivery_startyear', 'int')); +$search_datedelivery_end= dol_mktime(23, 59, 59, GETPOST('search_datedelivery_endmonth', 'int'), GETPOST('search_datedelivery_endday', 'int'), GETPOST('search_datedelivery_endyear', 'int')); +$search_datereceipt_start= dol_mktime(0, 0, 0, GETPOST('search_datereceipt_startmonth', 'int'), GETPOST('search_datereceipt_startday', 'int'), GETPOST('search_datereceipt_startyear', 'int')); +$search_datereceipt_end= dol_mktime(23, 59, 59, GETPOST('search_datereceipt_endmonth', 'int'), GETPOST('search_datereceipt_endday', 'int'), GETPOST('search_datereceipt_endyear', 'int')); $sall = trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); $optioncss = GETPOST('optioncss', 'alpha'); @@ -156,6 +160,10 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_country=''; $search_type_thirdparty=''; $search_billed=''; + $search_datedelivery_start=''; + $search_datedelivery_end=''; + $search_datereceipt_start=''; + $search_datereceipt_end=''; $viewstatut=''; $toselect = ''; $search_array_options=array(); @@ -224,17 +232,22 @@ if ($socid) if ($viewstatut <> '' && $viewstatut >= 0) { $sql.= " AND e.fk_statut = ".$viewstatut; } -if ($search_ref_customer != '') $sql.=natural_search('e.ref_customer', $search_ref_customer); +if ($search_ref_customer != '') $sql.=natural_search('e.ref_customer', $search_ref_customer); if ($search_billed != '' && $search_billed >= 0) $sql.=' AND e.billed = '.$search_billed; -if ($search_town) $sql.= natural_search('s.town', $search_town); -if ($search_zip) $sql.= natural_search("s.zip", $search_zip); -if ($search_state) $sql.= natural_search("state.nom", $search_state); -if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; -if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; -if ($search_ref_exp) $sql .= natural_search('e.ref', $search_ref_exp); -if ($search_ref_liv) $sql .= natural_search('l.ref', $search_ref_liv); -if ($search_company) $sql .= natural_search('s.nom', $search_company); -if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); +if ($search_town) $sql.= natural_search('s.town', $search_town); +if ($search_zip) $sql.= natural_search("s.zip", $search_zip); +if ($search_state) $sql.= natural_search("state.nom", $search_state); +if ($search_country) $sql.= " AND s.fk_pays IN (".$search_country.')'; +if ($search_type_thirdparty) $sql.= " AND s.fk_typent IN (".$search_type_thirdparty.')'; +if ($search_ref_exp) $sql.= natural_search('e.ref', $search_ref_exp); +if ($search_ref_liv) $sql.= natural_search('l.ref', $search_ref_liv); +if ($search_company) $sql.= natural_search('s.nom', $search_company); +if ($search_datedelivery_start) $sql.= " AND e.date_delivery >= '" . $db->idate($search_datedelivery_start) . "'"; +if ($search_datedelivery_end) $sql.= " AND e.date_delivery <= '" . $db->idate($search_datedelivery_end) . "'"; +if ($search_datereceipt_start) $sql.= " AND l.date_delivery >= '" . $db->idate($search_datereceipt_start) . "'"; +if ($search_datereceipt_end) $sql.= " AND l.date_delivery <= '" . $db->idate($search_datereceipt_end) . "'"; + +if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; @@ -273,15 +286,19 @@ if ($resql) $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); - if ($sall) $param.= "&sall=".urlencode($sall); - if ($search_ref_exp) $param.= "&search_ref_exp=".urlencode($search_ref_exp); - if ($search_ref_liv) $param.= "&search_ref_liv=".urlencode($search_ref_liv); - if ($search_ref_customer) $param.= "&search_ref_customer=".urlencode($search_ref_customer); - if ($search_company) $param.= "&search_company=".urlencode($search_company); - if ($search_town) $param.= '&search_town='.urlencode($search_town); - if ($search_zip) $param.= '&search_zip='.urlencode($search_zip); - if ($viewstatut != '') $param.= '&viewstatut='.urlencode($viewstatut); - if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + if ($sall) $param.= "&sall=".urlencode($sall); + if ($search_ref_exp) $param.= "&search_ref_exp=".urlencode($search_ref_exp); + if ($search_ref_liv) $param.= "&search_ref_liv=".urlencode($search_ref_liv); + if ($search_ref_customer) $param.= "&search_ref_customer=".urlencode($search_ref_customer); + if ($search_company) $param.= "&search_company=".urlencode($search_company); + if ($search_town) $param.= '&search_town='.urlencode($search_town); + if ($search_zip) $param.= '&search_zip='.urlencode($search_zip); + if ($search_datedelivery_start) $param.='&search_datedelivery_start=' . urlencode($search_datedelivery_start); + if ($search_datedelivery_end) $param.='&search_datedelivery_end=' . urlencode($search_datedelivery_end); + if ($search_datereceipt_start) $param.='&search_datereceipt_start=' . urlencode($search_datereceipt_start); + if ($search_datereceipt_end) $param.='&search_datereceipt_end=' . urlencode($search_datereceipt_end); + if ($viewstatut != '') $param.= '&viewstatut='.urlencode($viewstatut); + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -391,7 +408,16 @@ if ($resql) // Date delivery planned if (! empty($arrayfields['e.date_delivery']['checked'])) { - print ' '; + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_delivery_start?$search_delivery_start:-1, 'search_delivery_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_delivery_end?$search_delivery_end:-1, 'search_delivery_end', 0, 0, 1); + print '
'; + print ''; } if (! empty($arrayfields['l.ref']['checked'])) { @@ -403,7 +429,16 @@ if ($resql) if (! empty($arrayfields['l.date_delivery']['checked'])) { // Date received - print ' '; + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_receipt_start?$search_receipt_start:-1, 'search_receipt_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_receipt_end?$search_receipt_end:-1, 'search_receipt_end', 0, 0, 1); + print '
'; + print ''; } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; From 86b90b115fec5c0171c95accc1ca40926213217d Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 9 Nov 2019 05:20:13 +0100 Subject: [PATCH 010/784] NEW Invoice list - Add date start & date end --- htdocs/compta/facture/list.php | 56 ++++++++++++++++------------------ 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 2d06fa1f557..8440b514f24 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -569,38 +569,36 @@ if ($resql) $param='&socid='.$socid; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); - if ($sall) $param.='&sall='.urlencode($sall); - if ($search_day) $param.='&search_day='.urlencode($search_day); - if ($search_month) $param.='&search_month='.urlencode($search_month); - if ($search_year) $param.='&search_year=' .urlencode($search_year); - if ($search_day_lim) $param.='&search_day_lim='.urlencode($search_day_lim); - if ($search_month_lim) $param.='&search_month_lim='.urlencode($search_month_lim); - if ($search_year_lim) $param.='&search_year_lim=' .urlencode($search_year_lim); - if ($search_ref) $param.='&search_ref=' .urlencode($search_ref); - if ($search_refcustomer) $param.='&search_refcustomer=' .urlencode($search_refcustomer); - if ($search_project_ref) $param.='&search_project_ref='.urlencode($search_project_ref); - if ($search_project) $param.='&search_project='.urlencode($search_project); - if ($search_type != '') $param.='&search_type='.urlencode($search_type); - if ($search_societe) $param.='&search_societe=' .urlencode($search_societe); - if ($search_town) $param.='&search_town='.urlencode($search_town); - if ($search_zip) $param.='&search_zip='.urlencode($search_zip); - if ($search_sale > 0) $param.='&search_sale=' .urlencode($search_sale); - if ($search_user > 0) $param.='&search_user=' .urlencode($search_user); + if ($sall) $param.='&sall='.urlencode($sall); + if ($search_date_start) $param.='&search_date_start=' . urlencode($search_date_start); + if ($search_date_end) $param.='&search_date_end=' . urlencode($search_date_end); + if ($search_datelimit_start) $param.='&search_datelimit_start=' . urlencode($search_datelimit_start); + if ($search_datelimit_end) $param.='&search_datelimit_end=' . urlencode($search_datelimit_end); + if ($search_ref) $param.='&search_ref=' .urlencode($search_ref); + if ($search_refcustomer) $param.='&search_refcustomer=' .urlencode($search_refcustomer); + if ($search_project_ref) $param.='&search_project_ref='.urlencode($search_project_ref); + if ($search_project) $param.='&search_project='.urlencode($search_project); + if ($search_type != '') $param.='&search_type='.urlencode($search_type); + if ($search_societe) $param.='&search_societe=' .urlencode($search_societe); + if ($search_town) $param.='&search_town='.urlencode($search_town); + if ($search_zip) $param.='&search_zip='.urlencode($search_zip); + if ($search_sale > 0) $param.='&search_sale=' .urlencode($search_sale); + if ($search_user > 0) $param.='&search_user=' .urlencode($search_user); if ($search_product_category > 0) $param.='&search_product_category=' .urlencode($search_product_category); - if ($search_montant_ht != '') $param.='&search_montant_ht='.urlencode($search_montant_ht); - if ($search_montant_vat != '') $param.='&search_montant_vat='.urlencode($search_montant_vat); + if ($search_montant_ht != '') $param.='&search_montant_ht='.urlencode($search_montant_ht); + if ($search_montant_vat != '') $param.='&search_montant_vat='.urlencode($search_montant_vat); if ($search_montant_localtax1 != '') $param.='&search_montant_localtax1='.urlencode($search_montant_localtax1); if ($search_montant_localtax2 != '') $param.='&search_montant_localtax2='.urlencode($search_montant_localtax2); - if ($search_montant_ttc != '') $param.='&search_montant_ttc='.urlencode($search_montant_ttc); - if ($search_status != '') $param.='&search_status='.urlencode($search_status); - if ($search_paymentmode > 0) $param.='&search_paymentmode='.urlencode($search_paymentmode); - if ($search_paymentterms > 0) $param.='&search_paymentterms='.urlencode($search_paymentterms); - if ($search_module_source) $param.='&search_module_source='.urlencode($search_module_source); - if ($search_pos_source) $param.='&search_pos_source='.urlencode($search_pos_source); - if ($show_files) $param.='&show_files='.urlencode($show_files); - if ($option) $param.="&search_option=".urlencode($option); - if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); - if ($search_categ_cus > 0) $param.='&search_categ_cus='.urlencode($search_categ_cus); + if ($search_montant_ttc != '') $param.='&search_montant_ttc='.urlencode($search_montant_ttc); + if ($search_status != '') $param.='&search_status='.urlencode($search_status); + if ($search_paymentmode > 0) $param.='&search_paymentmode='.urlencode($search_paymentmode); + if ($search_paymentterms > 0) $param.='&search_paymentterms='.urlencode($search_paymentterms); + if ($search_module_source) $param.='&search_module_source='.urlencode($search_module_source); + if ($search_pos_source) $param.='&search_pos_source='.urlencode($search_pos_source); + if ($show_files) $param.='&show_files='.urlencode($show_files); + if ($option) $param.="&search_option=".urlencode($option); + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + if ($search_categ_cus > 0) $param.='&search_categ_cus='.urlencode($search_categ_cus); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; From 812c0327547d08bd9309876d8d4a7f973cac0e18 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 12 Nov 2019 15:56:11 +0100 Subject: [PATCH 011/784] NEW French new regions --- .../install/mysql/data/llx_10_c_regions.sql | 25 ++++++------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/htdocs/install/mysql/data/llx_10_c_regions.sql b/htdocs/install/mysql/data/llx_10_c_regions.sql index be485ddb6b1..bbb7af35bb7 100644 --- a/htdocs/install/mysql/data/llx_10_c_regions.sql +++ b/htdocs/install/mysql/data/llx_10_c_regions.sql @@ -45,25 +45,16 @@ insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 6,'97601',3,'Mayotte'); insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 11,'75056',1,'Île-de-France'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 21,'51108',0,'Champagne-Ardenne'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 22,'80021',0,'Picardie'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 23,'76540',0,'Haute-Normandie'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 24,'45234',2,'Centre'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 25,'14118',0,'Basse-Normandie'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 26,'21231',0,'Bourgogne'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 31,'59350',2,'Nord-Pas-de-Calais'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 41,'57463',0,'Lorraine'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 42,'67482',1,'Alsace'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 43,'25056',0,'Franche-Comté'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 24,'45234',2,'Centre-Val de Loire'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 27,'21231',0,'Bourgogne-Franche-Comté'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 28,'76540',0,'Normandie'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 32,'59350',4,'Hauts-de-France'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 44,'67482',2,'Grand Est'); insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 52,'44109',4,'Pays de la Loire'); insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 53,'35238',0,'Bretagne'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 54,'86194',2,'Poitou-Charentes'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 72,'33063',1,'Aquitaine'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 73,'31555',0,'Midi-Pyrénées'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 74,'87085',2,'Limousin'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 82,'69123',2,'Rhône-Alpes'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 83,'63113',1,'Auvergne'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 91,'34172',2,'Languedoc-Roussillon'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 75,'33063',0,'Nouvelle-Aquitaine'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 76,'31355',1,'Occitanie'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 84,'69123',1,'Auvergne-Rhône-Alpes'); insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 93,'13055',0,'Provence-Alpes-Côte d''Azur'); insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 94,'2A004',0,'Corse'); From 05ab4f79efe7a672d558066703fd4d8fe585e254 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 13 Nov 2019 18:44:11 +0100 Subject: [PATCH 012/784] categories for actioncomm --- htdocs/categories/class/categorie.class.php | 8 + htdocs/categories/index.php | 8 +- htdocs/core/modules/modAgenda.class.php | 327 ++++++++++-------- .../install/mysql/migration/10.0.0-11.0.0.sql | 14 + htdocs/langs/en_US/categories.lang | 3 +- 5 files changed, 215 insertions(+), 145 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index f184f1b433f..e42f0fe32ff 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -54,6 +54,7 @@ class Categorie extends CommonObject const TYPE_ACCOUNT = 'bank_account'; const TYPE_BANK_LINE = 'bank_line'; const TYPE_WAREHOUSE = 'warehouse'; + const TYPE_ACTIONCOMM = 'actioncomm'; /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png @@ -77,6 +78,7 @@ class Categorie extends CommonObject 'user' => 7, 'bank_line' => 8, 'warehouse' => 9, + 'actioncomm' => 9, ); /** @@ -93,6 +95,7 @@ class Categorie extends CommonObject 7 => 'user', 8 => 'bank_line', 9 => 'warehouse', + 10 => 'actioncomm', ); /** @@ -111,6 +114,7 @@ class Categorie extends CommonObject 'bank_account' => 'account', 'project' => 'project', 'warehouse'=> 'warehouse', + 'actioncomm' => 'actioncomm', ); /** @@ -129,6 +133,7 @@ class Categorie extends CommonObject 'bank_account'=> 'account', 'project' => 'project', 'warehouse'=> 'warehouse', + 'actioncomm' => 'warehouse', ); /** @@ -147,6 +152,7 @@ class Categorie extends CommonObject 'bank_account' => 'Account', 'project' => 'Project', 'warehouse'=> 'Entrepot', + 'actioncomm' => 'ActionComm', ); /** @@ -164,6 +170,7 @@ class Categorie extends CommonObject 'account' => 'bank_account', 'project' => 'projet', 'warehouse'=> 'entrepot', + 'actioncomm' => 'actioncomm', ); /** @@ -214,6 +221,7 @@ class Categorie extends CommonObject * @see Categorie::TYPE_PROJECT * @see Categorie::TYPE_BANK_LINE * @see Categorie::TYPE_WAREHOUSE + * @see Categorie::TYPE_ACTIONCOMM */ public $type; diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index e0886da002c..59d3cef3a4d 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -59,7 +59,13 @@ elseif ($type == Categorie::TYPE_ACCOUNT) { $title=$langs->trans("AccountsCate elseif ($type == Categorie::TYPE_PROJECT) { $title=$langs->trans("ProjectsCategoriesArea"); $typetext='project'; } elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; } elseif ($type == Categorie::TYPE_WAREHOUSE) { $title=$langs->trans("StocksCategoriesArea"); $typetext='warehouse'; } -else { $title=$langs->trans("CategoriesArea"); $typetext='unknown'; } +elseif ($type == Categorie::TYPE_ACTIONCOMM) { + $title = $langs->trans("ActionCommCategoriesArea"); + $typetext = 'actioncomm'; +} else { + $title = $langs->trans("CategoriesArea"); + $typetext = 'unknown'; +} $arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 13e47abbc74..7d2b00a17d1 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -219,165 +219,206 @@ class modAgenda extends DolibarrModules ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=0', - 'type'=>'left', - 'titre'=>'Actions', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda', - 'langs'=>'agenda', - 'position'=>100, - 'perms'=>'$user->rights->agenda->myactions->read', - 'enabled'=>'$conf->agenda->enabled', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=0', + 'type'=>'left', + 'titre'=>'Actions', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda', + 'langs'=>'agenda', + 'position'=>100, + 'perms'=>'$user->rights->agenda->myactions->read', + 'enabled'=>'$conf->agenda->enabled', + 'target'=>'', + 'user'=>2, + ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=1', - 'type'=>'left', - 'titre'=>'NewAction', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/card.php?mainmenu=agenda&leftmenu=agenda&action=create', - 'langs'=>'commercial', - 'position'=>101, - 'perms'=>'($user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create)', - 'enabled'=>'$conf->agenda->enabled', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=1', + 'type'=>'left', + 'titre'=>'NewAction', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/card.php?mainmenu=agenda&leftmenu=agenda&action=create', + 'langs'=>'commercial', + 'position'=>101, + 'perms'=>'($user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create)', + 'enabled'=>'$conf->agenda->enabled', + 'target'=>'', + 'user'=>2 + ); $r++; // Calendar - $this->menu[$r]=array('fk_menu'=>'r=1', - 'type'=>'left', - 'titre'=>'Calendar', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda', - 'langs'=>'agenda', - 'position'=>140, - 'perms'=>'$user->rights->agenda->myactions->read', - 'enabled'=>'$conf->agenda->enabled', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=1', + 'type'=>'left', + 'titre'=>'Calendar', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda', + 'langs'=>'agenda', + 'position'=>140, + 'perms'=>'$user->rights->agenda->myactions->read', + 'enabled'=>'$conf->agenda->enabled', + 'target'=>'', + 'user'=>2 + ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=3', - 'type'=>'left', - 'titre'=>'MenuToDoMyActions', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine', - 'langs'=>'agenda', - 'position'=>141, - 'perms'=>'$user->rights->agenda->myactions->read', - 'enabled'=>'$conf->agenda->enabled', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=3', + 'type'=>'left', + 'titre'=>'MenuToDoMyActions', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine', + 'langs'=>'agenda', + 'position'=>141, + 'perms'=>'$user->rights->agenda->myactions->read', + 'enabled'=>'$conf->agenda->enabled', + 'target'=>'', + 'user'=>2 + ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=3', - 'type'=>'left', - 'titre'=>'MenuDoneMyActions', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filter=mine', - 'langs'=>'agenda', - 'position'=>142, - 'perms'=>'$user->rights->agenda->myactions->read', - 'enabled'=>'$conf->agenda->enabled', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=3', + 'type'=>'left', + 'titre'=>'MenuDoneMyActions', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filter=mine', + 'langs'=>'agenda', + 'position'=>142, + 'perms'=>'$user->rights->agenda->myactions->read', + 'enabled'=>'$conf->agenda->enabled', + 'target'=>'', + 'user'=>2 + ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=3', - 'type'=>'left', - 'titre'=>'MenuToDoActions', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1', - 'langs'=>'agenda', - 'position'=>143, - 'perms'=>'$user->rights->agenda->allactions->read', - 'enabled'=>'$user->rights->agenda->allactions->read', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=3', + 'type'=>'left', + 'titre'=>'MenuToDoActions', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1', + 'langs'=>'agenda', + 'position'=>143, + 'perms'=>'$user->rights->agenda->allactions->read', + 'enabled'=>'$user->rights->agenda->allactions->read', + 'target'=>'', + 'user'=>2 + ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=3', - 'type'=>'left', - 'titre'=>'MenuDoneActions', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1', - 'langs'=>'agenda', - 'position'=>144, - 'perms'=>'$user->rights->agenda->allactions->read', - 'enabled'=>'$user->rights->agenda->allactions->read', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=3', + 'type'=>'left', + 'titre'=>'MenuDoneActions', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1', + 'langs'=>'agenda', + 'position'=>144, + 'perms'=>'$user->rights->agenda->allactions->read', + 'enabled'=>'$user->rights->agenda->allactions->read', + 'target'=>'', + 'user'=>2 + ); // List $r++; - $this->menu[$r]=array('fk_menu'=>'r=1', - 'type'=>'left', - 'titre'=>'List', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda', - 'langs'=>'agenda', - 'position'=>110, - 'perms'=>'$user->rights->agenda->myactions->read', - 'enabled'=>'$conf->agenda->enabled', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=1', + 'type'=>'left', + 'titre'=>'List', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda', + 'langs'=>'agenda', + 'position'=>110, + 'perms'=>'$user->rights->agenda->myactions->read', + 'enabled'=>'$conf->agenda->enabled', + 'target'=>'', + 'user'=>2 + ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=8', - 'type'=>'left', - 'titre'=>'MenuToDoMyActions', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine', - 'langs'=>'agenda', - 'position'=>111, - 'perms'=>'$user->rights->agenda->myactions->read', - 'enabled'=>'$conf->agenda->enabled', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=8', + 'type'=>'left', + 'titre'=>'MenuToDoMyActions', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine', + 'langs'=>'agenda', + 'position'=>111, + 'perms'=>'$user->rights->agenda->myactions->read', + 'enabled'=>'$conf->agenda->enabled', + 'target'=>'', + 'user'=>2 + ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=8', - 'type'=>'left', - 'titre'=>'MenuDoneMyActions', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine', - 'langs'=>'agenda', - 'position'=>112, - 'perms'=>'$user->rights->agenda->myactions->read', - 'enabled'=>'$conf->agenda->enabled', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=8', + 'type'=>'left', + 'titre'=>'MenuDoneMyActions', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine', + 'langs'=>'agenda', + 'position'=>112, + 'perms'=>'$user->rights->agenda->myactions->read', + 'enabled'=>'$conf->agenda->enabled', + 'target'=>'', + 'user'=>2 + ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=8', - 'type'=>'left', - 'titre'=>'MenuToDoActions', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1', - 'langs'=>'agenda', - 'position'=>113, - 'perms'=>'$user->rights->agenda->allactions->read', - 'enabled'=>'$user->rights->agenda->allactions->read', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=8', + 'type'=>'left', + 'titre'=>'MenuToDoActions', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1', + 'langs'=>'agenda', + 'position'=>113, + 'perms'=>'$user->rights->agenda->allactions->read', + 'enabled'=>'$user->rights->agenda->allactions->read', + 'target'=>'', + 'user'=>2 + ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=8', - 'type'=>'left', - 'titre'=>'MenuDoneActions', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1', - 'langs'=>'agenda', - 'position'=>114, - 'perms'=>'$user->rights->agenda->allactions->read', - 'enabled'=>'$user->rights->agenda->allactions->read', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=8', + 'type'=>'left', + 'titre'=>'MenuDoneActions', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1', + 'langs'=>'agenda', + 'position'=>114, + 'perms'=>'$user->rights->agenda->allactions->read', + 'enabled'=>'$user->rights->agenda->allactions->read', + 'target'=>'', + 'user'=>2 + ); $r++; // Reports - $this->menu[$r]=array('fk_menu'=>'r=1', - 'type'=>'left', - 'titre'=>'Reportings', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/rapport/index.php?mainmenu=agenda&leftmenu=agenda', - 'langs'=>'agenda', - 'position'=>160, - 'perms'=>'$user->rights->agenda->allactions->read', - 'enabled'=>'$conf->agenda->enabled', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=1', + 'type'=>'left', + 'titre'=>'Reportings', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/rapport/index.php?mainmenu=agenda&leftmenu=agenda', + 'langs'=>'agenda', + 'position'=>160, + 'perms'=>'$user->rights->agenda->allactions->read', + 'enabled'=>'$conf->agenda->enabled', + 'target'=>'', + 'user'=>2 + ); + $r++; + // Categories + $this->menu[$r]=array( + 'fk_menu' => 'r=1', + 'type' => 'left', + 'titre' => 'Categories', + 'mainmenu' => 'agenda', + 'url'=>'/categories/index.php?mainmenu=agenda&leftmenu=agenda&type=10', + 'langs' => 'agenda', + 'position' => 170, + 'perms' => '$user->rights->agenda->allactions->read', + 'enabled' => '$conf->categorie->enabled&&$conf->categorie->enabled', + 'target' => '', + 'user' => 2 + ); $r++; diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 9c52044291d..7fe182d6fab 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -498,3 +498,17 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_CANCEL','MO canceled','Executed when a MO is canceled','bom',663); ALTER TABLE llx_comment ADD COLUMN fk_user_modif integer DEFAULT NULL; + +CREATE TABLE llx_categorie_actioncomm +( + fk_categorie integer NOT NULL, + fk_actioncomm integer NOT NULL, + import_key varchar(14) +) ENGINE=innodb; + +ALTER TABLE llx_categorie_actioncomm ADD PRIMARY KEY pk_categorie_actioncomm (fk_categorie, fk_actioncomm); +ALTER TABLE llx_categorie_actioncomm ADD INDEX idx_categorie_actioncomm_fk_categorie (fk_categorie); +ALTER TABLE llx_categorie_actioncomm ADD INDEX idx_categorie_actioncomm_fk_actioncomm (fk_actioncomm); + +ALTER TABLE llx_categorie_actioncomm ADD CONSTRAINT fk_categorie_actioncomm_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); +ALTER TABLE llx_categorie_actioncomm ADD CONSTRAINT fk_categorie_actioncomm_fk_actioncomm FOREIGN KEY (fk_actioncomm) REFERENCES llx_actioncomm (id); diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index d5a4ba16bf0..7207bbacc38 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -90,4 +90,5 @@ ShowCategory=Show tag/category ByDefaultInList=By default in list ChooseCategory=Choose category StocksCategoriesArea=Warehouses Categories Area -UseOrOperatorForCategories=Use or operator for categories \ No newline at end of file +ActionCommCategoriesArea=Events Categories Area +UseOrOperatorForCategories=Use or operator for categories From 2ea58b11cad4a11c3e152dd225a5ced7e8c1a661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 13 Nov 2019 20:36:32 +0100 Subject: [PATCH 013/784] wip --- htdocs/categories/class/categorie.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index e42f0fe32ff..dd136383221 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -78,7 +78,7 @@ class Categorie extends CommonObject 'user' => 7, 'bank_line' => 8, 'warehouse' => 9, - 'actioncomm' => 9, + 'actioncomm' => 10, ); /** @@ -133,7 +133,7 @@ class Categorie extends CommonObject 'bank_account'=> 'account', 'project' => 'project', 'warehouse'=> 'warehouse', - 'actioncomm' => 'warehouse', + 'actioncomm' => 'actioncomm', ); /** From 9dcf53c65e3d161e00502b4d5507698b297390cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 13 Nov 2019 20:56:36 +0100 Subject: [PATCH 014/784] add tables --- .../tables/llx_categorie_actioncomm.key.sql | 25 ++++++++++++++++++ .../mysql/tables/llx_categorie_actioncomm.sql | 26 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 htdocs/install/mysql/tables/llx_categorie_actioncomm.key.sql create mode 100644 htdocs/install/mysql/tables/llx_categorie_actioncomm.sql diff --git a/htdocs/install/mysql/tables/llx_categorie_actioncomm.key.sql b/htdocs/install/mysql/tables/llx_categorie_actioncomm.key.sql new file mode 100644 index 00000000000..30357eb87bc --- /dev/null +++ b/htdocs/install/mysql/tables/llx_categorie_actioncomm.key.sql @@ -0,0 +1,25 @@ +-- ============================================================================ +-- Copyright (C) 2016 Charlie Benke +-- Copyright (C) 2016-2019 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ============================================================================ + +ALTER TABLE llx_categorie_actioncomm ADD PRIMARY KEY pk_categorie_actioncomm (fk_categorie, fk_actioncomm); +ALTER TABLE llx_categorie_actioncomm ADD INDEX idx_categorie_actioncomm_fk_categorie (fk_categorie); +ALTER TABLE llx_categorie_actioncomm ADD INDEX idx_categorie_actioncomm_fk_actioncomm (fk_actioncomm); + +ALTER TABLE llx_categorie_actioncomm ADD CONSTRAINT fk_categorie_actioncomm_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); +ALTER TABLE llx_categorie_actioncomm ADD CONSTRAINT fk_categorie_actioncomm_fk_actioncomm FOREIGN KEY (fk_actioncomm) REFERENCES llx_actioncomm (id); diff --git a/htdocs/install/mysql/tables/llx_categorie_actioncomm.sql b/htdocs/install/mysql/tables/llx_categorie_actioncomm.sql new file mode 100644 index 00000000000..52aa2a2c95d --- /dev/null +++ b/htdocs/install/mysql/tables/llx_categorie_actioncomm.sql @@ -0,0 +1,26 @@ +-- ============================================================================ +-- Copyright (C) 2016 Charlie Benke +-- Copyright (C) 2016-2019 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- Table to link actioncomm tag/categories with actioncomms +-- =========================================================================== + +CREATE TABLE llx_categorie_actioncomm +( + fk_categorie integer NOT NULL, + fk_actioncomm integer NOT NULL, + import_key varchar(14) +) ENGINE=innodb; From 9040f6d9c7e248dde2906e91b5e719b9de796cf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 13 Nov 2019 21:18:34 +0100 Subject: [PATCH 015/784] can tag actioncomm --- htdocs/comm/action/card.php | 36 +++++++++++++++ htdocs/comm/action/class/actioncomm.class.php | 44 +++++++++++++++++++ 2 files changed, 80 insertions(+) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 09c8e344794..dc33a189be2 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -44,6 +44,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; // Load translation files required by the page $langs->loadLangs(array("companies", "other", "commercial", "bills", "orders", "agenda")); @@ -374,6 +375,10 @@ if (empty($reshook) && $action == 'add') { if (! $object->error) { + // Category association + $categories = GETPOST('categories', 'array'); + $object->setCategories($categories); + unset($_SESSION['assignedtouser']); $moreparam=''; @@ -595,6 +600,10 @@ if (empty($reshook) && $action == 'update') if ($result > 0) { + // Category association + $categories = GETPOST('categories', 'array'); + $object->setCategories($categories); + unset($_SESSION['assignedtouser']); $db->commit(); @@ -1000,6 +1009,14 @@ if ($action == 'create') print ''; } + if ($conf->categorie->enabled) { + // Categories + print ''.$langs->trans("Categories").''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACTIONCOMM, '', 'parent', 64, 0, 1); + print $form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, '', 0, '100%'); + print ""; + } + print ''; @@ -1411,6 +1428,19 @@ if ($id > 0) print $form->select_dolusers($object->userdoneid> 0?$object->userdoneid:-1, 'doneby', 1); print ''; } + // Tags-Categories + if ($conf->categorie->enabled) { + print ''.$langs->trans("Categories").''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACTIONCOMM, '', 'parent', 64, 0, 1); + $c = new Categorie($db); + $cats = $c->containing($object->id, Categorie::TYPE_ACTIONCOMM); + $arrayselected = array(); + foreach ($cats as $cat) { + $arrayselected[] = $cat->id; + } + print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%'); + print ""; + } print ''; @@ -1716,6 +1746,12 @@ if ($id > 0) } print ''; } + // Categories + if ($conf->categorie->enabled) { + print ''.$langs->trans("Categories").''; + print $form->showCategories($object->id, 'actioncomm', 1); + print ""; + } print ''; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 97d3c4e397e..3e84c23dbc3 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1501,6 +1501,50 @@ class ActionComm extends CommonObject return $result; } + /** + * Sets object to supplied categories. + * + * Deletes object from existing categories not supplied. + * Adds it to non existing supplied categories. + * Existing categories are left untouch. + * + * @param int[]|int $categories Category or categories IDs + * @return void + */ + public function setCategories($categories) + { + // Handle single category + if (! is_array($categories)) { + $categories = array($categories); + } + + // Get current categories + include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $c = new Categorie($this->db); + $existing = $c->containing($this->id, Categorie::TYPE_ACTIONCOMM, 'id'); + + // Diff + if (is_array($existing)) { + $to_del = array_diff($existing, $categories); + $to_add = array_diff($categories, $existing); + } else { + $to_del = array(); // Nothing to delete + $to_add = $categories; + } + + // Process + foreach($to_del as $del) { + if ($c->fetch($del) > 0) { + $c->del_type($this, Categorie::TYPE_ACTIONCOMM); + } + } + foreach ($to_add as $add) { + if ($c->fetch($add) > 0) { + $c->add_type($this, Categorie::TYPE_ACTIONCOMM); + } + } + return; + } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** From 1a9c430e0075285578dfbbb159b136c5d03093b8 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 14 Nov 2019 04:53:13 +0100 Subject: [PATCH 016/784] Add migration --- .../mysql/data/llx_20_c_departements.sql | 130 +++++++++--------- .../install/mysql/migration/11.0.0-12.0.0.sql | 65 +++++++++ 2 files changed, 130 insertions(+), 65 deletions(-) create mode 100644 htdocs/install/mysql/migration/11.0.0-12.0.0.sql diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql index 7e9417b487b..46d9b4d712e 100644 --- a/htdocs/install/mysql/data/llx_20_c_departements.sql +++ b/htdocs/install/mysql/data/llx_20_c_departements.sql @@ -42,97 +42,97 @@ insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,no insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values ( 4,'974','97411',3,'REUNION','Réunion'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values ( 6,'976','97601',3,'MAYOTTE','Mayotte'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'01','01053',5,'AIN','Ain'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (22,'02','02408',5,'AISNE','Aisne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (83,'03','03190',5,'ALLIER','Allier'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'01','01053',5,'AIN','Ain'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (32,'02','02408',5,'AISNE','Aisne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'03','03190',5,'ALLIER','Allier'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'04','04070',4,'ALPES-DE-HAUTE-PROVENCE','Alpes-de-Haute-Provence'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'05','05061',4,'HAUTES-ALPES','Hautes-Alpes'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'06','06088',4,'ALPES-MARITIMES','Alpes-Maritimes'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'07','07186',5,'ARDECHE','Ardèche'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (21,'08','08105',4,'ARDENNES','Ardennes'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'09','09122',5,'ARIEGE','Ariège'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (21,'10','10387',5,'AUBE','Aube'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (91,'11','11069',5,'AUDE','Aude'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'12','12202',5,'AVEYRON','Aveyron'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'07','07186',5,'ARDECHE','Ardèche'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'08','08105',4,'ARDENNES','Ardennes'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'09','09122',5,'ARIEGE','Ariège'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'10','10387',5,'AUBE','Aube'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'11','11069',5,'AUDE','Aude'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'12','12202',5,'AVEYRON','Aveyron'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'13','13055',4,'BOUCHES-DU-RHONE','Bouches-du-Rhône'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (25,'14','14118',2,'CALVADOS','Calvados'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (83,'15','15014',2,'CANTAL','Cantal'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (54,'16','16015',3,'CHARENTE','Charente'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (54,'17','17300',3,'CHARENTE-MARITIME','Charente-Maritime'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (28,'14','14118',2,'CALVADOS','Calvados'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'15','15014',2,'CANTAL','Cantal'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'16','16015',3,'CHARENTE','Charente'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'17','17300',3,'CHARENTE-MARITIME','Charente-Maritime'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'18','18033',2,'CHER','Cher'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (74,'19','19272',3,'CORREZE','Corrèze'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'19','19272',3,'CORREZE','Corrèze'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (94,'2A','2A004',3,'CORSE-DU-SUD','Corse-du-Sud'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (94,'2B','2B033',3,'HAUTE-CORSE','Haute-Corse'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (26,'21','21231',3,'COTE-D OR','Côte-d Or'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'21','21231',3,'COTE-D OR','Côte-d Or'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (53,'22','22278',4,'COTES-D ARMOR','Côtes-d Armor'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (74,'23','23096',3,'CREUSE','Creuse'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (72,'24','24322',3,'DORDOGNE','Dordogne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (43,'25','25056',2,'DOUBS','Doubs'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'26','26362',3,'DROME','Drôme'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (23,'27','27229',5,'EURE','Eure'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'23','23096',3,'CREUSE','Creuse'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'24','24322',3,'DORDOGNE','Dordogne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'25','25056',2,'DOUBS','Doubs'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'26','26362',3,'DROME','Drôme'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (28,'27','27229',5,'EURE','Eure'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'28','28085',1,'EURE-ET-LOIR','Eure-et-Loir'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (53,'29','29232',2,'FINISTERE','Finistère'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (91,'30','30189',2,'GARD','Gard'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'31','31555',3,'HAUTE-GARONNE','Haute-Garonne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'32','32013',2,'GERS','Gers'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (72,'33','33063',3,'GIRONDE','Gironde'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (91,'34','34172',5,'HERAULT','Hérault'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'30','30189',2,'GARD','Gard'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'31','31555',3,'HAUTE-GARONNE','Haute-Garonne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'32','32013',2,'GERS','Gers'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'33','33063',3,'GIRONDE','Gironde'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'34','34172',5,'HERAULT','Hérault'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (53,'35','35238',1,'ILLE-ET-VILAINE','Ille-et-Vilaine'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'36','36044',5,'INDRE','Indre'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'37','37261',1,'INDRE-ET-LOIRE','Indre-et-Loire'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'38','38185',5,'ISERE','Isère'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (43,'39','39300',2,'JURA','Jura'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (72,'40','40192',4,'LANDES','Landes'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'38','38185',5,'ISERE','Isère'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'39','39300',2,'JURA','Jura'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'40','40192',4,'LANDES','Landes'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'41','41018',0,'LOIR-ET-CHER','Loir-et-Cher'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'42','42218',3,'LOIRE','Loire'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (83,'43','43157',3,'HAUTE-LOIRE','Haute-Loire'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'42','42218',3,'LOIRE','Loire'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'43','43157',3,'HAUTE-LOIRE','Haute-Loire'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'44','44109',3,'LOIRE-ATLANTIQUE','Loire-Atlantique'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'45','45234',2,'LOIRET','Loiret'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'46','46042',2,'LOT','Lot'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (72,'47','47001',0,'LOT-ET-GARONNE','Lot-et-Garonne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (91,'48','48095',3,'LOZERE','Lozère'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'46','46042',2,'LOT','Lot'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'47','47001',0,'LOT-ET-GARONNE','Lot-et-Garonne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'48','48095',3,'LOZERE','Lozère'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'49','49007',0,'MAINE-ET-LOIRE','Maine-et-Loire'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (25,'50','50502',3,'MANCHE','Manche'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (21,'51','51108',3,'MARNE','Marne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (21,'52','52121',3,'HAUTE-MARNE','Haute-Marne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (28,'50','50502',3,'MANCHE','Manche'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'51','51108',3,'MARNE','Marne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'52','52121',3,'HAUTE-MARNE','Haute-Marne'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'53','53130',3,'MAYENNE','Mayenne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (41,'54','54395',0,'MEURTHE-ET-MOSELLE','Meurthe-et-Moselle'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (41,'55','55029',3,'MEUSE','Meuse'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'54','54395',0,'MEURTHE-ET-MOSELLE','Meurthe-et-Moselle'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'55','55029',3,'MEUSE','Meuse'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (53,'56','56260',2,'MORBIHAN','Morbihan'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (41,'57','57463',3,'MOSELLE','Moselle'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (26,'58','58194',3,'NIEVRE','Nièvre'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (31,'59','59350',2,'NORD','Nord'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (22,'60','60057',5,'OISE','Oise'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (25,'61','61001',5,'ORNE','Orne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (31,'62','62041',2,'PAS-DE-CALAIS','Pas-de-Calais'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (83,'63','63113',2,'PUY-DE-DOME','Puy-de-Dôme'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (72,'64','64445',4,'PYRENEES-ATLANTIQUES','Pyrénées-Atlantiques'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'65','65440',4,'HAUTES-PYRENEES','Hautes-Pyrénées'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (91,'66','66136',4,'PYRENEES-ORIENTALES','Pyrénées-Orientales'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (42,'67','67482',2,'BAS-RHIN','Bas-Rhin'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (42,'68','68066',2,'HAUT-RHIN','Haut-Rhin'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'69','69123',2,'RHONE','Rhône'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (43,'70','70550',3,'HAUTE-SAONE','Haute-Saône'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (26,'71','71270',0,'SAONE-ET-LOIRE','Saône-et-Loire'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'57','57463',3,'MOSELLE','Moselle'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'58','58194',3,'NIEVRE','Nièvre'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (32,'59','59350',2,'NORD','Nord'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (32,'60','60057',5,'OISE','Oise'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (28,'61','61001',5,'ORNE','Orne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (32,'62','62041',2,'PAS-DE-CALAIS','Pas-de-Calais'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'63','63113',2,'PUY-DE-DOME','Puy-de-Dôme'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'64','64445',4,'PYRENEES-ATLANTIQUES','Pyrénées-Atlantiques'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'65','65440',4,'HAUTES-PYRENEES','Hautes-Pyrénées'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'66','66136',4,'PYRENEES-ORIENTALES','Pyrénées-Orientales'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'67','67482',2,'BAS-RHIN','Bas-Rhin'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'68','68066',2,'HAUT-RHIN','Haut-Rhin'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'69','69123',2,'RHONE','Rhône'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'70','70550',3,'HAUTE-SAONE','Haute-Saône'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'71','71270',0,'SAONE-ET-LOIRE','Saône-et-Loire'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'72','72181',3,'SARTHE','Sarthe'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'73','73065',3,'SAVOIE','Savoie'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'74','74010',3,'HAUTE-SAVOIE','Haute-Savoie'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'73','73065',3,'SAVOIE','Savoie'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'74','74010',3,'HAUTE-SAVOIE','Haute-Savoie'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'75','75056',0,'PARIS','Paris'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (23,'76','76540',3,'SEINE-MARITIME','Seine-Maritime'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (28,'76','76540',3,'SEINE-MARITIME','Seine-Maritime'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'77','77288',0,'SEINE-ET-MARNE','Seine-et-Marne'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'78','78646',4,'YVELINES','Yvelines'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (54,'79','79191',4,'DEUX-SEVRES','Deux-Sèvres'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (22,'80','80021',3,'SOMME','Somme'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'81','81004',2,'TARN','Tarn'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'82','82121',0,'TARN-ET-GARONNE','Tarn-et-Garonne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'79','79191',4,'DEUX-SEVRES','Deux-Sèvres'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (32,'80','80021',3,'SOMME','Somme'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'81','81004',2,'TARN','Tarn'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'82','82121',0,'TARN-ET-GARONNE','Tarn-et-Garonne'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'83','83137',2,'VAR','Var'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'84','84007',0,'VAUCLUSE','Vaucluse'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'85','85191',3,'VENDEE','Vendée'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (54,'86','86194',3,'VIENNE','Vienne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (74,'87','87085',3,'HAUTE-VIENNE','Haute-Vienne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (41,'88','88160',4,'VOSGES','Vosges'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (26,'89','89024',5,'YONNE','Yonne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (43,'90','90010',0,'TERRITOIRE DE BELFORT','Territoire de Belfort'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'86','86194',3,'VIENNE','Vienne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'87','87085',3,'HAUTE-VIENNE','Haute-Vienne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'88','88160',4,'VOSGES','Vosges'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'89','89024',5,'YONNE','Yonne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'90','90010',0,'TERRITOIRE DE BELFORT','Territoire de Belfort'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'91','91228',5,'ESSONNE','Essonne'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'92','92050',4,'HAUTS-DE-SEINE','Hauts-de-Seine'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'93','93008',3,'SEINE-SAINT-DENIS','Seine-Saint-Denis'); diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql new file mode 100644 index 00000000000..52e421f8205 --- /dev/null +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -0,0 +1,65 @@ +-- +-- Be carefull to requests order. +-- This file must be loaded by calling /install/index.php page +-- when current version is 12.0.0 or higher. +-- +-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y +-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y +-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; +-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; +-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); +-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; +-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); +-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; +-- To create a unique index ALTER TABLE llx_table ADD UNIQUE INDEX uk_table_field (field); +-- To drop an index: -- VMYSQL4.1 DROP INDEX nomindex on llx_table +-- To drop an index: -- VPGSQL8.2 DROP INDEX nomindex +-- To make pk to be auto increment (mysql): -- VMYSQL4.3 ALTER TABLE llx_table CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; +-- To make pk to be auto increment (postgres): +-- -- VPGSQL8.2 CREATE SEQUENCE llx_table_rowid_seq OWNED BY llx_table.rowid; +-- -- VPGSQL8.2 ALTER TABLE llx_table ADD PRIMARY KEY (rowid); +-- -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN rowid SET DEFAULT nextval('llx_table_rowid_seq'); +-- -- VPGSQL8.2 SELECT setval('llx_table_rowid_seq', MAX(rowid)) FROM llx_table; +-- To set a field as NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NULL; +-- To set a field as NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL; +-- To set a field as NOT NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NOT NULL; +-- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL; +-- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL; +-- Note: fields with type BLOB/TEXT can't have default value. + + +-- Migration to the new regions (France) +UPDATE llx_c_regions set nom = 'Centre-Val de Loire' WHERE fk_pays = 1 AND code_region = 24; +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (1, 27, '21231', 0, 'Bourgogne-Franche-Comté'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (1, 28, '76540', 0, 'Normandie'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (1, 32, '59350', 4, 'Hauts-de-France'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (1, 44, '67482', 2, 'Grand Est'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (1, 75, '33063', 0, 'Nouvelle-Aquitaine'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (1, 76, '31355', 1, 'Occitanie'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (1, 84, '69123', 1, 'Auvergne-Rhône-Alpes'); + +UPDATE llx_c_departements set fk_region = 27 WHERE fk_region = 26 OR fk_region = 43; +UPDATE llx_c_departements set fk_region = 28 WHERE fk_region = 25 OR fk_region = 23; +UPDATE llx_c_departements set fk_region = 32 WHERE fk_region = 22 OR fk_region = 31; +UPDATE llx_c_departements set fk_region = 44 WHERE fk_region = 21 OR fk_region = 41 OR fk_region = 42; +UPDATE llx_c_departements set fk_region = 75 WHERE fk_region = 54 OR fk_region = 74 OR fk_region = 72; +UPDATE llx_c_departements set fk_region = 76 WHERE fk_region = 73 OR fk_region = 91; +UPDATE llx_c_departements set fk_region = 84 WHERE fk_region = 82 OR fk_region = 83; + +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 21; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 22; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 23; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 25; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 26; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 31; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 41; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 42; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 43; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 54; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 72; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 73; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 74; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 82; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 83; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 91; + From 3bac051521deb2f77df97c60fdb519471f1f5210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 14 Nov 2019 08:07:16 +0100 Subject: [PATCH 017/784] use class CONST --- htdocs/adherents/card.php | 2 +- htdocs/adherents/subscription.php | 2 +- htdocs/comm/action/card.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 417d4cd2c99..8f13769aa3e 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1753,7 +1753,7 @@ else { print '' . $langs->trans("Categories") . ''; print ''; - print $form->showCategories($object->id, 'member', 1); + print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1); print ''; } diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index b591a29a6e9..85fd04c1325 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -532,7 +532,7 @@ if ($rowid > 0) { print '' . $langs->trans("Categories") . ''; print ''; - print $form->showCategories($object->id, 'member', 1); + print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1); print ''; } diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index dc33a189be2..640569a5da1 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1749,7 +1749,7 @@ if ($id > 0) // Categories if ($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, 'actioncomm', 1); + print $form->showCategories($object->id, Categorie::TYPE_ACTIONCOMM, 1); print ""; } From 446c66da6203a5ef2d3f07ca9d3db48790025876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 14 Nov 2019 08:15:39 +0100 Subject: [PATCH 018/784] use class CONST --- htdocs/comm/card.php | 2 +- htdocs/compta/bank/card.php | 2 +- htdocs/contact/card.php | 2 +- htdocs/fourn/card.php | 2 +- htdocs/product/card.php | 2 +- htdocs/product/stock/card.php | 2 +- htdocs/projet/card.php | 2 +- htdocs/projet/comment.php | 2 +- htdocs/projet/contact.php | 2 +- htdocs/projet/element.php | 2 +- htdocs/projet/ganttview.php | 2 +- htdocs/projet/tasks.php | 2 +- htdocs/societe/card.php | 4 ++-- htdocs/user/card.php | 4 ++-- 14 files changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index a0263065dee..062d1658821 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -491,7 +491,7 @@ if ($object->id > 0) $langs->load("categories"); print '' . $langs->trans("CustomersCategoriesShort") . ''; print ''; - print $form->showCategories($object->id, 'customer', 1); + print $form->showCategories($object->id, Categorie::TYPE_CUSTOMER, 1); print ""; } diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 980cf6bd8f2..9f5707402a6 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -689,7 +689,7 @@ else // Categories if ($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, 'bank_account', 1); + print $form->showCategories($object->id, Categorie::TYPE_ACCOUNT, 1); print ""; } diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index f72edeb3a34..563f9906f16 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1355,7 +1355,7 @@ else if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) { print '' . $langs->trans("Categories") . ''; print ''; - print $form->showCategories($object->id, 'contact', 1); + print $form->showCategories($object->id, Categorie::TYPE_CONTACT, 1); print ''; } diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index f52f5b089fd..32f6a9ad11b 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -312,7 +312,7 @@ if ($object->id > 0) $langs->load("categories"); print '' . $langs->trans("SuppliersCategoriesShort") . ''; print ''; - print $form->showCategories($object->id, 'supplier', 1); + print $form->showCategories($object->id, Categorie::TYPE_SUPPLIER, 1); print ""; } diff --git a/htdocs/product/card.php b/htdocs/product/card.php index a5793cc66c8..32eb5c4b383 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1982,7 +1982,7 @@ else // Categories if ($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, 'product', 1); + print $form->showCategories($object->id, Categorie::TYPE_PRODUCT, 1); print ""; } diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 41e91b04d0c..2a69ae58ae8 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -454,7 +454,7 @@ else // Categories if($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, 'warehouse', 1); + print $form->showCategories($object->id, Categorie::TYPE_WAREHOUSE, 1); print ""; } print ""; diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 51af2f2b14d..16f1dd7e439 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1069,7 +1069,7 @@ elseif ($object->id > 0) // Categories if($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, 'project', 1); + print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1); print ""; } diff --git a/htdocs/projet/comment.php b/htdocs/projet/comment.php index a7478163f47..4c9c4ca3ad3 100644 --- a/htdocs/projet/comment.php +++ b/htdocs/projet/comment.php @@ -160,7 +160,7 @@ print ''; // Categories if ($conf->categorie->enabled) { print '' . $langs->trans("Categories") . ''; - print $form->showCategories($object->id, 'project', 1); + print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1); print ""; } diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 82eb598190b..f8ccdbf7210 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -279,7 +279,7 @@ if ($id > 0 || ! empty($ref)) // Categories if ($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, 'project', 1); + print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1); print ""; } diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 56d01faa342..1e3661516fb 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -255,7 +255,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_B // Categories if($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, 'project', 1); + print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1); print ""; } diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 725d99fb673..42f79ae0f30 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -212,7 +212,7 @@ if (($id > 0 && is_numeric($id)) || ! empty($ref)) // Categories if($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, 'project', 1); + print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1); print ""; } diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 9d9b8e69516..0775d5996b2 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -487,7 +487,7 @@ if ($id > 0 || !empty($ref)) // Categories if ($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, 'project', 1); + print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1); print ""; } diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 6b375679052..e8182f9c846 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2550,7 +2550,7 @@ else if ($object->prospect || $object->client || (! $object->fournisseur && ! empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER))) { print '' . $langs->trans("CustomersCategoriesShort") . ''; print ''; - print $form->showCategories($object->id, 'customer', 1); + print $form->showCategories($object->id, Categorie::TYPE_CUSTOMER, 1); print ""; } @@ -2558,7 +2558,7 @@ else if ($object->fournisseur) { print '' . $langs->trans("SuppliersCategoriesShort") . ''; print ''; - print $form->showCategories($object->id, 'supplier', 1); + print $form->showCategories($object->id, Categorie::TYPE_SUPPLIER, 1); print ""; } } diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 7886c0ef728..d75d6abbc57 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1764,7 +1764,7 @@ else { print ''.$langs->trans("Categories").''; print ''; - print $form->showCategories($object->id, 'user', 1); + print $form->showCategories($object->id, Categorie::TYPE_USER, 1); print ''; } @@ -2626,7 +2626,7 @@ else { print $form->multiselectarray('usercats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%'); } else { - print $form->showCategories($object->id, 'user', 1); + print $form->showCategories($object->id, Categorie::TYPE_USER, 1); } print ""; } From 6e97697faae9cc5b07d3eee0bc938f87ba114b8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 14 Nov 2019 22:38:37 +0100 Subject: [PATCH 019/784] wip --- htdocs/categories/class/api_categories.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 0f2a425fe87..0e71f52a955 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -48,6 +48,11 @@ class Categories extends DolibarrApi 3 => 'member', 4 => 'contact', 5 => 'account', + //6 => 'project', + //7 => 'user', + //8 => 'bank_line', + //9 => 'warehouse', + //10 => 'actioncomm', ); /** From b3e09e050c3e07c0beb5a8dff8dd3f4652ee5a46 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 18 Nov 2019 11:36:12 +0100 Subject: [PATCH 020/784] fix missing param --- htdocs/comm/propal/list.php | 83 +++++++++++++++++++------------------ 1 file changed, 43 insertions(+), 40 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index b1897916023..c29fac8405f 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -413,22 +413,25 @@ if ($resql) $param = '&viewstatut='.urlencode($viewstatut); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); - if ($sall) $param .= '&sall='.urlencode($sall); - if ($search_day) $param .= '&search_day='.urlencode($search_day); - if ($search_month) $param .= '&search_month='.urlencode($search_month); - if ($search_year) $param .= '&search_year='.urlencode($search_year); - if ($search_ref) $param .= '&search_ref='.urlencode($search_ref); - if ($search_refcustomer) $param .= '&search_refcustomer='.urlencode($search_refcustomer); - if ($search_refproject) $param .= '&search_refproject='.urlencode($search_refproject); - if ($search_societe) $param .= '&search_societe='.urlencode($search_societe); - if ($search_user > 0) $param .= '&search_user='.urlencode($search_user); - if ($search_sale > 0) $param .= '&search_sale='.urlencode($search_sale); - if ($search_montant_ht) $param .= '&search_montant_ht='.urlencode($search_montant_ht); - if ($search_login) $param .= '&search_login='.urlencode($search_login); - if ($search_town) $param .= '&search_town='.urlencode($search_town); - if ($search_zip) $param .= '&search_zip='.urlencode($search_zip); - if ($socid > 0) $param .= '&socid='.urlencode($socid); - if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); + if ($sall) $param .= '&sall='.urlencode($sall); + if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start); + if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end); + if ($search_dateend_start) $param .= '&search_dateend_start='.urlencode($search_dateend_start); + if ($search_dateend_end) $param .= '&search_dateend_end='.urlencode($search_dateend_end); + if ($search_datedelivery_start) $param .= '&search_datedelivery_start='.urlencode($search_datedelivery_start); + if ($search_datedelivery_end) $param .= '&search_datedelivery_end='.urlencode($search_datedelivery_end); + if ($search_ref) $param .= '&search_ref='.urlencode($search_ref); + if ($search_refcustomer) $param .= '&search_refcustomer='.urlencode($search_refcustomer); + if ($search_refproject) $param .= '&search_refproject='.urlencode($search_refproject); + if ($search_societe) $param .= '&search_societe='.urlencode($search_societe); + if ($search_user > 0) $param .= '&search_user='.urlencode($search_user); + if ($search_sale > 0) $param .= '&search_sale='.urlencode($search_sale); + if ($search_montant_ht) $param .= '&search_montant_ht='.urlencode($search_montant_ht); + if ($search_login) $param .= '&search_login='.urlencode($search_login); + if ($search_town) $param .= '&search_town='.urlencode($search_town); + if ($search_zip) $param .= '&search_zip='.urlencode($search_zip); + if ($socid > 0) $param .= '&socid='.urlencode($socid); + if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); if ($search_categ_cus > 0) $param .= '&search_categ_cus='.urlencode($search_categ_cus); if ($search_product_category != '') $param .= '&search_product_category='.$search_product_category; @@ -727,37 +730,37 @@ if ($resql) // Fields title print ''; - if (!empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['p.ref_client']['checked'])) print_liste_field_titre($arrayfields['p.ref_client']['label'], $_SERVER["PHP_SELF"], 'p.ref_client', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['pr.ref']['checked'])) print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], 'pr.ref', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['pr.title']['checked'])) print_liste_field_titre($arrayfields['pr.title']['label'], $_SERVER["PHP_SELF"], 'pr.title', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], 's.nom', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder); - if (!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder); - if (!empty($arrayfields['p.date']['checked'])) print_liste_field_titre($arrayfields['p.date']['label'], $_SERVER["PHP_SELF"], 'p.datep', '', $param, 'align="center"', $sortfield, $sortorder); - if (!empty($arrayfields['p.fin_validite']['checked'])) print_liste_field_titre($arrayfields['p.fin_validite']['label'], $_SERVER["PHP_SELF"], 'dfv', '', $param, 'align="center"', $sortfield, $sortorder); - if (!empty($arrayfields['p.date_livraison']['checked'])) print_liste_field_titre($arrayfields['p.date_livraison']['label'], $_SERVER["PHP_SELF"], 'ddelivery', '', $param, 'align="center"', $sortfield, $sortorder); - if (!empty($arrayfields['ava.rowid']['checked'])) print_liste_field_titre($arrayfields['ava.rowid']['label'], $_SERVER["PHP_SELF"], 'availability', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['p.total_ht']['checked'])) print_liste_field_titre($arrayfields['p.total_ht']['label'], $_SERVER["PHP_SELF"], 'p.total_ht', '', $param, 'class="right"', $sortfield, $sortorder); - if (!empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($arrayfields['p.total_vat']['label'], $_SERVER["PHP_SELF"], 'p.tva', '', $param, 'class="right"', $sortfield, $sortorder); - if (!empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.total_ttc']['label'], $_SERVER["PHP_SELF"], 'p.total', '', $param, 'class="right"', $sortfield, $sortorder); + if (!empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['p.ref_client']['checked'])) print_liste_field_titre($arrayfields['p.ref_client']['label'], $_SERVER["PHP_SELF"], 'p.ref_client', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['pr.ref']['checked'])) print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], 'pr.ref', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['pr.title']['checked'])) print_liste_field_titre($arrayfields['pr.title']['label'], $_SERVER["PHP_SELF"], 'pr.title', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], 's.nom', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder); + if (!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder); + if (!empty($arrayfields['p.date']['checked'])) print_liste_field_titre($arrayfields['p.date']['label'], $_SERVER["PHP_SELF"], 'p.datep', '', $param, 'align="center"', $sortfield, $sortorder); + if (!empty($arrayfields['p.fin_validite']['checked'])) print_liste_field_titre($arrayfields['p.fin_validite']['label'], $_SERVER["PHP_SELF"], 'dfv', '', $param, 'align="center"', $sortfield, $sortorder); + if (!empty($arrayfields['p.date_livraison']['checked'])) print_liste_field_titre($arrayfields['p.date_livraison']['label'], $_SERVER["PHP_SELF"], 'ddelivery', '', $param, 'align="center"', $sortfield, $sortorder); + if (!empty($arrayfields['ava.rowid']['checked'])) print_liste_field_titre($arrayfields['ava.rowid']['label'], $_SERVER["PHP_SELF"], 'availability', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['p.total_ht']['checked'])) print_liste_field_titre($arrayfields['p.total_ht']['label'], $_SERVER["PHP_SELF"], 'p.total_ht', '', $param, 'class="right"', $sortfield, $sortorder); + if (!empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($arrayfields['p.total_vat']['label'], $_SERVER["PHP_SELF"], 'p.tva', '', $param, 'class="right"', $sortfield, $sortorder); + if (!empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.total_ttc']['label'], $_SERVER["PHP_SELF"], 'p.total', '', $param, 'class="right"', $sortfield, $sortorder); if (!empty($arrayfields['p.total_ht_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_ht_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder); - if (!empty($arrayfields['p.total_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder); - if (!empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); - if (!empty($arrayfields['sale_representative']['checked'])) print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder); + if (!empty($arrayfields['p.total_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder); + if (!empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); + if (!empty($arrayfields['sale_representative']['checked'])) print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // 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 print $hookmanager->resPrint; - if (!empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (!empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (!empty($arrayfields['p.date_cloture']['checked'])) print_liste_field_titre($arrayfields['p.date_cloture']['label'], $_SERVER["PHP_SELF"], "p.date_cloture", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (!empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, 'class="right"', $sortfield, $sortorder); + if (!empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); + if (!empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); + if (!empty($arrayfields['p.date_cloture']['checked'])) print_liste_field_titre($arrayfields['p.date_cloture']['label'], $_SERVER["PHP_SELF"], "p.date_cloture", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); + if (!empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); print ''."\n"; From dbbcda9e999ebdb4f8d48abdf97b62cc03c4fae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurent=20L=C3=A9onard?= Date: Wed, 20 Nov 2019 06:38:28 +0100 Subject: [PATCH 021/784] Add WYSIWYG editor to description field of projects --- htdocs/projet/card.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 493978f738e..45c76363933 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -27,6 +27,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/project/modules_project.php'; @@ -657,7 +658,8 @@ if ($action == 'create' && $user->rights->projet->creer) // Description print ''.$langs->trans("Description").''; print ''; - print ''; + $doleditor = new DolEditor('description', GETPOST("description", 'none'), '', 90, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_3, '90%'); + $doleditor->Create(); print ''; if ($conf->categorie->enabled) { @@ -913,7 +915,8 @@ elseif ($object->id > 0) // Description print ''.$langs->trans("Description").''; print ''; - print ''; + $doleditor = new DolEditor('description', $object->description, '', 90, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_3, '90%'); + $doleditor->Create(); print ''; // Tags-Categories From 8522faea7f86f000bf9d31f0ea043a24c1e59165 Mon Sep 17 00:00:00 2001 From: altairis Date: Wed, 20 Nov 2019 10:15:46 +0100 Subject: [PATCH 022/784] add conf --- htdocs/conf/conf.php | 51 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 htdocs/conf/conf.php diff --git a/htdocs/conf/conf.php b/htdocs/conf/conf.php new file mode 100644 index 00000000000..bfadb6d5c55 --- /dev/null +++ b/htdocs/conf/conf.php @@ -0,0 +1,51 @@ + Date: Wed, 20 Nov 2019 10:36:26 +0100 Subject: [PATCH 023/784] NEW add WYSiWYG on member type's description --- htdocs/adherents/type.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index ecfd12142f4..23a8608c1e8 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -1,3 +1,4 @@ + * Copyright (C) 2003 Jean-Louis Bergamo @@ -65,7 +66,7 @@ $subscription = GETPOST("subscription", "int"); $duration_value = GETPOST('duration_value', 'int'); $duration_unit = GETPOST('duration_unit', 'alpha'); $vote = GETPOST("vote", "int"); -$comment = GETPOST("comment", 'alphanohtml'); +$comment = GETPOST("comment", 'none'); $mail_valid = GETPOST("mail_valid", 'none'); // Security check @@ -363,7 +364,9 @@ if ($action == 'create') print ''; print ''.$langs->trans("Description").''; - print ''; + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor = new DolEditor('comment', $object->note, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%'); + $doleditor->Create(); print ''.$langs->trans("WelcomeEMail").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -806,10 +809,12 @@ if ($rowid > 0) print ''; print ''.$langs->trans("Description").''; - print ''; + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor = new DolEditor('comment', $object->note, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%'); + $doleditor->Create(); + print ""; print ''.$langs->trans("WelcomeEMail").''; - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%'); $doleditor->Create(); print ""; From 54e528d659cb13670bbd801fa9ff30151f7ca7e6 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 20 Nov 2019 09:38:32 +0000 Subject: [PATCH 024/784] Fixing style errors. --- htdocs/adherents/type.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 23a8608c1e8..ae54d9fec08 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -364,7 +364,7 @@ if ($action == 'create') print ''; print ''.$langs->trans("Description").''; - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor('comment', $object->note, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%'); $doleditor->Create(); From 789e751e4a2963d7c169708af68a08b723449604 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 20 Nov 2019 10:55:58 +0100 Subject: [PATCH 025/784] Update type.php --- htdocs/adherents/type.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index ae54d9fec08..fd43988ccf5 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -1,4 +1,3 @@ - * Copyright (C) 2003 Jean-Louis Bergamo @@ -809,7 +808,7 @@ if ($rowid > 0) print ''; print ''.$langs->trans("Description").''; - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor('comment', $object->note, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%'); $doleditor->Create(); print ""; From f1a9daf77e1740bbef9eb12c91ba7242c8e718af Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 20 Nov 2019 12:42:56 +0100 Subject: [PATCH 026/784] NEW add total of value in product stat --- htdocs/product/stats/card.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index 5ca7992be31..0b0399e424f 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2005 Eric Seigne * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2019 Thibault FOUCARt * * 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 @@ -351,6 +352,7 @@ if ($result || empty($id)) $url = DOL_URL_ROOT.'/viewimage.php?modulepart='.$graphfiles[$key]['modulepart'].'&entity='.$object->entity.'&file='.urlencode($graphfiles[$key]['file']); $px->draw($dir."/".$graphfiles[$key]['file'], $url); + $graphfiles[$key]['total'] = $px->total(); $graphfiles[$key]['output'] = $px->show(); } else @@ -405,7 +407,7 @@ if ($result || empty($id)) // Label print ''; print $graphfiles[$key]['label']; - print ''; + print ' ('.$graphfiles[$key]['total'].')'; print ''.$linktoregenerate.''; print ''; // Image From 2c810988a6204c09ec973df96ac36eb1a3395387 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 20 Nov 2019 12:43:49 +0100 Subject: [PATCH 027/784] Update dolgraph.class.php --- htdocs/core/class/dolgraph.class.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 37f1d6036c6..4cd58a63378 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -1124,7 +1124,20 @@ class DolGraph $this->stringtoshow .= ''."\n"; } - + /** + * Output HTML string to total value + * + * @return string HTML string to total value + */ + public function total() + { + $value = 0; + foreach($this->data as $valarray) // Loop on each x + { + $value += $valarray[1]; + } + return $value; + } /** * Output HTML string to show graph From 3209d550c2d083b72bee1b7af202329485578186 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 20 Nov 2019 11:45:12 +0000 Subject: [PATCH 028/784] Fixing style errors. --- htdocs/core/class/dolgraph.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 4cd58a63378..c6d610ca5f0 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -1131,12 +1131,12 @@ class DolGraph */ public function total() { - $value = 0; - foreach($this->data as $valarray) // Loop on each x + $value = 0; + foreach($this->data as $valarray) // Loop on each x { - $value += $valarray[1]; - } - return $value; + $value += $valarray[1]; + } + return $value; } /** From 0a125f73b5ae8ef858ec3a901b2f68045ddbb16c Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Wed, 20 Nov 2019 14:21:35 +0100 Subject: [PATCH 029/784] NEW add units in product list --- htdocs/product/list.php | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 33ad0b4806c..2e383f18a0e 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -173,9 +173,10 @@ $arrayfields = array( 'p.barcode'=>array('label'=>$langs->trans("Gencod"), 'checked'=>1, 'enabled'=>(!empty($conf->barcode->enabled))), 'p.duration'=>array('label'=>$langs->trans("Duration"), 'checked'=>($contextpage != 'productlist'), 'enabled'=>(!empty($conf->service->enabled) && (string) $type == '1')), 'p.weight'=>array('label'=>$langs->trans("Weight"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled))), - 'p.length'=>array('label'=>$langs->trans("Length"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && !empty($conf->global->PRODUCT_DISABLE_SIZE))), - 'p.surface'=>array('label'=>$langs->trans("Surface"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && !empty($conf->global->PRODUCT_DISABLE_SURFACE))), - 'p.volume'=>array('label'=>$langs->trans("Volume"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && !empty($conf->global->PRODUCT_DISABLE_VOLUME))), + 'p.length'=>array('label'=>$langs->trans("Length"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE))), + 'p.surface'=>array('label'=>$langs->trans("Surface"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SURFACE))), + 'p.volume'=>array('label'=>$langs->trans("Volume"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_VOLUME))), + 'cu.label'=>array('label'=>$langs->trans("DefaultUnitToShow"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && !empty($conf->global->PRODUCT_USE_UNITS))), 'p.sellprice'=>array('label'=>$langs->trans("SellingPrice"), 'checked'=>1, 'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES)), 'p.minbuyprice'=>array('label'=>$langs->trans("BuyingPriceMinShort"), 'checked'=>1, 'enabled'=>(!empty($user->rights->fournisseur->lire))), 'p.numbuyprice'=>array('label'=>$langs->trans("BuyingPriceNumShort"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire))), @@ -289,6 +290,7 @@ $sql .= ' p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte $sql .= ' p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy,'; $sql .= ' p.datec as date_creation, p.tms as date_update, p.pmp, p.stock,'; $sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.width, p.width_units, p.height, p.height_units,'; +if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ' p.fk_unit, cu.label as cu_label,'; $sql .= ' MIN(pfp.unitprice) as minsellprice'; if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) { $sql .= ', pac.rowid prod_comb_id'; @@ -311,6 +313,7 @@ if (!empty($conf->global->MAIN_MULTILANGS)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination pac ON pac.fk_product_child = p.rowid"; } +if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_units cu ON cu.rowid = p.fk_unit"; $sql .= ' WHERE p.entity IN ('.getEntity('product').')'; @@ -376,6 +379,7 @@ $sql .= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.tva_tx, p.pric $sql .= " p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,"; $sql .= ' p.datec, p.tms, p.entity, p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.pmp, p.stock,'; $sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.width, p.width_units, p.height, p.height_units'; +if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ', p.fk_unit'; if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) { $sql .= ', pac.rowid'; @@ -639,6 +643,13 @@ if ($resql) print ''; } + // Unit + if (!empty($arrayfields['cu.label']['checked'])) + { + print ''; + print ''; + } + // Sell price if (!empty($arrayfields['p.sellprice']['checked'])) { @@ -759,6 +770,7 @@ if ($resql) if (!empty($arrayfields['p.length']['checked'])) print_liste_field_titre($arrayfields['p.length']['label'], $_SERVER["PHP_SELF"], "p.length", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.surface']['checked'])) print_liste_field_titre($arrayfields['p.surface']['label'], $_SERVER["PHP_SELF"], "p.surface", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.volume']['checked'])) print_liste_field_titre($arrayfields['p.volume']['label'], $_SERVER["PHP_SELF"], "p.volume", "", $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['cu.label']['checked'])) print_liste_field_titre($arrayfields['cu.label']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.sellprice']['checked'])) { print_liste_field_titre($arrayfields['p.sellprice']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); } @@ -875,6 +887,9 @@ if ($resql) $product_static->volume_units = $obj->volume_units; $product_static->surface = $obj->surface; $product_static->surface_units = $obj->surface_units; + if (!empty($conf->global->PRODUCT_USE_UNITS)) { + $product_static->fk_unit = $obj->fk_unit; + } if ((!empty($conf->stock->enabled) && $user->rights->stock->lire && $search_type != 1) || !empty($conf->global->STOCK_DISABLE_OPTIM_LOAD)) // To optimize call of load_stock { @@ -986,6 +1001,16 @@ if ($resql) print ''; if (!$i) $totalarray['nbfield']++; } + // Unit + if (!empty($arrayfields['cu.label']['checked'])) + { + print ''; + if ($obj->cu_label !== '') { + print $langs->trans($obj->cu_label); + } + print ''; + if (!$i) $totalarray['nbfield']++; + } // Sell price if (!empty($arrayfields['p.sellprice']['checked'])) From 38b083b766cb560017afa1a7b81f68ed632d60cf Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Wed, 20 Nov 2019 14:43:29 +0100 Subject: [PATCH 030/784] FIX unit translate in product list if null --- htdocs/product/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 2e383f18a0e..745876a7400 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -1005,7 +1005,7 @@ if ($resql) if (!empty($arrayfields['cu.label']['checked'])) { print ''; - if ($obj->cu_label !== '') { + if (!empty($obj->cu_label)) { print $langs->trans($obj->cu_label); } print ''; From b7517377a700810b27e251d27c6b948bdb3365f6 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Wed, 20 Nov 2019 15:00:34 +0100 Subject: [PATCH 031/784] FIX goup by unit label in product list --- htdocs/product/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 745876a7400..2396b345fb8 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -379,7 +379,7 @@ $sql .= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.tva_tx, p.pric $sql .= " p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,"; $sql .= ' p.datec, p.tms, p.entity, p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.pmp, p.stock,'; $sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.width, p.width_units, p.height, p.height_units'; -if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ', p.fk_unit'; +if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ', p.fk_unit, cu.label'; if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) { $sql .= ', pac.rowid'; From f15087a97db8f900bd724c97fdcce57788c60b1b Mon Sep 17 00:00:00 2001 From: altairis Date: Fri, 22 Nov 2019 15:14:32 +0100 Subject: [PATCH 032/784] remove conf --- htdocs/conf/conf.php | 51 -------------------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 htdocs/conf/conf.php diff --git a/htdocs/conf/conf.php b/htdocs/conf/conf.php deleted file mode 100644 index bfadb6d5c55..00000000000 --- a/htdocs/conf/conf.php +++ /dev/null @@ -1,51 +0,0 @@ - Date: Fri, 22 Nov 2019 15:14:55 +0100 Subject: [PATCH 033/784] allow time consumed to be linked to another task --- htdocs/projet/tasks/time.php | 102 +++++++++++++++++++++++++---------- 1 file changed, 73 insertions(+), 29 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 0f9e9fb6357..c534789c812 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -5,6 +5,7 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2018 Frédéric France + * Copyright (C) 2019 Christophe Battarel * * 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 @@ -225,34 +226,70 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$_POST["cancel if (!$error) { - $object->fetch($id, $ref); - // TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids)) - - $object->timespent_id = $_POST["lineid"]; - $object->timespent_note = $_POST["timespent_note_line"]; - $object->timespent_old_duration = $_POST["old_duration"]; - $object->timespent_duration = $_POST["new_durationhour"] * 60 * 60; // We store duration in seconds - $object->timespent_duration += $_POST["new_durationmin"] * 60; // We store duration in seconds - if (GETPOST("timelinehour") != '' && GETPOST("timelinehour") >= 0) // If hour was entered - { - $object->timespent_date = dol_mktime(GETPOST("timelinehour"), GETPOST("timelinemin"), 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); - $object->timespent_withhour = 1; - } - else + if ($_POST['taskid'] != $id) { - $object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); + $id = $_POST['taskid']; + + $object->fetchTimeSpent(GETPOST('lineid', 'int')); + // TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids)) + $result = $object->delTimeSpent($user); + + $object->fetch($id); + $object->timespent_note = $_POST["timespent_note_line"]; + $object->timespent_duration = $_POST["new_durationhour"] * 60 * 60; // We store duration in seconds + $object->timespent_duration += ($_POST["new_durationmin"] ? $_POST["new_durationmin"] : 0) * 60; // We store duration in seconds + if (GETPOST("timelinehour") != '' && GETPOST("timelinehour") >= 0) // If hour was entered + { + $object->timespent_date = dol_mktime(GETPOST("timelinehour"), GETPOST("timelinemin"), 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); + $object->timespent_withhour = 1; + } + else + { + $object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); + } + $object->timespent_fk_user = $_POST["userid_line"]; + $result = $object->addTimeSpent($user); + if ($result >= 0) + { + setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans($object->error), null, 'errors'); + $error++; + } } - $object->timespent_fk_user = $_POST["userid_line"]; + else + { + $object->fetch($id, $ref); + // TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids)) - $result = $object->updateTimeSpent($user); - if ($result >= 0) - { - setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans($object->error), null, 'errors'); - $error++; + $object->timespent_id = $_POST["lineid"]; + $object->timespent_note = $_POST["timespent_note_line"]; + $object->timespent_old_duration = $_POST["old_duration"]; + $object->timespent_duration = $_POST["new_durationhour"] * 60 * 60; // We store duration in seconds + $object->timespent_duration += $_POST["new_durationmin"] * 60; // We store duration in seconds + if (GETPOST("timelinehour") != '' && GETPOST("timelinehour") >= 0) // If hour was entered + { + $object->timespent_date = dol_mktime(GETPOST("timelinehour"), GETPOST("timelinemin"), 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); + $object->timespent_withhour = 1; + } + else + { + $object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); + } + $object->timespent_fk_user = $_POST["userid_line"]; + + $result = $object->updateTimeSpent($user); + if ($result >= 0) + { + setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans($object->error), null, 'errors'); + $error++; + } } } else @@ -1195,10 +1232,17 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task { print ''; - $tasktmp->id = $task_time->fk_task; - $tasktmp->ref = $task_time->ref; - $tasktmp->label = $task_time->label; - print $tasktmp->getNomUrl(1, 'withproject', 'time'); + if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) + { + $formproject->selectTasks(-1, GETPOST('taskid', 'int')?GETPOST('taskid', 'int'):$task_time->fk_task, 'taskid', 0, 0, 1, 1, 0, 0, 'maxwidth300', $projectstatic->id, ''); + } + else + { + $tasktmp->id = $task_time->fk_task; + $tasktmp->ref = $task_time->ref; + $tasktmp->label = $task_time->label; + print $tasktmp->getNomUrl(1, 'withproject', 'time'); + } print ''; if (!$i) $totalarray['nbfield']++; } From 7f24d1fe407941af8545d726e6a98205f8874e46 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 22 Nov 2019 14:18:09 +0000 Subject: [PATCH 034/784] Fixing style errors. --- htdocs/projet/tasks/time.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index c534789c812..9fb95609cb6 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -229,11 +229,11 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$_POST["cancel if ($_POST['taskid'] != $id) { $id = $_POST['taskid']; - + $object->fetchTimeSpent(GETPOST('lineid', 'int')); // TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids)) $result = $object->delTimeSpent($user); - + $object->fetch($id); $object->timespent_note = $_POST["timespent_note_line"]; $object->timespent_duration = $_POST["new_durationhour"] * 60 * 60; // We store duration in seconds @@ -259,7 +259,7 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$_POST["cancel $error++; } } - else + else { $object->fetch($id, $ref); // TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids)) From 4d9894e58e40e6b326f4d49909b9cbc7e9d40919 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 22 Nov 2019 15:49:06 +0100 Subject: [PATCH 035/784] Update card.php --- htdocs/product/stats/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index 0b0399e424f..24387ef8b73 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2005 Eric Seigne * Copyright (C) 2013 Juanjo Menent - * Copyright (C) 2019 Thibault FOUCARt + * Copyright (C) 2019 Thibault FOUCART * * 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 From 3aef39c64d720520774a744b99c76f0eed7ad3c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric?= <35066297+c3do@users.noreply.github.com> Date: Sat, 23 Nov 2019 13:45:58 +0100 Subject: [PATCH 036/784] New can customize the reference of a combination --- .../class/ProductCombination.class.php | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index 1c09aae62df..6dfa1bf94c5 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -502,9 +502,10 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; * @param bool $price_var_percent Is the price variation a relative variation? * @param bool|float $forced_pricevar If the price variation is forced * @param bool|float $forced_weightvar If the weight variation is forced + * @param bool|string $forced_refvar If the reference is forced * @return int <0 KO, >0 OK */ - public function createProductCombination(User $user, Product $product, array $combinations, array $variations, $price_var_percent = false, $forced_pricevar = false, $forced_weightvar = false) + public function createProductCombination(User $user, Product $product, array $combinations, array $variations, $price_var_percent = false, $forced_pricevar = false, $forced_weightvar = false, $forced_refvar = false) { global $db, $conf; @@ -528,7 +529,11 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; if ($forced_pricevar === false) { $price_impact = 0; } - + + if ($forced_refvar !== false) { + $forced_refvar = trim($forced_refvar); + } + $newcomb = new ProductCombination($db); $existingCombination = $newcomb->fetchByProductCombination2ValuePairs($product->id, $combinations); @@ -572,11 +577,14 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; if ($forced_pricevar === false) { $price_impact += (float) price2num($variations[$currcombattr][$currcombval]['price']); } - - if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) { - $newproduct->ref .= $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR . $prodattrval->ref; + if (empty($forced_refvar)) { + if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) { + $newproduct->ref .= $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR . $prodattrval->ref; + } else { + $newproduct->ref .= '_'.$prodattrval->ref; + } } else { - $newproduct->ref .= '_'.$prodattrval->ref; + $newproduct->ref = $forced_refvar; } //The first one should not contain a linebreak From 76fd79455901f684b9d4511612075d5a7c561be0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric?= <35066297+c3do@users.noreply.github.com> Date: Sat, 23 Nov 2019 14:04:00 +0100 Subject: [PATCH 037/784] API New can customize reference when addvariant --- htdocs/product/class/api_products.class.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 37c950e9956..b0ed902ffb3 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -1328,11 +1328,12 @@ class Products extends DolibarrApi * * "features" is a list of attributes pairs id_attribute=>id_value. Example: array(id_color=>id_Blue, id_size=>id_small, id_option=>id_val_a, ...) * - * @param int $id ID of Product - * @param float $weight_impact Weight impact of variant - * @param float $price_impact Price impact of variant - * @param bool $price_impact_is_percent Price impact in percent (true or false) - * @param array $features List of attributes pairs id_attribute->id_value. Example: array(id_color=>id_Blue, id_size=>id_small, id_option=>id_val_a, ...) + * @param int $id ID of Product + * @param float $weight_impact Weight impact of variant + * @param float $price_impact Price impact of variant + * @param bool $price_impact_is_percent Price impact in percent (true or false) + * @param array $features List of attributes pairs id_attribute->id_value. Example: array(id_color=>id_Blue, id_size=>id_small, id_option=>id_val_a, ...) + * @param bool|string $reference Customized reference of variant * @return int * * @throws RestException @@ -1341,7 +1342,7 @@ class Products extends DolibarrApi * * @url POST {id}/variants */ - public function addVariant($id, $weight_impact, $price_impact, $price_impact_is_percent, $features) + public function addVariant($id, $weight_impact, $price_impact, $price_impact_is_percent, $features, $reference = false) { if(! DolibarrApiAccess::$user->rights->produit->creer) { throw new RestException(401); @@ -1373,7 +1374,7 @@ class Products extends DolibarrApi $prodcomb = new ProductCombination($this->db); if (! $prodcomb->fetchByProductCombination2ValuePairs($id, $features)) { - $result = $prodcomb->createProductCombination(DolibarrApiAccess::$user, $this->product, $features, array(), $price_impact_is_percent, $price_impact, $weight_impact); + $result = $prodcomb->createProductCombination(DolibarrApiAccess::$user, $this->product, $features, array(), $price_impact_is_percent, $price_impact, $weight_impact, $reference); if ($result > 0) { return $result; From ce15af098061c85f247cc76714afac8d20b7c293 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Sat, 23 Nov 2019 15:52:34 +0100 Subject: [PATCH 038/784] manage packaging on supplier prices --- .../fourn/class/fournisseur.product.class.php | 19 +++++++++++++- htdocs/langs/en_US/products.lang | 6 ++++- htdocs/product/admin/product.php | 19 ++++++++++++++ htdocs/product/class/product.class.php | 10 ++++++-- htdocs/product/fournisseurs.php | 25 +++++++++++++++++++ 5 files changed, 75 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 069380249db..6545e13fafe 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -273,6 +273,7 @@ class ProductFournisseur extends Product $charges = price2num($charges, 'MU'); $qty = price2num($qty, 'MS'); $unitBuyPrice = price2num($buyprice / $qty, 'MU'); + $packaging = ($this->packaging < $qty) ? $qty : $this->packaging; $error = 0; $now = dol_now(); @@ -359,6 +360,7 @@ class ProductFournisseur extends Product $sql .= " supplier_reputation = ".(empty($supplier_reputation) ? 'NULL' : "'".$this->db->escape($supplier_reputation)."'").","; $sql .= " barcode = ".(empty($barcode) ? 'NULL' : "'".$this->db->escape($barcode)."'").","; $sql .= " fk_barcode_type = ".(empty($fk_barcode_type) ? 'NULL' : "'".$this->db->escape($fk_barcode_type)."'"); + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", packaging = ".(empty($packaging) ? 1 : $packaging); $sql .= " WHERE rowid = ".$this->product_fourn_price_id; // TODO Add price_base_type and price_ttc @@ -409,6 +411,7 @@ class ProductFournisseur extends Product $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price("; $sql .= " multicurrency_price, multicurrency_unitprice, multicurrency_tx, fk_multicurrency, multicurrency_code,"; $sql .= "datec, fk_product, fk_soc, ref_fourn, desc_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, fk_availability, default_vat_code, info_bits, entity, delivery_time_days, supplier_reputation, barcode, fk_barcode_type)"; + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", packaging"; $sql .= " values("; $sql .= (isset($multicurrency_buyprice) ? "'".$this->db->escape(price2num($multicurrency_buyprice))."'" : 'null').","; $sql .= (isset($multicurrency_unitBuyPrice) ? "'".$this->db->escape(price2num($multicurrency_unitBuyPrice))."'" : 'null').","; @@ -436,6 +439,7 @@ class ProductFournisseur extends Product $sql .= (empty($supplier_reputation) ? 'NULL' : "'".$this->db->escape($supplier_reputation)."'").","; $sql .= (empty($barcode) ? 'NULL' : "'".$this->db->escape($barcode)."'").","; $sql .= (empty($fk_barcode_type) ? 'NULL' : "'".$this->db->escape($fk_barcode_type)."'"); + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", ".(empty($this->packaging) ? 1 : $this->db->escape($this->packaging)) ; $sql .= ")"; $idinserted = 0; @@ -502,6 +506,7 @@ class ProductFournisseur extends Product $sql .= " pfp.supplier_reputation, pfp.fk_user, pfp.datec,"; $sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code,"; $sql .= " pfp.barcode, pfp.fk_barcode_type"; + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", pfp.packaging"; $sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql .= " WHERE pfp.rowid = ".(int) $rowid; @@ -545,6 +550,12 @@ class ProductFournisseur extends Product $this->fourn_barcode = $obj->barcode; $this->fourn_fk_barcode_type = $obj->fk_barcode_type; } + + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { + $this->packaging = $obj->packaging; + if ($this->packaging < $this->fourn_qty) $this->packaging = $this->fourn_qty; + } + if (empty($ignore_expression) && !empty($this->fk_supplier_price_expression)) { $priceparser = new PriceParser($this->db); @@ -599,7 +610,8 @@ class ProductFournisseur extends Product $sql .= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.info_bits, pfp.delivery_time_days, pfp.supplier_reputation,"; $sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code, pfp.datec, pfp.tms,"; $sql .= " pfp.barcode, pfp.fk_barcode_type"; - $sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp, ".MAIN_DB_PREFIX."societe as s"; + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", pfp.packaging"; + $sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp, ".MAIN_DB_PREFIX."societe as s"; $sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")"; $sql .= " AND pfp.fk_soc = s.rowid"; $sql .= " AND s.status=1"; // only enabled company selected @@ -648,6 +660,11 @@ class ProductFournisseur extends Product $prodfourn->fourn_multicurrency_id = $record["fk_multicurrency"]; $prodfourn->fourn_multicurrency_code = $record["multicurrency_code"]; + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { + $prodfourn->packaging = $record["packaging"]; + if ($prodfourn->packaging < $prodfourn->fourn_qty) $prodfourn->packaging = $prodfourn->fourn_qty; + } + if ($conf->barcode->enabled) { $prodfourn->barcode = $record["barcode"]; $prodfourn->fk_barcode_type = $record["fk_barcode_type"]; diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 1ca335da637..42e90c21535 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -303,6 +303,10 @@ PossibleValues=Possible values GoOnMenuToCreateVairants=Go on menu %s - %s to prepare attribute variants (like colors, size, ...) UseProductFournDesc=Add a feature to define the descriptions of products defined by the vendors in addition to descriptions for customers ProductSupplierDescription=Vendor description for the product +UseProductSupplierPackaging=Use packaging on supplier prices (recalculate quantities according to packaging set on supplier price when adding/updating line in supplier documents) +PackagingForThisProduct=Packaging +QtyRecalculatedWithPackaging=The quantity of the line were recalculated according to supplier packaging + #Attributes VariantAttributes=Variant attributes ProductAttributes=Variant attributes for products @@ -347,4 +351,4 @@ ErrorDestinationProductNotFound=Destination product not found ErrorProductCombinationNotFound=Product variant not found ActionAvailableOnVariantProductOnly=Action only available on the variant of product ProductsPricePerCustomer=Product prices per customers -ProductSupplierExtraFields=Additional Attributes (Supplier Prices) \ No newline at end of file +ProductSupplierExtraFields=Additional Attributes (Supplier Prices) diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index deafff12cfe..34d907ca62a 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -156,6 +156,18 @@ if ($action == 'other') $resql_new = $db->query($sql_new); } } + + $value = GETPOST('activate_useProdSupplierPackaging', 'alpha'); + $res = dolibarr_set_const($db, "PRODUCT_USE_SUPPLIER_PACKAGING", $value,'chaine',0,'',$conf->entity); + if ($value) { + $sql_test = "SELECT count(packaging) as cpt FROM ".MAIN_DB_PREFIX."product_fournisseur_price WHERE 1"; + $resql = $db->query($sql_test); + if (!$resql && $db->lasterrno == 'DB_ERROR_NOSUCHFIELD') // if the field does not exist, we create it + { + $sql_new = "ALTER TABLE ".MAIN_DB_PREFIX."product_fournisseur_price ADD COLUMN packaging double(24,8) DEFAULT 1"; + $resql_new = $db->query($sql_new); + } + } } if ($action == 'specimen') // For products @@ -676,6 +688,13 @@ if (! empty($conf->fournisseur->enabled)) print $form->selectyesno("activate_useProdFournDesc", (! empty($conf->global->PRODUIT_FOURN_TEXTS)?$conf->global->PRODUIT_FOURN_TEXTS:0), 1); print ''; print ''; + + print ''; + print ''.$langs->trans("UseProductSupplierPackaging").''; + print ''; + print $form->selectyesno("activate_useProdSupplierPackaging", (! empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)?$conf->global->PRODUCT_USE_SUPPLIER_PACKAGING:0), 1); + print ''; + print ''; } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e99d4e46420..a1df94edee1 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1730,6 +1730,7 @@ class Product extends CommonObject $sql .= " pfp.fk_product, pfp.ref_fourn, pfp.desc_fourn, pfp.fk_soc, pfp.tva_tx, pfp.fk_supplier_price_expression"; $sql .= " ,pfp.default_vat_code"; $sql .= " ,pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code"; + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", pfp.packaging"; $sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql .= " WHERE pfp.rowid = ".$prodfournprice; if ($qty > 0) { $sql .= " AND pfp.quantity <= ".$qty; @@ -1772,6 +1773,7 @@ class Product extends CommonObject $this->fourn_multicurrency_tx = $obj->multicurrency_tx; $this->fourn_multicurrency_id = $obj->fk_multicurrency; $this->fourn_multicurrency_code = $obj->multicurrency_code; + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $this->packaging = $obj->packaging; $result = $obj->fk_product; return $result; } @@ -1782,6 +1784,7 @@ class Product extends CommonObject $sql .= " pfp.fk_product, pfp.ref_fourn as ref_supplier, pfp.desc_fourn as desc_supplier, pfp.tva_tx, pfp.fk_supplier_price_expression"; $sql .= " ,pfp.default_vat_code"; $sql .= " ,pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code"; + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", pfp.packaging"; $sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql .= " WHERE pfp.fk_product = ".$product_id; if ($fourn_ref != 'none') { $sql .= " AND pfp.ref_fourn = '".$fourn_ref."'"; @@ -1830,7 +1833,8 @@ class Product extends CommonObject $this->fourn_multicurrency_tx = $obj->multicurrency_tx; $this->fourn_multicurrency_id = $obj->fk_multicurrency; $this->fourn_multicurrency_code = $obj->multicurrency_code; - $result = $obj->fk_product; + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $this->packaging = $obj->packaging; + $result = $obj->fk_product; return $result; } else @@ -3669,7 +3673,8 @@ class Product extends CommonObject $sql.= ", quantity"; $sql.= ", fk_user"; $sql.= ", tva_tx"; - $sql.= ") VALUES ("; + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", packaging"; + $sql.= ") VALUES ("; $sql.= "'".$this->db->idate($now)."'"; $sql.= ", ".$conf->entity; $sql.= ", ".$this->id; @@ -3678,6 +3683,7 @@ class Product extends CommonObject $sql.= ", ".$quantity; $sql.= ", ".$user->id; $sql.= ", 0"; + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", ".(!empty($this->packaging) ? $this->packaging : 1); $sql.= ")"; if ($this->db->query($sql)) { diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index b419185d84e..bb32efba7e5 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -170,6 +170,7 @@ if (empty($reshook)) $supplier_description = GETPOST('supplier_description', 'alpha'); $barcode = GETPOST('barcode', 'alpha'); $fk_barcode_type = GETPOST('fk_barcode_type', 'int'); + $packaging = GETPOST('packaging', 'int'); if ($tva_tx == '') { @@ -232,6 +233,12 @@ if (empty($reshook)) } } + if (empty($packaging)) $packaging = 1; + + if ($packaging < $quantity) $packaging = $quantity; + + $object->packaging = $packaging; + if (!$error) { $db->begin(); @@ -765,6 +772,15 @@ SCRIPT; print ''; } + // Product packaging + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) + { + print ''; + print ''.$langs->trans('PackagingForThisProduct').''; + print ''; + print ''; + } + $extrafields->fetch_name_optionals_label("product_fournisseur_price"); $extralabels = $extrafields->attributes["product_fournisseur_price"]['label']; // Extrafields @@ -872,6 +888,7 @@ SCRIPT; print_liste_field_titre("BarcodeValue", $_SERVER["PHP_SELF"], "pfp.barcode", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("BarcodeType", $_SERVER["PHP_SELF"], "pfp.fk_barcode_type", "", $param, '', $sortfield, $sortorder, 'center '); } + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) print_liste_field_titre("PackagingForThisProduct",$_SERVER["PHP_SELF"],"pfp.packaging","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre("DateModification", $_SERVER["PHP_SELF"], "pfp.tms", "", $param, '', $sortfield, $sortorder, 'right '); // fetch optionals attributes and labels @@ -1002,6 +1019,14 @@ SCRIPT; print ''; } + // Packaging + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) + { + print ''; + print price2num($productfourn->packaging); + print ''; + } + // Date print ''; print dol_print_date(($productfourn->fourn_date_modification ? $productfourn->fourn_date_modification : $productfourn->date_modification), "dayhour"); From 6484ba10c52ac634c04f54fb24bae4243a470026 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric?= <35066297+c3do@users.noreply.github.com> Date: Sat, 23 Nov 2019 16:08:35 +0100 Subject: [PATCH 039/784] remove unecessary code already done by ::createProductCombination --- htdocs/product/class/api_products.class.php | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index b0ed902ffb3..40d50357dc2 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -1372,18 +1372,13 @@ class Products extends DolibarrApi } $prodcomb = new ProductCombination($this->db); - if (! $prodcomb->fetchByProductCombination2ValuePairs($id, $features)) - { - $result = $prodcomb->createProductCombination(DolibarrApiAccess::$user, $this->product, $features, array(), $price_impact_is_percent, $price_impact, $weight_impact, $reference); - if ($result > 0) - { - return $result; - } else { - throw new RestException(500, "Error creating new product variant"); - } - } else { - return $prodcomb->id; - } + $result = $prodcomb->createProductCombination(DolibarrApiAccess::$user, $this->product, $features, array(), $price_impact_is_percent, $price_impact, $weight_impact, $reference); + if ($result > 0) + { + return $result; + } else { + throw new RestException(500, "Error creating new product variant"); + } } /** From 6086ecef864353cb908c905aa790529f8b74388b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric?= <35066297+c3do@users.noreply.github.com> Date: Sat, 23 Nov 2019 16:14:21 +0100 Subject: [PATCH 040/784] Can add already existing product as variant ONLY if the reference is forced --- .../class/ProductCombination.class.php | 147 ++++++++++-------- 1 file changed, 82 insertions(+), 65 deletions(-) diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index 6dfa1bf94c5..a3646147101 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -514,7 +514,23 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; $db->begin(); - $newproduct = clone $product; + $forced_refvar = trim($forced_refvar); + + if (!empty($forced_refvar) && $forced_refvar != $product->ref) { + $existingProduct = new Product($db); + $result = $existingProduct->fetch('', $forced_refvar); + if ($result > 0) { + $newproduct = $existingProduct; + } else { + $existingProduct = false; + $newproduct = clone $product; + $newproduct->ref = $forced_refvar; + } + } else { + $forced_refvar = false; + $existingProduct = false; + $newproduct = clone $product; + } //Final weight impact $weight_impact = $forced_weightvar; @@ -529,11 +545,7 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; if ($forced_pricevar === false) { $price_impact = 0; } - - if ($forced_refvar !== false) { - $forced_refvar = trim($forced_refvar); - } - + $newcomb = new ProductCombination($db); $existingCombination = $newcomb->fetchByProductCombination2ValuePairs($product->id, $combinations); @@ -541,7 +553,6 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; $newcomb = $existingCombination; } else { $newcomb->fk_product_parent = $product->id; - if ($newcomb->create($user) < 0) { // Create 1 entry into product_attribute_combination (1 entry for all combinations) $db->rollback(); return -1; @@ -577,14 +588,13 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; if ($forced_pricevar === false) { $price_impact += (float) price2num($variations[$currcombattr][$currcombval]['price']); } - if (empty($forced_refvar)) { - if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) { - $newproduct->ref .= $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR . $prodattrval->ref; - } else { - $newproduct->ref .= '_'.$prodattrval->ref; - } - } else { - $newproduct->ref = $forced_refvar; + + if ($forced_refvar === false) { + if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) { + $newproduct->ref .= $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR . $prodattrval->ref; + } else { + $newproduct->ref .= '_'.$prodattrval->ref; + } } //The first one should not contain a linebreak @@ -600,58 +610,65 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; $newproduct->weight += $weight_impact; - //To avoid wrong information in price history log - $newproduct->price = 0; - $newproduct->price_ttc = 0; - $newproduct->price_min = 0; - $newproduct->price_min_ttc = 0; - - // A new variant must use a new barcode (not same product) - $newproduct->barcode = -1; - // Now create the product //print 'Create prod '.$newproduct->ref.'
'."\n"; - $newprodid = $newproduct->create($user); - if ($newprodid < 0) - { - //In case the error is not related with an already existing product - if ($newproduct->error != 'ErrorProductAlreadyExists') { - $this->error[] = $newproduct->error; - $this->errors = $newproduct->errors; - $db->rollback(); - return -1; - } - - /** - * If there is an existing combination, then we update the prices and weight - * Otherwise, we try adding a random number to the ref - */ - - if ($newcomb->fk_product_child) { - $res = $newproduct->fetch($existingCombination->fk_product_child); - } else { - $orig_prod_ref = $newproduct->ref; - $i = 1; - - do { - $newproduct->ref = $orig_prod_ref.$i; - $res = $newproduct->create($user); - - if ($newproduct->error != 'ErrorProductAlreadyExists') { - $this->errors[] = $newproduct->error; - break; - } - - $i++; - } while ($res < 0); - } - - if ($res < 0) { - $db->rollback(); - return -1; - } - - $newproduct->weight += $weight_impact; + if ($existingProduct === false) { + //To avoid wrong information in price history log + $newproduct->price = 0; + $newproduct->price_ttc = 0; + $newproduct->price_min = 0; + $newproduct->price_min_ttc = 0; + + // A new variant must use a new barcode (not same product) + $newproduct->barcode = -1; + $result = $newproduct->create($user); + + if ($result < 0) + { + //In case the error is not related with an already existing product + if ($newproduct->error != 'ErrorProductAlreadyExists') { + $this->error[] = $newproduct->error; + $this->errors = $newproduct->errors; + $db->rollback(); + return -1; + } + + /** + * If there is an existing combination, then we update the prices and weight + * Otherwise, we try adding a random number to the ref + */ + + if ($newcomb->fk_product_child) { + $res = $newproduct->fetch($existingCombination->fk_product_child); + } else { + $orig_prod_ref = $newproduct->ref; + $i = 1; + + do { + $newproduct->ref = $orig_prod_ref.$i; + $res = $newproduct->create($user); + + if ($newproduct->error != 'ErrorProductAlreadyExists') { + $this->errors[] = $newproduct->error; + break; + } + + $i++; + } while ($res < 0); + } + + if ($res < 0) { + $db->rollback(); + return -1; + } + } + } else { + $result = $newproduct->update($newproduct->id, $user); + if ($result < 0) + { + $db->rollback(); + return -1; + } } $newcomb->fk_product_child = $newproduct->id; From 7a3f6c362d52b516165217d4c6847afa6cd8810a Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 23 Nov 2019 15:23:31 +0000 Subject: [PATCH 041/784] Fixing style errors. --- .../class/ProductCombination.class.php | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index a3646147101..fc58d338220 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -515,17 +515,17 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; $db->begin(); $forced_refvar = trim($forced_refvar); - + if (!empty($forced_refvar) && $forced_refvar != $product->ref) { - $existingProduct = new Product($db); - $result = $existingProduct->fetch('', $forced_refvar); - if ($result > 0) { - $newproduct = $existingProduct; - } else { - $existingProduct = false; - $newproduct = clone $product; - $newproduct->ref = $forced_refvar; - } + $existingProduct = new Product($db); + $result = $existingProduct->fetch('', $forced_refvar); + if ($result > 0) { + $newproduct = $existingProduct; + } else { + $existingProduct = false; + $newproduct = clone $product; + $newproduct->ref = $forced_refvar; + } } else { $forced_refvar = false; $existingProduct = false; @@ -588,12 +588,12 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; if ($forced_pricevar === false) { $price_impact += (float) price2num($variations[$currcombattr][$currcombval]['price']); } - + if ($forced_refvar === false) { if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) { - $newproduct->ref .= $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR . $prodattrval->ref; + $newproduct->ref .= $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR . $prodattrval->ref; } else { - $newproduct->ref .= '_'.$prodattrval->ref; + $newproduct->ref .= '_'.$prodattrval->ref; } } @@ -618,11 +618,11 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; $newproduct->price_ttc = 0; $newproduct->price_min = 0; $newproduct->price_min_ttc = 0; - + // A new variant must use a new barcode (not same product) $newproduct->barcode = -1; $result = $newproduct->create($user); - + if ($result < 0) { //In case the error is not related with an already existing product @@ -632,31 +632,31 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; $db->rollback(); return -1; } - + /** * If there is an existing combination, then we update the prices and weight * Otherwise, we try adding a random number to the ref */ - + if ($newcomb->fk_product_child) { $res = $newproduct->fetch($existingCombination->fk_product_child); } else { $orig_prod_ref = $newproduct->ref; $i = 1; - + do { $newproduct->ref = $orig_prod_ref.$i; $res = $newproduct->create($user); - + if ($newproduct->error != 'ErrorProductAlreadyExists') { $this->errors[] = $newproduct->error; break; } - + $i++; } while ($res < 0); } - + if ($res < 0) { $db->rollback(); return -1; From 31cfc9cd3586d5a0f5485bc4e4492ff0996d12a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric?= <35066297+c3do@users.noreply.github.com> Date: Sat, 23 Nov 2019 17:04:14 +0100 Subject: [PATCH 042/784] Add field reference in form --- htdocs/variants/combinations.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index f8a8b9cc9e5..c2067a28ee1 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -33,6 +33,7 @@ $ref = GETPOST('ref', 'alpha'); $weight_impact = GETPOST('weight_impact', 'alpha'); $price_impact = GETPOST('price_impact', 'alpha'); $price_impact_percent = (bool) GETPOST('price_impact_percent'); +$reference = GETPOST('reference', 'alpha'); $form = new Form($db); $action = GETPOST('action', 'alpha'); @@ -106,6 +107,10 @@ if ($_POST) { } else { + $reference = trim($reference); + if (empty($reference)) { + $reference = false; + } $weight_impact = price2num($weight_impact); $price_impact = price2num($price_impact); $sanit_features = array(); @@ -141,7 +146,7 @@ if ($_POST) { if (!$prodcomb->fetchByProductCombination2ValuePairs($id, $sanit_features)) { - $result = $prodcomb->createProductCombination($user, $object, $sanit_features, array(), $price_impact_percent, $price_impact, $weight_impact); + $result = $prodcomb->createProductCombination($user, $object, $sanit_features, array(), $price_impact_percent, $price_impact, $weight_impact, $reference); if ($result > 0) { setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); @@ -587,6 +592,10 @@ if (! empty($id) || ! empty($ref)) + + + + From d647479794f6f7e9b1f4ccc1947efd8d7258afed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric?= <35066297+c3do@users.noreply.github.com> Date: Sat, 23 Nov 2019 17:17:25 +0100 Subject: [PATCH 043/784] Do not delete product automaticaly (unlink only) --- htdocs/variants/combinations.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index c2067a28ee1..e3993d02d3b 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -244,7 +244,7 @@ if ($action === 'confirm_deletecombination') { if ($prodcomb->fetch($valueid) > 0) { $db->begin(); - if ($prodcomb->delete($user) > 0 && $prodstatic->fetch($prodcomb->fk_product_child) > 0 && $prodstatic->delete($user) > 0) { + if ($prodcomb->delete($user) > 0) { $db->commit(); setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); header('Location: '.dol_buildpath('/variants/combinations.php?id='.$object->id, 2)); From 83de0fa7c19fee857fa9723da6fd6c449da674a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric?= <35066297+c3do@users.noreply.github.com> Date: Sat, 23 Nov 2019 18:03:46 +0100 Subject: [PATCH 044/784] Add the choice to delete the product linked --- htdocs/variants/combinations.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index e3993d02d3b..adb2fa8b739 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -42,6 +42,7 @@ $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $cancel = GETPOST('cancel', 'alpha'); +$delete_product = GETPOST('delete_product', 'alpha'); // Security check $fieldvalue = (!empty($id) ? $id : $ref); @@ -244,7 +245,7 @@ if ($action === 'confirm_deletecombination') { if ($prodcomb->fetch($valueid) > 0) { $db->begin(); - if ($prodcomb->delete($user) > 0) { + if ($prodcomb->delete($user) > 0 && (empty($delete_product) || ($delete_product == 'on' && $prodstatic->fetch($prodcomb->fk_product_child) > 0 && $prodstatic->delete($user) > 0))) { $db->commit(); setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); header('Location: '.dol_buildpath('/variants/combinations.php?id='.$object->id, 2)); @@ -635,7 +636,7 @@ if (! empty($id) || ! empty($ref)) $langs->trans('Delete'), $langs->trans('ProductCombinationDeleteDialog', $prodstatic->ref), "confirm_deletecombination", - '', + array(array('label'=> $langs->trans('DeleteLinkedProduct'),'type'=> 'checkbox', 'name' => 'delete_product', 'value' => false)), 0, 1 ); From b959e595545d6b434122e52ac6fae05bf52804a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric?= <35066297+c3do@users.noreply.github.com> Date: Sat, 23 Nov 2019 18:09:17 +0100 Subject: [PATCH 045/784] Checkbox label delete child product EN --- htdocs/langs/en_US/products.lang | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 1ca335da637..103f13b7f75 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -347,4 +347,5 @@ ErrorDestinationProductNotFound=Destination product not found ErrorProductCombinationNotFound=Product variant not found ActionAvailableOnVariantProductOnly=Action only available on the variant of product ProductsPricePerCustomer=Product prices per customers -ProductSupplierExtraFields=Additional Attributes (Supplier Prices) \ No newline at end of file +ProductSupplierExtraFields=Additional Attributes (Supplier Prices) +DeleteLinkedProduct = Delete the child product linked to the combination From 950a32a433ae6f633eaabeb37cc5619bddc470fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric?= <35066297+c3do@users.noreply.github.com> Date: Sat, 23 Nov 2019 18:11:20 +0100 Subject: [PATCH 046/784] Checkbox label delete child product FR --- htdocs/langs/fr_FR/products.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index 0248f6470a9..d5465684736 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -347,3 +347,4 @@ ErrorDestinationProductNotFound=Produit destination non trouvé ErrorProductCombinationNotFound=Variante du produit non trouvé ActionAvailableOnVariantProductOnly=Action disponible uniquement sur la variante du produit ProductsPricePerCustomer=Prix produit par clients +DeleteLinkedProduct = Supprimer le produit enfant lié à la variante From 89dd04aa0736eb722ad9456ca62d9c31768e5252 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Sat, 23 Nov 2019 19:05:49 +0100 Subject: [PATCH 047/784] implement on supplier_order --- .../class/fournisseur.commande.class.php | 62 ++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index b1ebe4a3895..451084caf4b 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -387,6 +387,7 @@ class CommandeFournisseur extends CommonOrder */ public function fetch_lines($only_product = 0) { + global $conf; // phpcs:enable //$result=$this->fetch_lines(); $this->lines = array(); @@ -399,8 +400,12 @@ class CommandeFournisseur extends CommonOrder $sql .= " l.fk_unit,"; $sql .= " l.date_start, l.date_end,"; $sql .= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc'; + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) + $sql.= ", pfp.rowid as fk_pfp, pfp.packaging"; $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l"; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid'; + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON l.fk_product = pfp.fk_product and l.ref = pfp.ref_fourn"; $sql .= " WHERE l.fk_commande = ".$this->id; if ($only_product) $sql .= ' AND p.fk_product_type = 0'; $sql .= " ORDER BY l.rang, l.rowid"; @@ -451,7 +456,13 @@ class CommandeFournisseur extends CommonOrder $line->ref_fourn = $objp->ref_supplier; // The supplier ref of price when product was added. May have change since $line->ref_supplier = $objp->ref_supplier; // The supplier ref of price when product was added. May have change since - $line->date_start = $this->db->jdate($objp->date_start); + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) + { + $line->fk_fournprice = $objp->fk_pfp; + $line->packaging = $objp->packaging; + } + + $line->date_start = $this->db->jdate($objp->date_start); $line->date_end = $this->db->jdate($objp->date_end); $line->fk_unit = $objp->fk_unit; @@ -1615,6 +1626,26 @@ class CommandeFournisseur extends CommonOrder return -1; } } + + // redefine quantity according to packaging + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) + { + $prod = new Product($this->db, $fk_product); + $prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', ($this->fk_soc?$this->fk_soc:$this->socid)); + if ($qty < $prod->packaging) + { + $qty = $prod->packaging; + } + else + { + if (($qty % $prod->packaging) > 0) + { + $coeff = intval($qty/$prod->packaging) + 1; + $qty = $prod->packaging * $coeff; + setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs'); + } + } + } } else { @@ -2531,6 +2562,27 @@ class CommandeFournisseur extends CommonOrder $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. } + // redefine quantity according to packaging + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) + { + $prod = new Product($this->db, $this->line->fk_product); + $prod->get_buyprice($this->line->fk_fournprice, $qty, $this->line->fk_product, 'none', ($this->fk_soc?$this->fk_soc:$this->socid)); + + if ($qty < $prod->packaging) + { + $qty = $prod->packaging; + } + else + { + if (($qty % $prod->packaging) > 0) + { + $coeff = intval($qty/$prod->packaging) + 1; + $qty = $prod->packaging * $coeff; + setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs'); + } + } + } + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; @@ -3309,6 +3361,8 @@ class CommandeFournisseurLigne extends CommonOrderLine */ public function fetch($rowid) { + global $conf; + $sql = 'SELECT cd.rowid, cd.fk_commande, cd.fk_product, cd.product_type, cd.description, cd.qty, cd.tva_tx, cd.special_code,'; $sql .= ' cd.localtax1_tx, cd.localtax2_tx, cd.localtax1_type, cd.localtax2_type, cd.ref,'; $sql .= ' cd.remise, cd.remise_percent, cd.subprice,'; @@ -3317,8 +3371,12 @@ class CommandeFournisseurLigne extends CommonOrderLine $sql .= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc,'; $sql .= ' cd.date_start, cd.date_end, cd.fk_unit,'; $sql .= ' cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc'; + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) + $sql.= ", pfp.rowid as fk_pfp"; $sql .= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid'; + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON cd.fk_product = pfp.fk_product and cd.ref = pfp.ref_fourn"; $sql .= ' WHERE cd.rowid = '.$rowid; $result = $this->db->query($sql); if ($result) @@ -3356,6 +3414,8 @@ class CommandeFournisseurLigne extends CommonOrderLine $this->product_ref = $objp->product_ref; $this->product_libelle = $objp->product_libelle; $this->product_desc = $objp->product_desc; + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) + $this->fk_fournprice = $objp->fk_pfp; $this->date_start = $this->db->jdate($objp->date_start); $this->date_end = $this->db->jdate($objp->date_end); From 5af9784dc91ac330e6005a82a4c4247efb6b64f5 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Mon, 25 Nov 2019 07:40:29 +0100 Subject: [PATCH 048/784] fix update line --- .../class/fournisseur.commande.class.php | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 451084caf4b..b356d3f8801 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2562,27 +2562,6 @@ class CommandeFournisseur extends CommonOrder $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. } - // redefine quantity according to packaging - if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) - { - $prod = new Product($this->db, $this->line->fk_product); - $prod->get_buyprice($this->line->fk_fournprice, $qty, $this->line->fk_product, 'none', ($this->fk_soc?$this->fk_soc:$this->socid)); - - if ($qty < $prod->packaging) - { - $qty = $prod->packaging; - } - else - { - if (($qty % $prod->packaging) > 0) - { - $coeff = intval($qty/$prod->packaging) + 1; - $qty = $prod->packaging * $coeff; - setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs'); - } - } - } - $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; @@ -2615,6 +2594,26 @@ class CommandeFournisseur extends CommonOrder $this->line->fk_commande = $this->id; //$this->line->label=$label; $this->line->desc = $desc; + + // redefine quantity according to packaging + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) + { + + if ($qty < $this->line->packaging) + { + $qty = $this->line->packaging; + } + else + { + if (($qty % $this->line->packaging) > 0) + { + $coeff = intval($qty/$this->line->packaging) + 1; + $qty = $this->line->packaging * $coeff; + setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs'); + } + } + } + $this->line->qty = $qty; $this->line->ref_supplier = $ref_supplier; @@ -3372,7 +3371,7 @@ class CommandeFournisseurLigne extends CommonOrderLine $sql .= ' cd.date_start, cd.date_end, cd.fk_unit,'; $sql .= ' cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc'; if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) - $sql.= ", pfp.rowid as fk_pfp"; + $sql.= ", pfp.rowid as fk_pfp, pfp.packaging"; $sql .= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid'; if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) @@ -3415,7 +3414,10 @@ class CommandeFournisseurLigne extends CommonOrderLine $this->product_libelle = $objp->product_libelle; $this->product_desc = $objp->product_desc; if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) + { + $this->packaging = $objp->packaging; $this->fk_fournprice = $objp->fk_pfp; + } $this->date_start = $this->db->jdate($objp->date_start); $this->date_end = $this->db->jdate($objp->date_end); From 5d051cc9012d47f661b9c2f7d89629de3d6e36ba Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 25 Nov 2019 07:08:22 +0000 Subject: [PATCH 049/784] Fixing style errors. --- htdocs/fourn/class/fournisseur.commande.class.php | 1 - htdocs/product/admin/product.php | 2 +- htdocs/product/fournisseurs.php | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index b356d3f8801..c065241a807 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2598,7 +2598,6 @@ class CommandeFournisseur extends CommonOrder // redefine quantity according to packaging if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { - if ($qty < $this->line->packaging) { $qty = $this->line->packaging; diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 34d907ca62a..292a6e39254 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -158,7 +158,7 @@ if ($action == 'other') } $value = GETPOST('activate_useProdSupplierPackaging', 'alpha'); - $res = dolibarr_set_const($db, "PRODUCT_USE_SUPPLIER_PACKAGING", $value,'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db, "PRODUCT_USE_SUPPLIER_PACKAGING", $value, 'chaine', 0, '', $conf->entity); if ($value) { $sql_test = "SELECT count(packaging) as cpt FROM ".MAIN_DB_PREFIX."product_fournisseur_price WHERE 1"; $resql = $db->query($sql_test); diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index bb32efba7e5..7cb6daf6702 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -888,7 +888,7 @@ SCRIPT; print_liste_field_titre("BarcodeValue", $_SERVER["PHP_SELF"], "pfp.barcode", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("BarcodeType", $_SERVER["PHP_SELF"], "pfp.fk_barcode_type", "", $param, '', $sortfield, $sortorder, 'center '); } - if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) print_liste_field_titre("PackagingForThisProduct",$_SERVER["PHP_SELF"],"pfp.packaging","",$param,'align="center"',$sortfield,$sortorder); + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) print_liste_field_titre("PackagingForThisProduct", $_SERVER["PHP_SELF"], "pfp.packaging", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("DateModification", $_SERVER["PHP_SELF"], "pfp.tms", "", $param, '', $sortfield, $sortorder, 'right '); // fetch optionals attributes and labels From 35f02c5165bf94d76b10767d45d257255bf354af Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Mon, 25 Nov 2019 10:25:09 +0100 Subject: [PATCH 050/784] NEW add width and height measures in product list --- htdocs/product/list.php | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 2396b345fb8..8df44bfeea8 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -174,6 +174,8 @@ $arrayfields = array( 'p.duration'=>array('label'=>$langs->trans("Duration"), 'checked'=>($contextpage != 'productlist'), 'enabled'=>(!empty($conf->service->enabled) && (string) $type == '1')), 'p.weight'=>array('label'=>$langs->trans("Weight"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled))), 'p.length'=>array('label'=>$langs->trans("Length"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE))), + 'p.width'=>array('label'=>$langs->trans('Width'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE))), + 'p.height'=>array('label'=>$langs->trans('Height'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE))), 'p.surface'=>array('label'=>$langs->trans("Surface"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SURFACE))), 'p.volume'=>array('label'=>$langs->trans("Volume"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_VOLUME))), 'cu.label'=>array('label'=>$langs->trans("DefaultUnitToShow"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && !empty($conf->global->PRODUCT_USE_UNITS))), @@ -289,7 +291,7 @@ $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.fk_product_type, p.barcode, p $sql .= ' p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,'; $sql .= ' p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy,'; $sql .= ' p.datec as date_creation, p.tms as date_update, p.pmp, p.stock,'; -$sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.width, p.width_units, p.height, p.height_units,'; +$sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.height, p.surface, p.surface_units, p.volume, p.volume_units, p.width, p.width_units, p.height, p.height_units,'; if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ' p.fk_unit, cu.label as cu_label,'; $sql .= ' MIN(pfp.unitprice) as minsellprice'; if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) { @@ -378,7 +380,7 @@ $sql .= $hookmanager->resPrint; $sql .= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.tva_tx, p.price_ttc, p.price_base_type,"; $sql .= " p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,"; $sql .= ' p.datec, p.tms, p.entity, p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.pmp, p.stock,'; -$sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.width, p.width_units, p.height, p.height_units'; +$sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.height, p.surface, p.surface_units, p.volume, p.volume_units, p.width, p.width_units, p.height, p.height_units'; if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ', p.fk_unit, cu.label'; if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) { @@ -630,6 +632,18 @@ if ($resql) print ''; print ''; } + // Width + if (!empty($arrayfields['p.width']['checked'])) + { + print ''; + print ''; + } + // Height + if (!empty($arrayfields['p.height']['checked'])) + { + print ''; + print ''; + } // Surface if (!empty($arrayfields['p.surface']['checked'])) { @@ -768,6 +782,8 @@ if ($resql) } if (!empty($arrayfields['p.weight']['checked'])) print_liste_field_titre($arrayfields['p.weight']['label'], $_SERVER["PHP_SELF"], "p.weight", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.length']['checked'])) print_liste_field_titre($arrayfields['p.length']['label'], $_SERVER["PHP_SELF"], "p.length", "", $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['p.width']['checked'])) print_liste_field_titre($arrayfields['p.width']['label'], $_SERVER['PHP_SELF'], 'p.width', '', $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['p.height']['checked'])) print_liste_field_titre($arrayfields['p.height']['label'], $_SERVER['PHP_SELF'], 'p.height', '', $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.surface']['checked'])) print_liste_field_titre($arrayfields['p.surface']['label'], $_SERVER["PHP_SELF"], "p.surface", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.volume']['checked'])) print_liste_field_titre($arrayfields['p.volume']['label'], $_SERVER["PHP_SELF"], "p.volume", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['cu.label']['checked'])) print_liste_field_titre($arrayfields['cu.label']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'center '); @@ -985,6 +1001,22 @@ if ($resql) print ''; if (!$i) $totalarray['nbfield']++; } + // Width + if (!empty($arrayfields['p.width']['checked'])) + { + print ''; + print $obj->width; + print ''; + if (!$i) $totalarray['nbfield']++; + } + // Height + if (!empty($arrayfields['p.height']['checked'])) + { + print ''; + print $obj->height; + print ''; + if (!$i) $totalarray['nbfield']++; + } // Surface if (!empty($arrayfields['p.surface']['checked'])) { From 76c5a08242ec496c7d9a2b1ceefc33e1864e284e Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 28 Nov 2019 12:13:36 +0000 Subject: [PATCH 051/784] Fixing style errors. --- htdocs/product/class/api_products.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 05e4fe3b1c6..8cb710ceab4 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -1373,13 +1373,13 @@ class Products extends DolibarrApi } $prodcomb = new ProductCombination($this->db); - + $result = $prodcomb->createProductCombination(DolibarrApiAccess::$user, $this->product, $features, array(), $price_impact_is_percent, $price_impact, $weight_impact, $reference); if ($result > 0) { - return $result; + return $result; } else { - throw new RestException(500, "Error creating new product variant"); + throw new RestException(500, "Error creating new product variant"); } } From f6bc48e6d7a40e3dd983997b0eae6b5f6c28a264 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 28 Nov 2019 22:13:11 +0100 Subject: [PATCH 052/784] FIX minimal stripe update for compatibility cf https://stripe.com/guides/important-update-for-connect --- htdocs/stripe/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/config.php b/htdocs/stripe/config.php index 17ca74b7955..3eb7feae0d5 100644 --- a/htdocs/stripe/config.php +++ b/htdocs/stripe/config.php @@ -55,4 +55,4 @@ else \Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']); \Stripe\Stripe::setAppInfo("Dolibarr Stripe", DOL_VERSION, "https://www.dolibarr.org"); // add dolibarr version -\Stripe\Stripe::setApiVersion("2019-05-16"); // force version API +\Stripe\Stripe::setApiVersion("2019-09-09"); // force version API From b9c0f961c9d890330c2027e7566f440fe2cc0c02 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 28 Nov 2019 22:17:49 +0100 Subject: [PATCH 053/784] Update stripe.class.php --- htdocs/stripe/class/stripe.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 626f5533da4..d1b661841db 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -393,7 +393,7 @@ class Stripe extends CommonObject "currency" => $currency_code, "payment_method_types" => array("card"), "description" => $description, - "statement_descriptor" => dol_trunc($tag, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) + "statement_descriptor_suffix" => dol_trunc($tag, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) //"save_payment_method" => true, "metadata" => $metadata ); @@ -683,7 +683,7 @@ class Stripe extends CommonObject $charge = \Stripe\Charge::create(array( "amount" => "$stripeamount", "currency" => "$currency", - "statement_descriptor" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) + "statement_descriptor_suffix" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) "description" => "Stripe payment: ".$description, "capture" => $capture, "metadata" => $metadata, @@ -693,7 +693,7 @@ class Stripe extends CommonObject $paymentarray = array( "amount" => "$stripeamount", "currency" => "$currency", - "statement_descriptor" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) + "statement_descriptor_suffix" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) "description" => "Stripe payment: ".$description, "capture" => $capture, "metadata" => $metadata, @@ -721,7 +721,7 @@ class Stripe extends CommonObject $paymentarray = array( "amount" => "$stripeamount", "currency" => "$currency", - "statement_descriptor" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) + "statement_descriptor_suffix" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) "description" => "Stripe payment: ".$description, "capture" => $capture, "metadata" => $metadata, From 16d08bd9031f6e50cde860a8a11018dd0bd9872a Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 28 Nov 2019 22:19:52 +0100 Subject: [PATCH 054/784] Update newpayment.php --- htdocs/public/payment/newpayment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index dbceb483f97..a3667af0c6a 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -495,7 +495,7 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled)) 'metadata' => $metadata, 'customer' => $customer->id, 'source' => $card, - 'statement_descriptor' => dol_trunc($FULLTAG, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) + 'statement_descriptor_suffix' => dol_trunc($FULLTAG, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) ), array("idempotency_key" => "$FULLTAG", "stripe_account" => "$stripeacc")); // Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...) if (empty($charge)) From 753439efee7b0f21f8f023778b11263afa02afc4 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 28 Nov 2019 23:23:08 +0100 Subject: [PATCH 055/784] Update stripe.php --- htdocs/stripe/admin/stripe.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index c3c008a5874..4444dd4c540 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -161,7 +161,7 @@ print ''; dol_fiche_head($head, 'stripeaccount', '', -1); -$stripearrayofwebhookevents=array('payout.created','payout.paid','charge.pending','charge.refunded','charge.succeeded','charge.failed','payment_intent.succeeded','payment_intent.payment_failed','payment_method.attached','payment_method.updated','payment_method.card_automatically_updated','payment_method.detached','source.chargeable','customer.deleted'); +$stripearrayofwebhookevents=array('account.updated','payout.created','payout.paid','charge.pending','charge.refunded','charge.succeeded','charge.failed','payment_intent.succeeded','payment_intent.payment_failed','payment_method.attached','payment_method.updated','payment_method.card_automatically_updated','payment_method.detached','source.chargeable','customer.deleted'); print $langs->trans("StripeDesc")."
\n"; From 828aa9bd93cc8a4ecc3069b9071196e4984c1e65 Mon Sep 17 00:00:00 2001 From: David Beniamine Date: Fri, 29 Nov 2019 15:59:25 +0100 Subject: [PATCH 056/784] Sort products by reference --- htdocs/takepos/ajax.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/takepos/ajax.php b/htdocs/takepos/ajax.php index 74f69618a0f..f889615660e 100644 --- a/htdocs/takepos/ajax.php +++ b/htdocs/takepos/ajax.php @@ -46,6 +46,10 @@ if ($action=="getProducts") { $object = new Categorie($db); $result=$object->fetch($category); $prods = $object->getObjectsInCateg("product"); + function sort_by_ref($a, $b) { + return strcmp($a->ref, $b->ref); + } + usort($prods, "sort_by_ref"); echo json_encode($prods); } elseif ($action=="search" && $term != '') { From 565a17dc47c6a032f21a42584c4ebda48fcec785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric?= <35066297+c3do@users.noreply.github.com> Date: Sat, 30 Nov 2019 23:36:23 +0100 Subject: [PATCH 057/784] API New add purchase prices --- htdocs/product/class/api_products.class.php | 67 +++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 8cb710ceab4..b9d21b481e2 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -631,6 +631,73 @@ class Products extends DolibarrApi 'prices_by_qty_list'=>$this->product->prices_by_qty_list[0] ); } + + /** + * Add purchase prices for a product. + * + * @param int $id ID of Product + * @param float $qty Min quantity for which price is valid + * @param float $buyprice Purchase price for the quantity min + * @param string $price_base_type HT or TTC + * @param int $fourn_id Supplier ID + * @param int $availability Product availability + * @param string $ref_fourn Supplier ref + * @param float $tva_tx New VAT Rate (For example 8.5. Should not be a string) + * @param string $charges costs affering to product + * @param float $remise_percent Discount regarding qty (percent) + * @param float $remise Discount regarding qty (amount) + * @param int $newnpr Set NPR or not + * @param int $delivery_time_days Delay in days for delivery (max). May be '' if not defined. + * @param string $supplier_reputation Reputation with this product to the defined supplier (empty, FAVORITE, DONOTORDER) + * @param array $localtaxes_array Array with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function). + * @param string $newdefaultvatcode Default vat code + * @param float $multicurrency_buyprice Purchase price for the quantity min in currency + * @param string $multicurrency_price_base_type HT or TTC in currency + * @param float $multicurrency_tx Rate currency + * @param string $multicurrency_code Currency code + * @param string $desc_fourn Custom description for product_fourn_price + * @param string $barcode Barcode + * @param int $fk_barcode_type Barcode type + * @return int + * + * @throws RestException + * @throws 401 + * + * @url POST {id}/purchase_prices + */ + public function addPurchasePrice($id, $qty, $buyprice, $price_base_type, $fourn_id, $availability, $ref_fourn, $tva_tx, $charges = 0, $remise_percent = 0, $remise = 0, $newnpr = 0, $delivery_time_days = 0, $supplier_reputation = '', $localtaxes_array = array(), $newdefaultvatcode = '', $multicurrency_buyprice = 0, $multicurrency_price_base_type = 'HT', $multicurrency_tx = 1, $multicurrency_code = '', $desc_fourn = '', $barcode = '', $fk_barcode_type = null) + { + if(! DolibarrApiAccess::$user->rights->produit->creer) { + throw new RestException(401); + } + + $result = $this->productsupplier->fetch($id); + if (!$result) { + throw new RestException(404, 'Product not found'); + } + + if (!DolibarrApi::_checkAccessToResource('product', $this->productsupplier->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $result = $this->productsupplier->add_fournisseur(DolibarrApiAccess::$user, $fourn_id, $ref_fourn, $qty); + if ($result <= 0) { + throw new RestException(500, "Error adding supplier to product : ".$this->db->lasterror()); + } + + $fourn = new Fournisseur($this->db); + $result = $fourn->fetch($fourn_id); + if ($result <= 0) { + throw new RestException(404, 'Supplier not found'); + } + + $result = $this->productsupplier->update_buyprice($qty, $buyprice, DolibarrApiAccess::$user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges, $remise_percent, $remise, $newnpr, $delivery_time_days, $supplier_reputation, $localtaxes_array, $newdefaultvatcode, $multicurrency_buyprice, $multicurrency_price_base_type, $multicurrency_tx, $multicurrency_code, $desc_fourn, $barcode, $fk_barcode_type); + + if ($result <= 0) { + throw new RestException(500, "Error updating buy price : ".$this->db->lasterror()); + } + return (int) $this->productsupplier->product_fourn_price_id; + } /** * Delete purchase price for a product From 1bad6f5c9c783dc97a4f5bb69708a997aa6c509e Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 30 Nov 2019 22:38:05 +0000 Subject: [PATCH 058/784] Fixing style errors. --- htdocs/product/class/api_products.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index b9d21b481e2..1bb5aed98f5 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -631,7 +631,7 @@ class Products extends DolibarrApi 'prices_by_qty_list'=>$this->product->prices_by_qty_list[0] ); } - + /** * Add purchase prices for a product. * @@ -670,29 +670,29 @@ class Products extends DolibarrApi if(! DolibarrApiAccess::$user->rights->produit->creer) { throw new RestException(401); } - + $result = $this->productsupplier->fetch($id); if (!$result) { throw new RestException(404, 'Product not found'); } - + if (!DolibarrApi::_checkAccessToResource('product', $this->productsupplier->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - + $result = $this->productsupplier->add_fournisseur(DolibarrApiAccess::$user, $fourn_id, $ref_fourn, $qty); if ($result <= 0) { throw new RestException(500, "Error adding supplier to product : ".$this->db->lasterror()); } - + $fourn = new Fournisseur($this->db); $result = $fourn->fetch($fourn_id); if ($result <= 0) { throw new RestException(404, 'Supplier not found'); } - + $result = $this->productsupplier->update_buyprice($qty, $buyprice, DolibarrApiAccess::$user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges, $remise_percent, $remise, $newnpr, $delivery_time_days, $supplier_reputation, $localtaxes_array, $newdefaultvatcode, $multicurrency_buyprice, $multicurrency_price_base_type, $multicurrency_tx, $multicurrency_code, $desc_fourn, $barcode, $fk_barcode_type); - + if ($result <= 0) { throw new RestException(500, "Error updating buy price : ".$this->db->lasterror()); } From 4bd4719aa660984a4d381f1cd5725d80d0e16566 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 1 Dec 2019 10:03:29 +0000 Subject: [PATCH 059/784] Fixing style errors. --- htdocs/stripe/class/stripe.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index ef902b6164c..48127874e12 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -969,10 +969,10 @@ class Stripe extends CommonObject if (!in_array($currency, $arrayzerounitcurrency)) $stripefee = round($fee * 100); else $stripefee = round($fee); - $paymentarray = array( + $paymentarray = array( "amount" => "$stripeamount", "currency" => "$currency", - "statement_descriptor_suffix" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) + "statement_descriptor_suffix" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) "description" => "Stripe payment: ".$description, "capture" => $capture, "metadata" => $metadata, From 7b295bf738dc295cfd774871f7fdb54ea5708c17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric?= <35066297+c3do@users.noreply.github.com> Date: Sun, 1 Dec 2019 14:56:39 +0100 Subject: [PATCH 060/784] addPurchasePrice Update the price if already exist --- htdocs/product/class/api_products.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 1bb5aed98f5..4ce7750fddd 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -633,7 +633,7 @@ class Products extends DolibarrApi } /** - * Add purchase prices for a product. + * Add/Update purchase prices for a product. * * @param int $id ID of Product * @param float $qty Min quantity for which price is valid @@ -681,7 +681,7 @@ class Products extends DolibarrApi } $result = $this->productsupplier->add_fournisseur(DolibarrApiAccess::$user, $fourn_id, $ref_fourn, $qty); - if ($result <= 0) { + if ($result < 0) { throw new RestException(500, "Error adding supplier to product : ".$this->db->lasterror()); } From 0396b348f78d478af2d2deb119226d018b66b8bd Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Tue, 10 Dec 2019 09:32:37 +0100 Subject: [PATCH 061/784] NEW add weighted amount on project/opportunity --- htdocs/core/lib/project.lib.php | 14 ++++++++------ htdocs/langs/en_US/projects.lang | 2 ++ htdocs/langs/fr_FR/projects.lang | 2 ++ htdocs/projet/card.php | 5 +++++ htdocs/projet/index.php | 4 ++-- htdocs/projet/list.php | 23 ++++++++++++++++++++--- 6 files changed, 39 insertions(+), 11 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 0c0c70b5708..414d344f4a8 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -1836,14 +1836,14 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks if (empty($arrayidofprojects)) $arrayidofprojects[0] = -1; // Get list of project with calculation on tasks - $sql2 = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_soc, s.nom as socname, p.fk_user_creat, p.public, p.fk_statut as status, p.fk_opp_status as opp_status, p.opp_amount,"; + $sql2 = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_soc, s.nom as socname, p.fk_user_creat, p.public, p.fk_statut as status, p.fk_opp_status as opp_status, p.opp_percent, p.opp_amount,"; $sql2 .= " p.dateo, p.datee,"; $sql2 .= " COUNT(t.rowid) as nb, SUM(t.planned_workload) as planned_workload, SUM(t.planned_workload * t.progress / 100) as declared_progess_workload"; $sql2 .= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc"; $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet"; $sql2 .= " WHERE p.rowid IN (".join(',', $arrayidofprojects).")"; - $sql2 .= " GROUP BY p.rowid, p.ref, p.title, p.fk_soc, s.nom, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_amount, p.dateo, p.datee"; + $sql2 .= " GROUP BY p.rowid, p.ref, p.title, p.fk_soc, s.nom, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_percent, p.opp_amount, p.dateo, p.datee"; $sql2 .= " ORDER BY p.title, p.ref"; $resql = $db->query($sql2); @@ -1862,7 +1862,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { print_liste_field_titre("OpportunityAmount", "", "", "", "", 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("OpportunityStatus", "", "", "", "", 'align="right"', $sortfield, $sortorder); + print_liste_field_titre('OpportunityWeightedAmount', '', '', '', '', 'align="right"', $sortfield, $sortorder); } if (empty($conf->global->PROJECT_HIDE_TASKS)) { @@ -1914,8 +1914,11 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks if ($objp->opp_amount) print price($objp->opp_amount, 0, '', 1, -1, -1, $conf->currency); print ''; print ''; - $code = dol_getIdFromCode($db, $objp->opp_status, 'c_lead_status', 'rowid', 'code'); - if ($code) print $langs->trans("OppStatus".$code); + if ($objp->opp_percent && $objp->opp_amount) { + $opp_weighted_amount = $objp->opp_percent * $objp->opp_amount / 100; + print price($opp_weighted_amount, 0, '', 1, -1, -1, $conf->currency); + $ponderated_opp_amount += price2num($opp_weighted_amount); + } print ''; } if (empty($conf->global->PROJECT_HIDE_TASKS)) @@ -1944,7 +1947,6 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks $total_task = $total_task + $objp->nb; $total_opp_amount = $total_opp_amount + $objp->opp_amount; - $ponderated_opp_amount = $ponderated_opp_amount + price2num($listofoppstatus[$objp->opp_status] * $objp->opp_amount / 100); } $i++; diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 79b152e0bdc..d393a7fa2d8 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -162,6 +162,8 @@ OpportunityProbability=Lead probability OpportunityProbabilityShort=Lead probab. OpportunityAmount=Lead amount OpportunityAmountShort=Lead amount +OpportunityWeightedAmount=Opportunity weighted amount +OpportunityWeightedAmountShort=Opp. weighted amount OpportunityAmountAverageShort=Average lead amount OpportunityAmountWeigthedShort=Weighted lead amount WonLostExcluded=Won/Lost excluded diff --git a/htdocs/langs/fr_FR/projects.lang b/htdocs/langs/fr_FR/projects.lang index 250ff0e16bc..ca6dd04e2f7 100644 --- a/htdocs/langs/fr_FR/projects.lang +++ b/htdocs/langs/fr_FR/projects.lang @@ -162,6 +162,8 @@ OpportunityProbability=Probabilité d'opportunité OpportunityProbabilityShort=Prob. opp. OpportunityAmount=Montant opportunité OpportunityAmountShort=Montant opportunité +OpportunityWeightedAmount=Montant pondéré opportunité +OpportunityWeightedAmountShort=Montant pondéré opp. OpportunityAmountAverageShort=montant moyen des opportunités OpportunityAmountWeigthedShort=Montant pondéré des opportunités WonLostExcluded=hors opportunités remportées/perdues diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 19bedc123ff..36d417a47be 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1045,6 +1045,11 @@ elseif ($object->id > 0) }*/ if (strcmp($object->opp_amount, '')) print price($object->opp_amount, 0, $langs, 1, 0, -1, $conf->currency); print ''; + + // Opportunity Weighted Amount + print ''.$langs->trans('OpportunityWeightedAmount').''; + if (strcmp($object->opp_amount, '') && strcmp($object->opp_percent, '')) print price($object->opp_amount * $object->opp_percent / 100, 0, $langs, 1, 0, -1, $conf->currency); + print ''; } // Date start - end diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index cd82f25d4d8..a2d501d0453 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -165,8 +165,8 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useles include DOL_DOCUMENT_ROOT.'/projet/graph_opportunities.inc.php'; -// List of draft projects -print_projecttasks_array($db, $form, $socid, $projectsListId, 0, 0, $listofoppstatus, array('projectlabel', 'plannedworkload', 'declaredprogress')); +// List of validated projects +print_projecttasks_array($db, $form, $socid, $projectsListId, 0, 1, $listofoppstatus, array('projectlabel', 'plannedworkload', 'declaredprogress')); print '
'; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 63240e9f842..837948bed3e 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -131,7 +131,8 @@ $arrayfields = array( 'p.opp_amount'=>array('label'=>$langs->trans("OpportunityAmountShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>103), 'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatusShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>104), 'p.opp_percent'=>array('label'=>$langs->trans("OpportunityProbabilityShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>105), - 'p.budget_amount'=>array('label'=>$langs->trans("Budget"), 'checked'=>0, 'position'=>110), + 'opp_weighted_amount'=>array('label'=>$langs->trans('OpportunityWeightedAmountShort'), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>106), + 'p.budget_amount'=>array('label'=>$langs->trans("Budget"), 'checked'=>0, 'position'=>110), 'p.usage_opportunity'=>array('label'=>$langs->trans("UsageOpportunity"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>115), 'p.usage_task'=>array('label'=>$langs->trans("UsageTasks"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_HIDE_TASKS ? 0 : 1), 'position'=>116), 'p.usage_bill_time'=>array('label'=>$langs->trans("UsageBillTimeShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_HIDE_TASKS ? 0 : 1), 'position'=>117), @@ -289,7 +290,7 @@ if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0] = '0'; / $distinct = 'DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once. $sql = "SELECT ".$distinct." p.rowid as id, p.ref, p.title, p.fk_statut, p.fk_opp_status, p.public, p.fk_user_creat"; -$sql .= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, p.tms as date_update, p.budget_amount, p.usage_opportunity, p.usage_task, p.usage_bill_time"; +$sql .= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, (p.opp_amount*p.opp_percent/100) as opp_weighted_amount, p.tms as date_update, p.budget_amount, p.usage_opportunity, p.usage_task, p.usage_bill_time"; $sql .= ", s.rowid as socid, s.nom as name, s.email"; $sql .= ", cls.code as opp_status_code"; // We'll need these fields in order to filter by categ @@ -604,6 +605,11 @@ if (!empty($arrayfields['p.opp_percent']['checked'])) print ''; print ''; } +if (!empty($arrayfields['opp_weighted_amount']['checked'])) +{ + print ''; + print ''; +} if (!empty($arrayfields['p.budget_amount']['checked'])) { print ''; @@ -676,7 +682,8 @@ if (!empty($arrayfields['p.datee']['checked'])) print_liste_field_titre( if (!empty($arrayfields['p.public']['checked'])) print_liste_field_titre($arrayfields['p.public']['label'], $_SERVER["PHP_SELF"], "p.public", "", $param, "", $sortfield, $sortorder); if (!empty($arrayfields['p.fk_opp_status']['checked'])) print_liste_field_titre($arrayfields['p.fk_opp_status']['label'], $_SERVER["PHP_SELF"], 'p.fk_opp_status', "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($arrayfields['p.opp_amount']['label'], $_SERVER["PHP_SELF"], 'p.opp_amount', "", $param, '', $sortfield, $sortorder, 'right '); -if (!empty($arrayfields['p.opp_percent']['checked'])) print_liste_field_titre($arrayfields['p.opp_percent']['label'], $_SERVER["PHP_SELF"], 'p.opp_percent', "", $param, '', $sortfield, $sortorder, 'right '); +if (!empty($arrayfields['p.opp_percent']['checked'])) print_liste_field_titre($arrayfields['p.opp_percent']['label'], $_SERVER['PHP_SELF'], 'p.opp_percent', "", $param, '', $sortfield, $sortorder, 'right '); +if (!empty($arrayfields['opp_weighted_amount']['checked'])) print_liste_field_titre($arrayfields['opp_weighted_amount']['label'], $_SERVER['PHP_SELF'], 'opp_weighted_amount', '', $param, '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre($arrayfields['p.budget_amount']['label'], $_SERVER["PHP_SELF"], 'p.budget_amount', "", $param, '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['p.usage_opportunity']['checked'])) print_liste_field_titre($arrayfields['p.usage_opportunity']['label'], $_SERVER["PHP_SELF"], 'p.usage_opportunity', "", $param, '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['p.usage_task']['checked'])) print_liste_field_titre($arrayfields['p.usage_task']['label'], $_SERVER["PHP_SELF"], 'p.usage_task', "", $param, '', $sortfield, $sortorder, 'right '); @@ -848,6 +855,16 @@ while ($i < min($num, $limit)) print ''; if (! $i) $totalarray['nbfield']++; } + // Opp weighted amount + if (!empty($arrayfields['opp_weighted_amount']['checked'])) + { + print ''; + if ($obj->opp_weighted_amount) { + print price($obj->opp_weighted_amount, 1, $langs, 1, -1, -1, ''); + } + print ''; + if (! $i) $totalarray['nbfield']++; + } // Budget if (! empty($arrayfields['p.budget_amount']['checked'])) { From 4ea042213ec1e4850a2b60ee799f3771ad946708 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Wed, 11 Dec 2019 10:59:19 +0100 Subject: [PATCH 062/784] NEW show project label in project index --- htdocs/projet/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index a2d501d0453..25c7029f8d5 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -166,7 +166,7 @@ include DOL_DOCUMENT_ROOT.'/projet/graph_opportunities.inc.php'; // List of validated projects -print_projecttasks_array($db, $form, $socid, $projectsListId, 0, 1, $listofoppstatus, array('projectlabel', 'plannedworkload', 'declaredprogress')); +print_projecttasks_array($db, $form, $socid, $projectsListId, 0, 1, $listofoppstatus, array('plannedworkload', 'declaredprogress')); print '
'; From b715ecd7d9a2d2af35ca7d6dca33f70f9edea615 Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Wed, 11 Dec 2019 16:42:03 +0100 Subject: [PATCH 063/784] FIX bookmark URLs get truncated to 255 chars --- htdocs/install/mysql/migration/10.0.0-11.0.0.sql | 3 +++ htdocs/install/mysql/tables/llx_bookmark.key.sql | 1 - htdocs/install/mysql/tables/llx_bookmark.sql | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 4bacfa9b765..f8f5f912025 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -545,3 +545,6 @@ ALTER TABLE llx_mrp_production ADD INDEX idx_mrp_production_fk_mo (fk_mo); ALTER TABLE llx_emailcollector_emailcollector ADD UNIQUE INDEX uk_emailcollector_emailcollector_ref(ref, entity); ALTER TABLE llx_website ADD COLUMN use_manifest integer; + +ALTER TABLE llx_bookmark DROP INDEX uk_bookmark_url; +ALTER TABLE llx_bookmark MODIFY COLUMN url TEXT; -- change from VARCHAR(255) to allow longer URLs diff --git a/htdocs/install/mysql/tables/llx_bookmark.key.sql b/htdocs/install/mysql/tables/llx_bookmark.key.sql index f933939ceb7..7f4090d32f4 100644 --- a/htdocs/install/mysql/tables/llx_bookmark.key.sql +++ b/htdocs/install/mysql/tables/llx_bookmark.key.sql @@ -17,5 +17,4 @@ -- =================================================================== -ALTER TABLE llx_bookmark ADD UNIQUE uk_bookmark_url (fk_user, url); ALTER TABLE llx_bookmark ADD UNIQUE uk_bookmark_title (fk_user, title); diff --git a/htdocs/install/mysql/tables/llx_bookmark.sql b/htdocs/install/mysql/tables/llx_bookmark.sql index 1c11525528c..6a76ed38343 100644 --- a/htdocs/install/mysql/tables/llx_bookmark.sql +++ b/htdocs/install/mysql/tables/llx_bookmark.sql @@ -21,7 +21,7 @@ create table llx_bookmark rowid integer AUTO_INCREMENT PRIMARY KEY, fk_user integer NOT NULL, dateb datetime, - url varchar(255) NOT NULL, + url TEXT, target varchar(16), title varchar(64), favicon varchar(24), From 7246b635423de07788507257da974b1dae6e0024 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Thu, 12 Dec 2019 17:34:37 +0100 Subject: [PATCH 064/784] NEW add total weighted amount in project list --- htdocs/projet/list.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 837948bed3e..2f7e30641b7 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -702,6 +702,7 @@ print "\n"; $i = 0; $totalarray = array(); +$totalarray['val'] = array(); while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); @@ -858,12 +859,15 @@ while ($i < min($num, $limit)) // Opp weighted amount if (!empty($arrayfields['opp_weighted_amount']['checked'])) { + if (!isset($totalarray['val']['opp_weighted_amount'])) $totalarray['val']['opp_weighted_amount'] = 0; print ''; if ($obj->opp_weighted_amount) { print price($obj->opp_weighted_amount, 1, $langs, 1, -1, -1, ''); + $totalarray['val']['opp_weighted_amount'] += $obj->opp_weighted_amount; } print ''; if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['pos'][$totalarray['nbfield']] = 'opp_weighted_amount'; } // Budget if (! empty($arrayfields['p.budget_amount']['checked'])) From 5d955fa7e00c362fe7f3f9b2b5274d787286b74c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Dec 2019 13:51:13 +0100 Subject: [PATCH 065/784] Update 10.0.0-11.0.0.sql --- htdocs/install/mysql/migration/10.0.0-11.0.0.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index f8f5f912025..d6e34030408 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -548,3 +548,4 @@ ALTER TABLE llx_website ADD COLUMN use_manifest integer; ALTER TABLE llx_bookmark DROP INDEX uk_bookmark_url; ALTER TABLE llx_bookmark MODIFY COLUMN url TEXT; -- change from VARCHAR(255) to allow longer URLs +ALTER TABLE llx_bookmark ADD UNIQUE uk_bookmark_title (fk_user, title); From 305a821b623e4e14be7f3e1fbb7c11ee8038c654 Mon Sep 17 00:00:00 2001 From: David Beniamine Date: Mon, 16 Dec 2019 17:30:31 +0100 Subject: [PATCH 066/784] TakePOS : setting to choose product field for sort --- htdocs/categories/class/categorie.class.php | 9 ++++++++- htdocs/takepos/admin/setup.php | 13 +++++++++++++ htdocs/takepos/ajax.php | 6 +----- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index f31e8f9b048..489b4034e3a 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -748,10 +748,11 @@ class Categorie extends CommonObject * * @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member') * @param int $onlyids Return only ids of objects (consume less memory) + * @param string $orderby field for order * @return array|int -1 if KO, array of instance of object if OK * @see containsObject() */ - public function getObjectsInCateg($type, $onlyids = 0) + public function getObjectsInCateg($type, $onlyids = 0, $orderby='') { $objs = array(); @@ -763,6 +764,12 @@ class Categorie extends CommonObject $sql .= " WHERE o.entity IN (" . getEntity($obj->element).")"; $sql.= " AND c.fk_categorie = ".$this->id; $sql .= " AND c.fk_" . $this->MAP_CAT_FK[$type] . " = o.rowid"; + if ($orderby) { + $prod = new Product($db); + if(array_key_exists($orderby, $prod->fields)){ + $sql .= " ORDER BY $orderby"; + } + } dol_syslog(get_class($this)."::getObjectsInCateg", LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index f331587723b..1c9aa911e82 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -77,6 +77,7 @@ if (GETPOST('action', 'alpha') == 'set') $res = dolibarr_set_const($db, "TAKEPOS_HEADER", GETPOST('TAKEPOS_HEADER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_FOOTER", GETPOST('TAKEPOS_FOOTER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_NUMPAD", GETPOST('TAKEPOS_NUMPAD', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_SORTPRODUCTFIELD", GETPOST('TAKEPOS_SORTPRODUCTFIELD', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_NUM_TERMINALS", GETPOST('TAKEPOS_NUM_TERMINALS', 'alpha'), 'chaine', 0, '', $conf->entity); if ($conf->global->TAKEPOS_ORDER_NOTES==1) @@ -213,6 +214,18 @@ $array=array(0=>$langs->trans("Numberspad"), 1=>$langs->trans("BillsCoinsPad")); print $form->selectarray('TAKEPOS_NUMPAD', $array, (empty($conf->global->TAKEPOS_NUMPAD)?'0':$conf->global->TAKEPOS_NUMPAD), 0); print "\n"; +// Sort product +print ''; +print $langs->trans("SortProductField"); +print ''; +$prod = new Product($db); +$array = []; +foreach($prod->fields as $k => $v) { + $array[$k]=$k; +} +print $form->selectarray('TAKEPOS_SORTPRODUCTFIELD', $array, (empty($conf->global->TAKEPOS_SORTPRODUCTFIELD)?'rowid':$conf->global->TAKEPOS_SORTPRODUCTFIELD), 0); +print "\n"; + $substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2); $substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); $htmltext = ''.$langs->trans("AvailableVariables").':
'; diff --git a/htdocs/takepos/ajax.php b/htdocs/takepos/ajax.php index f889615660e..415f6c6f680 100644 --- a/htdocs/takepos/ajax.php +++ b/htdocs/takepos/ajax.php @@ -45,11 +45,7 @@ $term = GETPOST('term', 'alpha'); if ($action=="getProducts") { $object = new Categorie($db); $result=$object->fetch($category); - $prods = $object->getObjectsInCateg("product"); - function sort_by_ref($a, $b) { - return strcmp($a->ref, $b->ref); - } - usort($prods, "sort_by_ref"); + $prods = $object->getObjectsInCateg("product", 0, $conf->global->TAKEPOS_SORTPRODUCTFIELD); echo json_encode($prods); } elseif ($action=="search" && $term != '') { From b6c9de39289d191ea82b2e9733dd63ec330ebc4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 17 Dec 2019 14:49:18 +0100 Subject: [PATCH 067/784] upload odt models for order --- .../modules/commande/doc/doc_generic_order_odt.modules.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 794e7c57a29..b753f323023 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -118,7 +118,7 @@ class doc_generic_order_odt extends ModelePDFCommandes $form = new Form($this->db); $texte = $this->description.".
\n"; - $texte .= '
'; + $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; @@ -177,6 +177,11 @@ class doc_generic_order_odt extends ModelePDFCommandes } $texte .= '
'; } + // Add select to upload a new template file. TODO Copy this feature on other admin pages. + $texte.= '
'.$langs->trans("UploadNewTemplate").' '; + $texte.= ''; + $texte.= ''; + $texte.= '
'; $texte .= ''; From 3d19e1321bbe3b6f7e22c6e0cfc903e1a839add9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 19 Dec 2019 11:10:55 +0100 Subject: [PATCH 068/784] NEW upload odt models for proposal --- .../propale/doc/doc_generic_proposal_odt.modules.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index b955da102ab..b4b3d2fb3e0 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -2,7 +2,7 @@ /* Copyright (C) 2010-2012 Laurent Destailleur * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2016 Charlie Benke - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2019 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 @@ -115,7 +115,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales $form = new Form($this->db); $texte = $this->description.".
\n"; - $texte .= ''; + $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; @@ -205,7 +205,11 @@ class doc_generic_proposal_odt extends ModelePDFPropales $texte .= ''; } } - + // Add select to upload a new template file. TODO Copy this feature on other admin pages. + $texte .= '
'.$langs->trans("UploadNewTemplate").' '; + $texte .= ''; + $texte .= ''; + $texte .= '
'; $texte .= ''; $texte .= ''; From 7359c4140d7a5615a68ae44c9c43654e0e8fdf0d Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Tue, 24 Dec 2019 09:54:02 +0100 Subject: [PATCH 069/784] FIX 12.0 - bookmark URLs get truncated to 255 chars - PR rescheduled for merging into the next major version (v12.0) --- .../install/mysql/migration/10.0.0-11.0.0.sql | 4 --- .../install/mysql/migration/11.0.0-12.0.0.sql | 34 +++++++++++++++++++ 2 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 htdocs/install/mysql/migration/11.0.0-12.0.0.sql diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index d6e34030408..4bacfa9b765 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -545,7 +545,3 @@ ALTER TABLE llx_mrp_production ADD INDEX idx_mrp_production_fk_mo (fk_mo); ALTER TABLE llx_emailcollector_emailcollector ADD UNIQUE INDEX uk_emailcollector_emailcollector_ref(ref, entity); ALTER TABLE llx_website ADD COLUMN use_manifest integer; - -ALTER TABLE llx_bookmark DROP INDEX uk_bookmark_url; -ALTER TABLE llx_bookmark MODIFY COLUMN url TEXT; -- change from VARCHAR(255) to allow longer URLs -ALTER TABLE llx_bookmark ADD UNIQUE uk_bookmark_title (fk_user, title); diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql new file mode 100644 index 00000000000..7062ac5d58b --- /dev/null +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -0,0 +1,34 @@ +-- +-- Be careful with the order of the requests. +-- This file must be loaded by calling /install/index.php page +-- when current version is 12.0.0 or higher. +-- +-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y +-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y +-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; +-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; +-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); +-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; +-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); +-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; +-- To create a unique index ALTER TABLE llx_table ADD UNIQUE INDEX uk_table_field (field); +-- To drop an index: -- VMYSQL4.1 DROP INDEX nomindex on llx_table +-- To drop an index: -- VPGSQL8.2 DROP INDEX nomindex +-- To make pk to be auto increment (mysql): -- VMYSQL4.3 ALTER TABLE llx_table CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; +-- To make pk to be auto increment (postgres): +-- -- VPGSQL8.2 CREATE SEQUENCE llx_table_rowid_seq OWNED BY llx_table.rowid; +-- -- VPGSQL8.2 ALTER TABLE llx_table ADD PRIMARY KEY (rowid); +-- -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN rowid SET DEFAULT nextval('llx_table_rowid_seq'); +-- -- VPGSQL8.2 SELECT setval('llx_table_rowid_seq', MAX(rowid)) FROM llx_table; +-- To set a field as NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NULL; +-- To set a field as NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL; +-- To set a field as NOT NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NOT NULL; +-- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL; +-- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL; +-- Note: fields with type BLOB/TEXT can't have a default value. + +-- Missing in v11 +ALTER TABLE llx_bookmark DROP INDEX uk_bookmark_url; +ALTER TABLE llx_bookmark MODIFY COLUMN url TEXT; -- change from VARCHAR(255) to allow longer URLs +ALTER TABLE llx_bookmark ADD UNIQUE uk_bookmark_title (fk_user, title); + From 23b4e3ad6d601b25e3cb414bf8f95df39862b714 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Thu, 26 Dec 2019 09:50:15 +0100 Subject: [PATCH 070/784] FIX resolve conflicts --- htdocs/comm/propal/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index b5a0d1d72aa..b3d915e3985 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -273,7 +273,7 @@ $sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.c $sql.= " typent.code as typent_code,"; $sql.= " ava.rowid as availability,"; $sql.= " state.code_departement as state_code, state.nom as state_name,"; -$sql.= ' p.rowid, p.entity, p.note_private, p.note_public, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,'; +$sql .= " p.rowid, p.entity, p.note_private, p.note_public, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,"; $sql.= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,'; $sql.= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,"; $sql.= ' u.login'; @@ -764,8 +764,8 @@ if ($resql) $objectstatic->id=$obj->rowid; $objectstatic->ref=$obj->ref; - $objectstatic->note_private=$obj->note_private; - $objectstatic->note_public=$obj->note_public; + $objectstatic->note_private = $obj->note_private; + $objectstatic->note_public = $obj->note_public; $companystatic->id=$obj->socid; $companystatic->name=$obj->name; From bf1bf10a536d361e1a3c5097ec4b8c887ae36d13 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Thu, 26 Dec 2019 09:56:35 +0100 Subject: [PATCH 071/784] FIX resolve conflicts --- htdocs/comm/propal/list.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index b3d915e3985..1f462d6a205 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -269,14 +269,14 @@ $help_url='EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'; $sql = 'SELECT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; -$sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; -$sql.= " typent.code as typent_code,"; -$sql.= " ava.rowid as availability,"; -$sql.= " state.code_departement as state_code, state.nom as state_name,"; +$sql .= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; +$sql .= " typent.code as typent_code,"; +$sql .= " ava.rowid as availability,"; +$sql .= " state.code_departement as state_code, state.nom as state_name,"; $sql .= " p.rowid, p.entity, p.note_private, p.note_public, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,"; -$sql.= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,'; -$sql.= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,"; -$sql.= ' u.login'; +$sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,'; +$sql .= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,"; +$sql .= ' u.login'; if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user"; if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc"; // Add fields from extrafields @@ -762,8 +762,8 @@ if ($resql) { $obj = $db->fetch_object($resql); - $objectstatic->id=$obj->rowid; - $objectstatic->ref=$obj->ref; + $objectstatic->id = $obj->rowid; + $objectstatic->ref = $obj->ref; $objectstatic->note_private = $obj->note_private; $objectstatic->note_public = $obj->note_public; From 046aba8abd7325962c0a1ca501a2ba00a05b8fab Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Thu, 26 Dec 2019 10:14:05 +0100 Subject: [PATCH 072/784] FIX indented errors --- htdocs/comm/propal/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 7716cf2a96e..e307d8727f4 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -764,8 +764,8 @@ if ($resql) $objectstatic->id = $obj->rowid; $objectstatic->ref = $obj->ref; - $objectstatic->note_private = $obj->note_private; - $objectstatic->note_public = $obj->note_public; + $objectstatic->note_private = $obj->note_private; + $objectstatic->note_public = $obj->note_public; $companystatic->id = $obj->socid; $companystatic->name = $obj->name; From 811adad8c81f117bfbf6d75586f07d6650310a51 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Thu, 26 Dec 2019 10:34:10 +0100 Subject: [PATCH 073/784] FIX notice var nbfield of array not initialized --- htdocs/projet/list.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 2f7e30641b7..15464de2f9c 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -701,8 +701,10 @@ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $ print "\n"; $i = 0; -$totalarray = array(); -$totalarray['val'] = array(); +$totalarray = array( + 'nbfield' => 0, + 'val' => array(), +); while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); From 5b1ae96ce9878def8998eafe6a8c9a8c0c596605 Mon Sep 17 00:00:00 2001 From: Guillaume Matheron Date: Sun, 29 Dec 2019 20:45:30 +0100 Subject: [PATCH 074/784] Added two new options when billing time spent on a project : - Create one invoice line per timespent entry - Create one invoice line per task --- htdocs/projet/tasks/time.php | 160 +++++++++++++++++++++++++++-------- 1 file changed, 125 insertions(+), 35 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 8e7856759a7..af37e3bfa5f 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -342,6 +342,8 @@ if ($action == 'confirm_generateinvoice') $db->begin(); $idprod = GETPOST('productid', 'int'); + $generateinvoicemode = GETPOST('generateinvoicemode', 'string'); + if ($idprod > 0) { $tmpproduct->fetch($idprod); @@ -373,45 +375,132 @@ if ($action == 'confirm_generateinvoice') if (!$error) { - $arrayoftasks = array(); - foreach ($toselect as $key => $value) - { - // Get userid, timepent - $object->fetchTimeSpent($value); - $arrayoftasks[$object->timespent_fk_user]['timespent'] += $object->timespent_duration; - $arrayoftasks[$object->timespent_fk_user]['totalvaluetodivideby3600'] += ($object->timespent_duration * $object->timespent_thm); - } + if ($generateinvoicemode=='onelineperuser') { + $arrayoftasks = array(); + foreach ($toselect as $key => $value) + { + // Get userid, timepent + $object->fetchTimeSpent($value); + $arrayoftasks[$object->timespent_fk_user]['timespent'] += $object->timespent_duration; + $arrayoftasks[$object->timespent_fk_user]['totalvaluetodivideby3600'] += ($object->timespent_duration * $object->timespent_thm); + } - foreach ($arrayoftasks as $userid => $value) - { - $fuser->fetch($userid); - //$pu_ht = $value['timespent'] * $fuser->thm; - $username = $fuser->getFullName($langs); + foreach ($arrayoftasks as $userid => $value) + { + $fuser->fetch($userid); + //$pu_ht = $value['timespent'] * $fuser->thm; + $username = $fuser->getFullName($langs); - // Define qty per hour - $qtyhour = round($value['timespent'] / 3600, 2); - $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); + // Define qty per hour + $qtyhour = round($value['timespent'] / 3600, 2); + $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); - // If no unit price known - if (empty($pu_ht)) - { - $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); - } + // If no unit price known + if (empty($pu_ht)) + { + $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); + } - // Add lines - $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + // Add lines + $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); - // Update lineid into line of timespent - $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; - $sql .= ' WHERE rowid in ('.join(',', $toselect).') AND fk_user = '.$userid; - $result = $db->query($sql); - if (!$result) - { - $error++; - setEventMessages($db->lasterror(), null, 'errors'); - break; - } - } + // Update lineid into line of timespent + $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; + $sql .= ' WHERE rowid in ('.join(',', $toselect).') AND fk_user = '.$userid; + $result = $db->query($sql); + if (!$result) + { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + break; + } + } + } + elseif ($generateinvoicemode=='onelineperperiod') { + $arrayoftasks = array(); + foreach ($toselect as $key => $value) + { + // Get userid, timepent + $object->fetchTimeSpent($value); + $arrayoftasks[$object->timespent_id]['timespent'] = $object->timespent_duration; + $arrayoftasks[$object->timespent_id]['totalvaluetodivideby3600'] = $object->timespent_duration * $object->timespent_thm; + $arrayoftasks[$object->timespent_id]['note'] = $object->timespent_note; + $arrayoftasks[$object->timespent_id]['user'] = $object->timespent_fk_user; + } + + foreach ($arrayoftasks as $timespent_id => $value) + { + $userid = $value['user']; + $fuser->fetch($userid); + //$pu_ht = $value['timespent'] * $fuser->thm; + $username = $fuser->getFullName($langs); + + // Define qty per hour + $qtyhour = round($value['timespent'] / 3600, 2); + $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); + + // If no unit price known + if (empty($pu_ht)) + { + $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); + } + + // Add lines + $lineid = $tmpinvoice->addline($value['note'], $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + + // Update lineid into line of timespent + $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; + $sql .= ' WHERE rowid in ('.join(',', $toselect).') AND fk_user = '.$userid; + $result = $db->query($sql); + if (!$result) + { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + break; + } + } + } + elseif ($generateinvoicemode=='onelinepertask') { + $arrayoftasks = array(); + foreach ($toselect as $key => $value) + { + // Get userid, timepent + $object->fetchTimeSpent($value); + // $object->id is the task id + $arrayoftasks[$object->id]['timespent'] += $object->timespent_duration; + $arrayoftasks[$object->id]['totalvaluetodivideby3600'] += $object->timespent_duration * $object->timespent_thm; + } + + foreach ($arrayoftasks as $task_id => $value) + { + $ftask = new Task($db); + $ftask->fetch($task_id); + // Define qty per hour + $qtyhour = round($value['timespent'] / 3600, 2); + $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); + + // If no unit price known + if (empty($pu_ht)) + { + $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); + } + + // Add lines + $lineName = $ftask->ref.' - '.$ftask->label; + $lineid = $tmpinvoice->addline($lineName, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + + // Update lineid into line of timespent + $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; + $sql .= ' WHERE rowid in ('.join(',', $toselect).')'; + $result = $db->query($sql); + if (!$result) + { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + break; + } + } + } } if (!$error) @@ -841,7 +930,8 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) print ''; $tmparray = array( 'onelineperuser'=>'OneLinePerUser', - //'onelinepertask'=>'OneLinePerTask', + 'onelinepertask'=>'OneLinePerTask', + 'onelineperperiod'=>'OneLinePerPeriod', ); print $form->selectarray('generateinvoicemode', $tmparray, 'onelineperuser', 0, 0, 0, '', 1); print ''; From 84d8ca4b332ecb30ab95a99e4432af1cbb0c6406 Mon Sep 17 00:00:00 2001 From: Guillaume Matheron Date: Sun, 29 Dec 2019 20:47:18 +0100 Subject: [PATCH 075/784] Made spaces/tab usage more consistent --- htdocs/projet/tasks/time.php | 1868 +++++++++++++++++----------------- 1 file changed, 934 insertions(+), 934 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index af37e3bfa5f..98bd7523605 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -4,7 +4,7 @@ * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2018 Ferran Marcet - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018 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 @@ -21,9 +21,9 @@ */ /** - * \file htdocs/projet/tasks/time.php - * \ingroup project - * \brief Page to add new time spent on a task + * \file htdocs/projet/tasks/time.php + * \ingroup project + * \brief Page to add new time spent on a task */ require '../../main.inc.php'; @@ -38,18 +38,18 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; // Load translation files required by the page $langs->loadLangs(array('projects', 'bills', 'orders')); -$action = GETPOST('action', 'alpha'); +$action = GETPOST('action', 'alpha'); $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) -$confirm = GETPOST('confirm', 'alpha'); -$cancel = GETPOST('cancel', 'alpha'); -$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list +$confirm = GETPOST('confirm', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page -$optioncss = GETPOST('optioncss', 'alpha'); +$optioncss = GETPOST('optioncss', 'alpha'); -$id = GETPOST('id', 'int'); -$projectid = GETPOST('projectid', 'int'); -$ref = GETPOST('ref', 'alpha'); +$id = GETPOST('id', 'int'); +$projectid = GETPOST('projectid', 'int'); +$ref = GETPOST('ref', 'alpha'); $withproject = GETPOST('withproject', 'int'); $project_ref = GETPOST('project_ref', 'alpha'); @@ -68,14 +68,14 @@ $search_valuebilled = GETPOST('search_valuebilled', 'int'); // Security check $socid = 0; -//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. +//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. if (!$user->rights->projet->lire) accessforbidden(); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); $page = GETPOST("page", 'int'); -if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -113,20 +113,20 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_month = ''; $search_year = ''; $search_date = ''; - $search_datehour = ''; - $search_datewithhour = ''; - $search_note = ''; - $search_duration = ''; - $search_value = ''; - $search_date_creation = ''; - $search_date_update = ''; - $search_task_ref = ''; - $search_task_label = ''; - $search_user = 0; - $search_valuebilled = ''; - $toselect = ''; - $search_array_options = array(); - $action = ''; + $search_datehour = ''; + $search_datewithhour = ''; + $search_note = ''; + $search_duration = ''; + $search_value = ''; + $search_date_creation = ''; + $search_date_update = ''; + $search_task_ref = ''; + $search_task_label = ''; + $search_user = 0; + $search_valuebilled = ''; + $toselect = ''; + $search_array_options = array(); + $action = ''; } if ($action == 'addtimespent' && $user->rights->projet->lire) @@ -149,61 +149,61 @@ if ($action == 'addtimespent' && $user->rights->projet->lire) if (!$error) { - if ($id || $ref) + if ($id || $ref) { $object->fetch($id, $ref); } else { - if (!GETPOST('taskid', 'int') || GETPOST('taskid', 'int') < 0) - { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Task")), null, 'errors'); - $action = 'createtime'; - $error++; - } - else - { - $object->fetch(GETPOST('taskid', 'int')); - } + if (!GETPOST('taskid', 'int') || GETPOST('taskid', 'int') < 0) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Task")), null, 'errors'); + $action = 'createtime'; + $error++; + } + else + { + $object->fetch(GETPOST('taskid', 'int')); + } } if (!$error) { - $object->fetch_projet(); + $object->fetch_projet(); - if (empty($object->project->statut)) - { - setEventMessages($langs->trans("ProjectMustBeValidatedFirst"), null, 'errors'); - $action = 'createtime'; - $error++; - } - else - { - $object->timespent_note = $_POST["timespent_note"]; - if (GETPOST('progress', 'int') > 0) $object->progress = GETPOST('progress', 'int'); // If progress is -1 (not defined), we do not change value - $object->timespent_duration = $_POST["timespent_durationhour"] * 60 * 60; // We store duration in seconds - $object->timespent_duration += ($_POST["timespent_durationmin"] ? $_POST["timespent_durationmin"] : 0) * 60; // We store duration in seconds - if (GETPOST("timehour") != '' && GETPOST("timehour") >= 0) // If hour was entered - { - $object->timespent_date = dol_mktime(GETPOST("timehour"), GETPOST("timemin"), 0, GETPOST("timemonth"), GETPOST("timeday"), GETPOST("timeyear")); - $object->timespent_withhour = 1; - } - else - { - $object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timemonth"), GETPOST("timeday"), GETPOST("timeyear")); - } - $object->timespent_fk_user = $_POST["userid"]; - $result = $object->addTimeSpent($user); - if ($result >= 0) - { - setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans($object->error), null, 'errors'); - $error++; - } - } + if (empty($object->project->statut)) + { + setEventMessages($langs->trans("ProjectMustBeValidatedFirst"), null, 'errors'); + $action = 'createtime'; + $error++; + } + else + { + $object->timespent_note = $_POST["timespent_note"]; + if (GETPOST('progress', 'int') > 0) $object->progress = GETPOST('progress', 'int'); // If progress is -1 (not defined), we do not change value + $object->timespent_duration = $_POST["timespent_durationhour"] * 60 * 60; // We store duration in seconds + $object->timespent_duration += ($_POST["timespent_durationmin"] ? $_POST["timespent_durationmin"] : 0) * 60; // We store duration in seconds + if (GETPOST("timehour") != '' && GETPOST("timehour") >= 0) // If hour was entered + { + $object->timespent_date = dol_mktime(GETPOST("timehour"), GETPOST("timemin"), 0, GETPOST("timemonth"), GETPOST("timeday"), GETPOST("timeyear")); + $object->timespent_withhour = 1; + } + else + { + $object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timemonth"), GETPOST("timeday"), GETPOST("timeyear")); + } + $object->timespent_fk_user = $_POST["userid"]; + $result = $object->addTimeSpent($user); + if ($result >= 0) + { + setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans($object->error), null, 'errors'); + $error++; + } + } } } else @@ -233,12 +233,12 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$_POST["cancel $object->timespent_old_duration = $_POST["old_duration"]; $object->timespent_duration = $_POST["new_durationhour"] * 60 * 60; // We store duration in seconds $object->timespent_duration += $_POST["new_durationmin"] * 60; // We store duration in seconds - if (GETPOST("timelinehour") != '' && GETPOST("timelinehour") >= 0) // If hour was entered - { + if (GETPOST("timelinehour") != '' && GETPOST("timelinehour") >= 0) // If hour was entered + { $object->timespent_date = dol_mktime(GETPOST("timelinehour"), GETPOST("timelinemin"), 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); $object->timespent_withhour = 1; - } - else + } + else { $object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); } @@ -305,24 +305,24 @@ if (GETPOST('projectid', 'int') > 0) $projectidforalltimes = GETPOST('projectid', 'int'); $result = $projectstatic->fetch($projectidforalltimes); - if (!empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); - $res = $projectstatic->fetch_optionals(); + if (!empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); + $res = $projectstatic->fetch_optionals(); } elseif (GETPOST('project_ref', 'alpha')) { - $projectstatic->fetch(0, GETPOST('project_ref', 'alpha')); - $projectidforalltimes = $projectstatic->id; - $withproject = 1; + $projectstatic->fetch(0, GETPOST('project_ref', 'alpha')); + $projectidforalltimes = $projectstatic->id; + $withproject = 1; } elseif ($id > 0) { - $object->fetch($id); - $result = $projectstatic->fetch($object->fk_project); + $object->fetch($id); + $result = $projectstatic->fetch($object->fk_project); } if ($action == 'confirm_generateinvoice') { - if (!empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); + if (!empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); if (!($projectstatic->thirdparty->id > 0)) @@ -356,10 +356,10 @@ if ($action == 'confirm_generateinvoice') } else { - $pu_ht = 0; - $txtva = get_default_tva($mysoc, $projectstatic->thirdparty); - $localtax1 = get_default_localtax($mysoc, $projectstatic->thirdparty, 1); - $localtax2 = get_default_localtax($mysoc, $projectstatic->thirdparty, 2); + $pu_ht = 0; + $txtva = get_default_tva($mysoc, $projectstatic->thirdparty); + $localtax1 = get_default_localtax($mysoc, $projectstatic->thirdparty, 1); + $localtax2 = get_default_localtax($mysoc, $projectstatic->thirdparty, 2); } $tmpinvoice->socid = $projectstatic->thirdparty->id; @@ -369,147 +369,147 @@ if ($action == 'confirm_generateinvoice') $result = $tmpinvoice->create($user); if ($result <= 0) { - $error++; - setEventMessages($tmpinvoice->error, $tmpinvoice->errors, 'errors'); + $error++; + setEventMessages($tmpinvoice->error, $tmpinvoice->errors, 'errors'); } if (!$error) { - if ($generateinvoicemode=='onelineperuser') { + if ($generateinvoicemode=='onelineperuser') { $arrayoftasks = array(); foreach ($toselect as $key => $value) { - // Get userid, timepent - $object->fetchTimeSpent($value); - $arrayoftasks[$object->timespent_fk_user]['timespent'] += $object->timespent_duration; - $arrayoftasks[$object->timespent_fk_user]['totalvaluetodivideby3600'] += ($object->timespent_duration * $object->timespent_thm); + // Get userid, timepent + $object->fetchTimeSpent($value); + $arrayoftasks[$object->timespent_fk_user]['timespent'] += $object->timespent_duration; + $arrayoftasks[$object->timespent_fk_user]['totalvaluetodivideby3600'] += ($object->timespent_duration * $object->timespent_thm); } foreach ($arrayoftasks as $userid => $value) { - $fuser->fetch($userid); - //$pu_ht = $value['timespent'] * $fuser->thm; - $username = $fuser->getFullName($langs); + $fuser->fetch($userid); + //$pu_ht = $value['timespent'] * $fuser->thm; + $username = $fuser->getFullName($langs); - // Define qty per hour - $qtyhour = round($value['timespent'] / 3600, 2); - $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); + // Define qty per hour + $qtyhour = round($value['timespent'] / 3600, 2); + $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); - // If no unit price known - if (empty($pu_ht)) - { - $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); - } + // If no unit price known + if (empty($pu_ht)) + { + $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); + } - // Add lines - $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + // Add lines + $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); - // Update lineid into line of timespent - $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; - $sql .= ' WHERE rowid in ('.join(',', $toselect).') AND fk_user = '.$userid; - $result = $db->query($sql); - if (!$result) - { - $error++; - setEventMessages($db->lasterror(), null, 'errors'); - break; - } + // Update lineid into line of timespent + $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; + $sql .= ' WHERE rowid in ('.join(',', $toselect).') AND fk_user = '.$userid; + $result = $db->query($sql); + if (!$result) + { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + break; + } } - } - elseif ($generateinvoicemode=='onelineperperiod') { + } + elseif ($generateinvoicemode=='onelineperperiod') { $arrayoftasks = array(); foreach ($toselect as $key => $value) { - // Get userid, timepent - $object->fetchTimeSpent($value); - $arrayoftasks[$object->timespent_id]['timespent'] = $object->timespent_duration; - $arrayoftasks[$object->timespent_id]['totalvaluetodivideby3600'] = $object->timespent_duration * $object->timespent_thm; - $arrayoftasks[$object->timespent_id]['note'] = $object->timespent_note; - $arrayoftasks[$object->timespent_id]['user'] = $object->timespent_fk_user; + // Get userid, timepent + $object->fetchTimeSpent($value); + $arrayoftasks[$object->timespent_id]['timespent'] = $object->timespent_duration; + $arrayoftasks[$object->timespent_id]['totalvaluetodivideby3600'] = $object->timespent_duration * $object->timespent_thm; + $arrayoftasks[$object->timespent_id]['note'] = $object->timespent_note; + $arrayoftasks[$object->timespent_id]['user'] = $object->timespent_fk_user; } foreach ($arrayoftasks as $timespent_id => $value) { - $userid = $value['user']; - $fuser->fetch($userid); - //$pu_ht = $value['timespent'] * $fuser->thm; - $username = $fuser->getFullName($langs); + $userid = $value['user']; + $fuser->fetch($userid); + //$pu_ht = $value['timespent'] * $fuser->thm; + $username = $fuser->getFullName($langs); - // Define qty per hour - $qtyhour = round($value['timespent'] / 3600, 2); - $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); + // Define qty per hour + $qtyhour = round($value['timespent'] / 3600, 2); + $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); - // If no unit price known - if (empty($pu_ht)) - { - $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); - } + // If no unit price known + if (empty($pu_ht)) + { + $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); + } - // Add lines - $lineid = $tmpinvoice->addline($value['note'], $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + // Add lines + $lineid = $tmpinvoice->addline($value['note'], $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); - // Update lineid into line of timespent - $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; - $sql .= ' WHERE rowid in ('.join(',', $toselect).') AND fk_user = '.$userid; - $result = $db->query($sql); - if (!$result) - { - $error++; - setEventMessages($db->lasterror(), null, 'errors'); - break; - } + // Update lineid into line of timespent + $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; + $sql .= ' WHERE rowid in ('.join(',', $toselect).') AND fk_user = '.$userid; + $result = $db->query($sql); + if (!$result) + { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + break; + } } - } - elseif ($generateinvoicemode=='onelinepertask') { + } + elseif ($generateinvoicemode=='onelinepertask') { $arrayoftasks = array(); foreach ($toselect as $key => $value) { - // Get userid, timepent - $object->fetchTimeSpent($value); - // $object->id is the task id - $arrayoftasks[$object->id]['timespent'] += $object->timespent_duration; - $arrayoftasks[$object->id]['totalvaluetodivideby3600'] += $object->timespent_duration * $object->timespent_thm; + // Get userid, timepent + $object->fetchTimeSpent($value); + // $object->id is the task id + $arrayoftasks[$object->id]['timespent'] += $object->timespent_duration; + $arrayoftasks[$object->id]['totalvaluetodivideby3600'] += $object->timespent_duration * $object->timespent_thm; } foreach ($arrayoftasks as $task_id => $value) { - $ftask = new Task($db); - $ftask->fetch($task_id); - // Define qty per hour - $qtyhour = round($value['timespent'] / 3600, 2); - $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); + $ftask = new Task($db); + $ftask->fetch($task_id); + // Define qty per hour + $qtyhour = round($value['timespent'] / 3600, 2); + $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); - // If no unit price known - if (empty($pu_ht)) - { - $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); - } + // If no unit price known + if (empty($pu_ht)) + { + $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); + } - // Add lines - $lineName = $ftask->ref.' - '.$ftask->label; - $lineid = $tmpinvoice->addline($lineName, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + // Add lines + $lineName = $ftask->ref.' - '.$ftask->label; + $lineid = $tmpinvoice->addline($lineName, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); - // Update lineid into line of timespent - $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; - $sql .= ' WHERE rowid in ('.join(',', $toselect).')'; - $result = $db->query($sql); - if (!$result) - { - $error++; - setEventMessages($db->lasterror(), null, 'errors'); - break; - } + // Update lineid into line of timespent + $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; + $sql .= ' WHERE rowid in ('.join(',', $toselect).')'; + $result = $db->query($sql); + if (!$result) + { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + break; + } } - } + } } if (!$error) { - $urltoinvoice = $tmpinvoice->getNomUrl(0); - setEventMessages($langs->trans("InvoiceGeneratedFromTimeSpent", $urltoinvoice), null, 'mesgs'); - //var_dump($tmpinvoice); + $urltoinvoice = $tmpinvoice->getNomUrl(0); + setEventMessages($langs->trans("InvoiceGeneratedFromTimeSpent", $urltoinvoice), null, 'mesgs'); + //var_dump($tmpinvoice); - $db->commit(); + $db->commit(); } else { @@ -536,14 +536,14 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) { /* * Fiche projet en mode visu - */ - if ($projectidforalltimes > 0) - { - $result = $projectstatic->fetch($projectidforalltimes); - if (!empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); - $res = $projectstatic->fetch_optionals(); - } - elseif ($object->fetch($id, $ref) >= 0) + */ + if ($projectidforalltimes > 0) + { + $result = $projectstatic->fetch($projectidforalltimes); + if (!empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); + $res = $projectstatic->fetch_optionals(); + } + elseif ($object->fetch($id, $ref) >= 0) { if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments(); $result = $projectstatic->fetch($object->fk_project); @@ -552,10 +552,10 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) $res = $projectstatic->fetch_optionals(); $object->project = clone $projectstatic; - } + } - $userRead = $projectstatic->restrictedProjectArea($user, 'read'); - $linktocreatetime = ''; + $userRead = $projectstatic->restrictedProjectArea($user, 'read'); + $linktocreatetime = ''; if ($projectstatic->id > 0) { @@ -571,122 +571,122 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) // Project card - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; - $morehtmlref = '
'; - // Title - $morehtmlref .= $projectstatic->title; - // Thirdparty - if ($projectstatic->thirdparty->id > 0) - { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); - } - $morehtmlref .= '
'; + $morehtmlref = '
'; + // Title + $morehtmlref .= $projectstatic->title; + // Thirdparty + if ($projectstatic->thirdparty->id > 0) + { + $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); + } + $morehtmlref .= '
'; - // Define a complementary filter for search of next/prev ref. - if (!$user->rights->projet->all->lire) - { - $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = " rowid in (".(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; - } + // Define a complementary filter for search of next/prev ref. + if (!$user->rights->projet->all->lire) + { + $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); + $projectstatic->next_prev_filter = " rowid in (".(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; + } - dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - print '
'; - print '
'; - print '
'; + print '
'; + print '
'; + print '
'; - print ''; + print '
'; - // Usage - print ''; - print ''; + // Usage + print ''; + print ''; - // Visibility - print ''; + // Visibility + print ''; - // Date start - end - print ''; + // Date start - end + print ''; - // Budget - print ''; + // Budget + print ''; - // Other attributes - $cols = 2; - //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + // Other attributes + $cols = 2; + //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; - print '
'; - print $langs->trans("Usage"); - print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) - { - print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowOpportunity"); - print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); - print '
'; - } - if (empty($conf->global->PROJECT_HIDE_TASKS)) - { - print 'usage_task ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowTasks"); - print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); - print '
'; - } - if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) - { - print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectBillTimeDescription"); - print $form->textwithpicto($langs->trans("BillTime"), $htmltext); - print '
'; - } - print '
'; + print $langs->trans("Usage"); + print ''; + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + print 'usage_task ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + print '
'.$langs->trans("Visibility").''; - if ($projectstatic->public) print $langs->trans('SharedProject'); - else print $langs->trans('PrivateProject'); - print '
'.$langs->trans("Visibility").''; + if ($projectstatic->public) print $langs->trans('SharedProject'); + else print $langs->trans('PrivateProject'); + print '
'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; - $start = dol_print_date($projectstatic->date_start, 'day'); - print ($start ? $start : '?'); - $end = dol_print_date($projectstatic->date_end, 'day'); - print ' - '; - print ($end ? $end : '?'); - if ($projectstatic->hasDelay()) print img_warning("Late"); - print '
'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + $start = dol_print_date($projectstatic->date_start, 'day'); + print ($start ? $start : '?'); + $end = dol_print_date($projectstatic->date_end, 'day'); + print ' - '; + print ($end ? $end : '?'); + if ($projectstatic->hasDelay()) print img_warning("Late"); + print '
'.$langs->trans("Budget").''; - if (strcmp($projectstatic->budget_amount, '')) print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency); - print '
'.$langs->trans("Budget").''; + if (strcmp($projectstatic->budget_amount, '')) print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency); + print '
'; + print ''; - print '
'; - print '
'; - print '
'; - print '
'; + print '
'; + print '
'; + print '
'; + print '
'; - print ''; + print '
'; - // Description - print ''; + // Description + print ''; - // Bill time - if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) - { - print ''; - } + // Bill time + if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print ''; + } - // Categories - if ($conf->categorie->enabled) { - print '"; - } + // Categories + if ($conf->categorie->enabled) { + print '"; + } - print '
'.$langs->trans("Description").''; - print nl2br($projectstatic->description); - print '
'.$langs->trans("Description").''; + print nl2br($projectstatic->description); + print '
'.$langs->trans("BillTime").''; - print yn($projectstatic->usage_bill_time); - print '
'.$langs->trans("BillTime").''; + print yn($projectstatic->usage_bill_time); + print '
'.$langs->trans("Categories").''; - print $form->showCategories($projectstatic->id, 'project', 1); - print "
'.$langs->trans("Categories").''; + print $form->showCategories($projectstatic->id, 'project', 1); + print "
'; + print ''; - print '
'; - print '
'; - print '
'; + print '
'; + print '
'; + print '
'; - print '
'; + print '
'; dol_fiche_end(); @@ -694,46 +694,46 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) } // Link to create time - $linktocreatetimeBtnStatus = 0; - $linktocreatetimeUrl = ''; - $linktocreatetimeHelpText = ''; - if ($user->rights->projet->all->lire || $user->rights->projet->lire) // To enter time, read permission is enough + $linktocreatetimeBtnStatus = 0; + $linktocreatetimeUrl = ''; + $linktocreatetimeHelpText = ''; + if ($user->rights->projet->all->lire || $user->rights->projet->lire) // To enter time, read permission is enough { if ($projectstatic->public || $userRead > 0) - { - $linktocreatetimeBtnStatus = 1; + { + $linktocreatetimeBtnStatus = 1; - if (!empty($projectidforalltimes)) // We are on tab 'Time Spent' of project - { - $backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject ? '&withproject=1' : ''); - $linktocreatetimeUrl = $_SERVER['PHP_SELF'].'?'.($withproject ? 'withproject=1' : '').'&projectid='.$projectstatic->id.'&action=createtime'.$param.'&backtopage='.urlencode($backtourl); - } - else // We are on tab 'Time Spent' of task - { - $backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject ? '&withproject=1' : ''); - $linktocreatetimeUrl = $_SERVER['PHP_SELF'].'?'.($withproject ? 'withproject=1' : '').($object->id > 0 ? '&id='.$object->id : '&projectid='.$projectstatic->id).'&action=createtime'.$param.'&backtopage='.urlencode($backtourl); - } - } - else - { - $linktocreatetimeBtnStatus = -2; - $linktocreatetimeHelpText = $langs->trans("NotOwnerOfProject"); - } + if (!empty($projectidforalltimes)) // We are on tab 'Time Spent' of project + { + $backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject ? '&withproject=1' : ''); + $linktocreatetimeUrl = $_SERVER['PHP_SELF'].'?'.($withproject ? 'withproject=1' : '').'&projectid='.$projectstatic->id.'&action=createtime'.$param.'&backtopage='.urlencode($backtourl); + } + else // We are on tab 'Time Spent' of task + { + $backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject ? '&withproject=1' : ''); + $linktocreatetimeUrl = $_SERVER['PHP_SELF'].'?'.($withproject ? 'withproject=1' : '').($object->id > 0 ? '&id='.$object->id : '&projectid='.$projectstatic->id).'&action=createtime'.$param.'&backtopage='.urlencode($backtourl); + } + } + else + { + $linktocreatetimeBtnStatus = -2; + $linktocreatetimeHelpText = $langs->trans("NotOwnerOfProject"); + } } - $linktocreatetime = dolGetButtonTitle($langs->trans('AddTimeSpent'), $linktocreatetimeHelpText, 'fa fa-plus-circle', $linktocreatetimeUrl, '', $linktocreatetimeBtnStatus); - } + $linktocreatetime = dolGetButtonTitle($langs->trans('AddTimeSpent'), $linktocreatetimeHelpText, 'fa fa-plus-circle', $linktocreatetimeUrl, '', $linktocreatetimeBtnStatus); + } $massactionbutton = ''; if ($projectstatic->usage_bill_time) { - $arrayofmassactions = array( - 'generateinvoice'=>$langs->trans("GenerateBill"), - //'builddoc'=>$langs->trans("PDFMerge"), - ); - //if ($user->rights->projet->creer) $arrayofmassactions['predelete']=''.$langs->trans("Delete"); - if (in_array($massaction, array('presend', 'predelete', 'generateinvoice'))) $arrayofmassactions = array(); - $massactionbutton = $form->selectMassAction('', $arrayofmassactions); + $arrayofmassactions = array( + 'generateinvoice'=>$langs->trans("GenerateBill"), + //'builddoc'=>$langs->trans("PDFMerge"), + ); + //if ($user->rights->projet->creer) $arrayofmassactions['predelete']=''.$langs->trans("Delete"); + if (in_array($massaction, array('presend', 'predelete', 'generateinvoice'))) $arrayofmassactions = array(); + $massactionbutton = $form->selectMassAction('', $arrayofmassactions); } // Show section with information of task. If id of task is not defined and project id defined, then $projectidforalltimes is not empty. @@ -762,17 +762,17 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) // Project if (empty($withproject)) { - $morehtmlref .= '
'; - $morehtmlref .= $langs->trans("Project").': '; - $morehtmlref .= $projectstatic->getNomUrl(1); - $morehtmlref .= '
'; + $morehtmlref .= '
'; + $morehtmlref .= $langs->trans("Project").': '; + $morehtmlref .= $projectstatic->getNomUrl(1); + $morehtmlref .= '
'; - // Third party - $morehtmlref .= $langs->trans("ThirdParty").': '; - if (is_object($projectstatic->thirdparty)) { - $morehtmlref .= $projectstatic->thirdparty->getNomUrl(1); - } - $morehtmlref .= '
'; + // Third party + $morehtmlref .= $langs->trans("ThirdParty").': '; + if (is_object($projectstatic->thirdparty)) { + $morehtmlref .= $projectstatic->thirdparty->getNomUrl(1); + } + $morehtmlref .= '
'; } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param); @@ -780,7 +780,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) print '
'; print '
'; - print '
'; + print '
'; print ''; // Date start - Date end @@ -846,127 +846,127 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) print $form->formconfirm($_SERVER["PHP_SELF"]."?".($object->id > 0 ? "id=".$object->id : 'projectid='.$projectstatic->id).'&lineid='.GETPOST('lineid', 'int').($withproject ? '&withproject=1' : ''), $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_delete", '', '', 1); } - // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array - $hookmanager->initHooks(array('tasktimelist')); + // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array + $hookmanager->initHooks(array('tasktimelist')); - // Definition of fields for list - $arrayfields = array(); - $arrayfields['t.task_date'] = array('label'=>$langs->trans("Date"), 'checked'=>1); - if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task - { - $arrayfields['t.task_ref'] = array('label'=>$langs->trans("RefTask"), 'checked'=>1); - $arrayfields['t.task_label'] = array('label'=>$langs->trans("LabelTask"), 'checked'=>1); - } - $arrayfields['author'] = array('label'=>$langs->trans("By"), 'checked'=>1); - $arrayfields['t.note'] = array('label'=>$langs->trans("Note"), 'checked'=>1); - $arrayfields['t.task_duration'] = array('label'=>$langs->trans("Duration"), 'checked'=>1); - $arrayfields['value'] = array('label'=>$langs->trans("Value"), 'checked'=>1, 'enabled'=>(empty($conf->salaries->enabled) ? 0 : 1)); - $arrayfields['valuebilled'] = array('label'=>$langs->trans("Billed"), 'checked'=>1, 'enabled'=>(((!empty($conf->global->PROJECT_HIDE_TASKS) || empty($conf->global->PROJECT_BILL_TIME_SPENT)) ? 0 : 1) && $projectstatic->usage_bill_time)); - // Extra fields - if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) - { - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) - { - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); - } - } - $arrayfields = dol_sort_array($arrayfields, 'position'); + // Definition of fields for list + $arrayfields = array(); + $arrayfields['t.task_date'] = array('label'=>$langs->trans("Date"), 'checked'=>1); + if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task + { + $arrayfields['t.task_ref'] = array('label'=>$langs->trans("RefTask"), 'checked'=>1); + $arrayfields['t.task_label'] = array('label'=>$langs->trans("LabelTask"), 'checked'=>1); + } + $arrayfields['author'] = array('label'=>$langs->trans("By"), 'checked'=>1); + $arrayfields['t.note'] = array('label'=>$langs->trans("Note"), 'checked'=>1); + $arrayfields['t.task_duration'] = array('label'=>$langs->trans("Duration"), 'checked'=>1); + $arrayfields['value'] = array('label'=>$langs->trans("Value"), 'checked'=>1, 'enabled'=>(empty($conf->salaries->enabled) ? 0 : 1)); + $arrayfields['valuebilled'] = array('label'=>$langs->trans("Billed"), 'checked'=>1, 'enabled'=>(((!empty($conf->global->PROJECT_HIDE_TASKS) || empty($conf->global->PROJECT_BILL_TIME_SPENT)) ? 0 : 1) && $projectstatic->usage_bill_time)); + // Extra fields + if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) + { + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) + { + if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) + $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); + } + } + $arrayfields = dol_sort_array($arrayfields, 'position'); - $param = ''; - if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); - if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); - if ($search_month > 0) $param .= '&search_month='.urlencode($search_month); - if ($search_year > 0) $param .= '&search_year='.urlencode($search_year); - if ($search_user > 0) $param .= '&search_user='.urlencode($search_user); - if ($search_task_ref != '') $param .= '&search_task_ref='.urlencode($search_task_ref); - if ($search_task_label != '') $param .= '&search_task_label='.urlencode($search_task_label); - if ($search_note != '') $param .= '&search_note='.urlencode($search_note); - if ($search_duration != '') $param .= '&search_field2='.urlencode($search_duration); - if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); - /* - // Add $param from extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; - */ - if ($id) $param .= '&id='.urlencode($id); - if ($projectid) $param .= '&projectid='.urlencode($projectid); - if ($withproject) $param .= '&withproject='.urlencode($withproject); + $param = ''; + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); + if ($search_month > 0) $param .= '&search_month='.urlencode($search_month); + if ($search_year > 0) $param .= '&search_year='.urlencode($search_year); + if ($search_user > 0) $param .= '&search_user='.urlencode($search_user); + if ($search_task_ref != '') $param .= '&search_task_ref='.urlencode($search_task_ref); + if ($search_task_label != '') $param .= '&search_task_label='.urlencode($search_task_label); + if ($search_note != '') $param .= '&search_note='.urlencode($search_note); + if ($search_duration != '') $param .= '&search_field2='.urlencode($search_duration); + if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); + /* + // Add $param from extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; + */ + if ($id) $param .= '&id='.urlencode($id); + if ($projectid) $param .= '&projectid='.urlencode($projectid); + if ($withproject) $param .= '&withproject='.urlencode($withproject); - print ''; - if ($optioncss != '') print ''; - print ''; - print ''; - if ($action == 'editline') print ''; - elseif ($action == 'splitline') print ''; - elseif ($action == 'createtime' && $user->rights->projet->lire) print ''; - elseif ($massaction == 'generateinvoice' && $user->rights->facture->lire) print ''; - else print ''; - print ''; - print ''; - print ''; + print ''; + if ($optioncss != '') print ''; + print ''; + print ''; + if ($action == 'editline') print ''; + elseif ($action == 'splitline') print ''; + elseif ($action == 'createtime' && $user->rights->projet->lire) print ''; + elseif ($massaction == 'generateinvoice' && $user->rights->facture->lire) print ''; + else print ''; + print ''; + print ''; + print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; - if ($massaction == 'generateinvoice') - { - //var_dump($_REQUEST); - print ''; + if ($massaction == 'generateinvoice') + { + //var_dump($_REQUEST); + print ''; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - if ($conf->service->enabled) - { - print ''; - print ''; - print ''; - print ''; - } - /*print ''; - print ''; - print ''; - print '';*/ - print '
'; - print $langs->trans('DateInvoice'); - print ''; - print $form->selectDate('', '', '', '', '', '', 1, 1); - print '
'; - print $langs->trans('Mode'); - print ''; - $tmparray = array( - 'onelineperuser'=>'OneLinePerUser', - 'onelinepertask'=>'OneLinePerTask', - 'onelineperperiod'=>'OneLinePerPeriod', - ); - print $form->selectarray('generateinvoicemode', $tmparray, 'onelineperuser', 0, 0, 0, '', 1); - print '
'; - print $langs->trans('ServiceToUseOnLines'); - print ''; - $form->select_produits('', 'productid', '1', 0, 0, 1, 2, '', 0, array(), 0, 'None', 0, 'maxwidth500'); - print '
'; - print $langs->trans('ValidateInvoices'); - print ''; - print $form->selectyesno('validate_invoices', 0, 1); - print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + if ($conf->service->enabled) + { + print ''; + print ''; + print ''; + print ''; + } + /*print ''; + print ''; + print ''; + print '';*/ + print '
'; + print $langs->trans('DateInvoice'); + print ''; + print $form->selectDate('', '', '', '', '', '', 1, 1); + print '
'; + print $langs->trans('Mode'); + print ''; + $tmparray = array( + 'onelineperuser'=>'OneLinePerUser', + 'onelinepertask'=>'OneLinePerTask', + 'onelineperperiod'=>'OneLinePerPeriod', + ); + print $form->selectarray('generateinvoicemode', $tmparray, 'onelineperuser', 0, 0, 0, '', 1); + print '
'; + print $langs->trans('ServiceToUseOnLines'); + print ''; + $form->select_produits('', 'productid', '1', 0, 0, 1, 2, '', 0, array(), 0, 'None', 0, 'maxwidth500'); + print '
'; + print $langs->trans('ValidateInvoices'); + print ''; + print $form->selectyesno('validate_invoices', 0, 1); + print '
'; - print '
'; - print '
'; - print ' '; - print ''; - print '
'; - print '
'; - } + print '
'; + print '
'; + print ' '; + print ''; + print '
'; + print '
'; + } /* - * List of time spent + * List of time spent */ $tasks = array(); @@ -995,31 +995,31 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $resql = $db->query($sql); - $nbtotalofrecords = $db->num_rows($resql); - if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0 - { - $page = 0; - $offset = 0; - } + $resql = $db->query($sql); + $nbtotalofrecords = $db->num_rows($resql); + if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0 + { + $page = 0; + $offset = 0; + } } // if total of record found is smaller than limit, no need to do paging and to restart another select with limits set. if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) { - $num = $nbtotalofrecords; + $num = $nbtotalofrecords; } else { - $sql .= $db->plimit($limit + 1, $offset); + $sql .= $db->plimit($limit + 1, $offset); - $resql = $db->query($sql); - if (!$resql) - { - dol_print_error($db); - exit; - } + $resql = $db->query($sql); + if (!$resql) + { + dol_print_error($db); + exit; + } - $num = $db->num_rows($resql); + $num = $db->num_rows($resql); } if ($num >= 0) @@ -1034,11 +1034,11 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) } else { - print ''."\n"; + print ''."\n"; - $title = $langs->trans("ListTaskTimeForTask"); + $title = $langs->trans("ListTaskTimeForTask"); - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, $linktocreatetime, '', $limit); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, $linktocreatetime, '', $limit); } $i = 0; @@ -1061,9 +1061,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) if ($action == 'createtime' && $user->rights->projet->lire) { print ''."\n"; - if (!empty($id)) print ''; + if (!empty($id)) print ''; - print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''; print ''; @@ -1075,7 +1075,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) print ''; if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) { - print ''; + print ''; } print ''; print "\n"; @@ -1092,9 +1092,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) // Task if (empty($id)) { - print ''; + print ''; } // Contributor @@ -1138,8 +1138,8 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) // Invoiced if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) { - print ''; + print ''; } print ''; print ''; } + print ''; + print ''; + print ''; + print ''; /*print ''; print ''; print ''; print ''; /*print ''; From 19e69dc8690caa0a507b8d861f3358fa1f2fe7a3 Mon Sep 17 00:00:00 2001 From: Guillaume Matheron Date: Thu, 2 Jan 2020 15:18:18 +0100 Subject: [PATCH 082/784] Creating invoice from time spent now takes in to account the product duration to compute the quantity to bill --- htdocs/projet/tasks/time.php | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 485ba8bf173..e803d86f388 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -345,9 +345,23 @@ if ($action == 'confirm_generateinvoice') $generateinvoicemode = GETPOST('generateinvoicemode', 'string'); $invoiceToUse = GETPOST('invoiceid', 'int'); + $prodDurationHours = 1.0; if ($idprod > 0) { $tmpproduct->fetch($idprod); + if ($tmpproduct->duration_unit=='i') + $prodDurationHours = 1./60; + if ($tmpproduct->duration_unit=='h') + $prodDurationHours = 1.; + if ($tmpproduct->duration_unit=='d') + $prodDurationHours = 24.; + if ($tmpproduct->duration_unit=='w') + $prodDurationHours = 24.*7; + if ($tmpproduct->duration_unit=='m') + $prodDurationHours = 24.*30; + if ($tmpproduct->duration_unit=='y') + $prodDurationHours = 24.*365; + $prodDurationHours *= $tmpproduct->duration_value; $dataforprice = $tmpproduct->getSellPrice($mysoc, $projectstatic->thirdparty, 0); $pu_ht = empty($dataforprice['pu_ht']) ? 0 : $dataforprice['pu_ht']; @@ -408,7 +422,7 @@ if ($action == 'confirm_generateinvoice') } // Add lines - $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, $qtyhour/$prodDurationHours, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); // Update lineid into line of timespent $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; @@ -452,7 +466,7 @@ if ($action == 'confirm_generateinvoice') } // Add lines - $lineid = $tmpinvoice->addline($value['note'], $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + $lineid = $tmpinvoice->addline($value['note'], $pu_ht, $qtyhour/$prodDurationHours, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); // Update lineid into line of timespent $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; @@ -493,7 +507,7 @@ if ($action == 'confirm_generateinvoice') // Add lines $lineName = $ftask->ref.' - '.$ftask->label; - $lineid = $tmpinvoice->addline($lineName, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + $lineid = $tmpinvoice->addline($lineName, $pu_ht, $qtyhour/$prodDurationHours, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); // Update lineid into line of timespent $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; From 2c68b08e4f1759705c51ba9c195cc3abd202c742 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 2 Jan 2020 14:27:35 +0000 Subject: [PATCH 083/784] Fixing style errors. --- htdocs/projet/tasks/time.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index d08c7d4706d..7e16c83a71a 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -422,7 +422,7 @@ if ($action == 'confirm_generateinvoice') } // Add lines - $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, round($qtyhour/$prodDurationHours,2), $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, round($qtyhour/$prodDurationHours, 2), $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); // Update lineid into line of timespent $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; @@ -466,7 +466,7 @@ if ($action == 'confirm_generateinvoice') } // Add lines - $lineid = $tmpinvoice->addline($value['note'], $pu_ht, round($qtyhour/$prodDurationHours,2), $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + $lineid = $tmpinvoice->addline($value['note'], $pu_ht, round($qtyhour/$prodDurationHours, 2), $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); // Update lineid into line of timespent $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; @@ -507,7 +507,7 @@ if ($action == 'confirm_generateinvoice') // Add lines $lineName = $ftask->ref.' - '.$ftask->label; - $lineid = $tmpinvoice->addline($lineName, $pu_ht, round($qtyhour/$prodDurationHours,2), $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + $lineid = $tmpinvoice->addline($lineName, $pu_ht, round($qtyhour/$prodDurationHours, 2), $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); // Update lineid into line of timespent $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; From d13e1ddcdf7d2b89fdc372a149679913173367ba Mon Sep 17 00:00:00 2001 From: Guillaume Matheron Date: Fri, 3 Jan 2020 11:21:33 +0100 Subject: [PATCH 084/784] Add document date instead of creation date when exporting FEC file --- htdocs/accountancy/class/accountancyexport.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index f36b98b15b1..e049d2b5bad 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -718,7 +718,7 @@ class AccountancyExport print $line->piece_num.$separator; // FEC:EcritureDate - print $date_creation.$separator; + print $date_doc.$separator; // FEC:CompteNum print $line->numero_compte.$separator; From 72b7e72f735aa6fdb048842f68c579f1b9d0402b Mon Sep 17 00:00:00 2001 From: Guillaume Matheron Date: Fri, 3 Jan 2020 16:20:29 +0100 Subject: [PATCH 085/784] Dates YYMMDD dans l'export FEC --- htdocs/accountancy/class/accountancyexport.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index e049d2b5bad..a702244b65b 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -704,9 +704,9 @@ class AccountancyExport print $end_line; foreach ($objectLines as $line) { - $date_creation = dol_print_date($line->date_creation, '%d%m%Y'); - $date_doc = dol_print_date($line->doc_date, '%d%m%Y'); - $date_valid = dol_print_date($line->date_validated, '%d%m%Y'); + $date_creation = dol_print_date($line->date_creation, '%Y%m%d'); + $date_doc = dol_print_date($line->doc_date, '%Y%m%d'); + $date_valid = dol_print_date($line->date_validated, '%Y%m%d'); // FEC:JournalCode print $line->code_journal.$separator; From 5b1e3908ca8fac46bb2e7a558d5e22dfbd312172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 4 Jan 2020 10:19:54 +0100 Subject: [PATCH 086/784] move migration from 10-11 to 11-12 --- .../install/mysql/migration/10.0.0-11.0.0.sql | 17 ++--------------- .../install/mysql/migration/11.0.0-12.0.0.sql | 13 +++++++++++++ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 0cc3a4411f9..1709dde91f0 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -73,7 +73,7 @@ UPDATE llx_holiday SET ref = rowid WHERE ref IS NULL; -- VPGSQL8.2 ALTER TABLE llx_holiday ALTER COLUMN ref SET NOT NULL; ALTER TABLE llx_c_email_senderprofile MODIFY COLUMN active tinyint DEFAULT 1 NOT NULL; - + insert into llx_c_type_container (code,label,module,active) values ('menu', 'Menu', 'system', 1); INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description) VALUES('HELP', '15', 'Request for functionnal help', 1, 0, NULL); @@ -527,19 +527,6 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value ALTER TABLE llx_comment ADD COLUMN fk_user_modif integer DEFAULT NULL; -CREATE TABLE llx_categorie_actioncomm -( - fk_categorie integer NOT NULL, - fk_actioncomm integer NOT NULL, - import_key varchar(14) -) ENGINE=innodb; - -ALTER TABLE llx_categorie_actioncomm ADD PRIMARY KEY pk_categorie_actioncomm (fk_categorie, fk_actioncomm); -ALTER TABLE llx_categorie_actioncomm ADD INDEX idx_categorie_actioncomm_fk_categorie (fk_categorie); -ALTER TABLE llx_categorie_actioncomm ADD INDEX idx_categorie_actioncomm_fk_actioncomm (fk_actioncomm); - -ALTER TABLE llx_categorie_actioncomm ADD CONSTRAINT fk_categorie_actioncomm_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); -ALTER TABLE llx_categorie_actioncomm ADD CONSTRAINT fk_categorie_actioncomm_fk_actioncomm FOREIGN KEY (fk_actioncomm) REFERENCES llx_actioncomm (id); CREATE TABLE llx_mrp_production( rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, @@ -549,7 +536,7 @@ CREATE TABLE llx_mrp_production( fk_warehouse integer, qty integer NOT NULL DEFAULT 1, qty_frozen smallint DEFAULT 0, - disable_stock_change smallint DEFAULT 0, + disable_stock_change smallint DEFAULT 0, batch varchar(30), role varchar(10), -- 'toconsume' or 'toproduce' (initialized at MO creation), 'consumed' or 'produced' (added after MO validation) fk_mrp_production integer, -- if role = 'consumed', id of line with role 'toconsume', if role = 'produced' id of line with role 'toproduce' diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index b0ecc2b9639..5d647d610c5 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -52,6 +52,19 @@ create table llx_object_lang ALTER TABLE llx_object_lang ADD UNIQUE INDEX uk_object_lang (fk_object, type_object, property, lang); +CREATE TABLE llx_categorie_actioncomm +( + fk_categorie integer NOT NULL, + fk_actioncomm integer NOT NULL, + import_key varchar(14) +) ENGINE=innodb; + +ALTER TABLE llx_categorie_actioncomm ADD PRIMARY KEY pk_categorie_actioncomm (fk_categorie, fk_actioncomm); +ALTER TABLE llx_categorie_actioncomm ADD INDEX idx_categorie_actioncomm_fk_categorie (fk_categorie); +ALTER TABLE llx_categorie_actioncomm ADD INDEX idx_categorie_actioncomm_fk_actioncomm (fk_actioncomm); + +ALTER TABLE llx_categorie_actioncomm ADD CONSTRAINT fk_categorie_actioncomm_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); +ALTER TABLE llx_categorie_actioncomm ADD CONSTRAINT fk_categorie_actioncomm_fk_actioncomm FOREIGN KEY (fk_actioncomm) REFERENCES llx_actioncomm (id); From b53f356638aae5f715e7c6c5cd72c20fe488c018 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 Dec 2019 17:30:27 +0100 Subject: [PATCH 087/784] FIX #12760 #12763 #12755 #12765 #12751 --- htdocs/core/class/html.formmargin.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index 345a94b3a62..6857eddf44a 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -1,5 +1,5 @@ +/* Copyright (c) 2015-2019 Laurent Destailleur * * 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 @@ -98,7 +98,7 @@ class FormMargin $pv = $line->total_ht; $pa_ht = ($pv < 0 ? - $line->pa_ht : $line->pa_ht); // We choosed to have line->pa_ht always positive in database, so we guess the correct sign - if ($object->type == Facture::TYPE_SITUATION) { + if ($object->element == 'facture' && $object->type == $object::TYPE_SITUATION) { $pa = $line->qty * $pa_ht * ($line->situation_percent / 100); } else { $pa = $line->qty * $pa_ht; From e5ddc8dfa3c4e35ba8fe62fb727ec914086b28eb Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Tue, 7 Jan 2020 09:43:13 +0100 Subject: [PATCH 088/784] Merge remote-tracking branch 'Dolibarr/11.0' into 11 --- htdocs/compta/facture/card.php | 8 +- htdocs/compta/stats/cabyuser.php | 38 +++++--- htdocs/core/class/commonobject.class.php | 3 +- htdocs/core/lib/functions.lib.php | 2 +- htdocs/core/search_page.php | 2 +- htdocs/langs/en_US/admin.lang | 1 + .../template/class/myobject.class.php | 6 +- .../mymodule/mod_myobject_advanced.php | 16 ++-- .../mymodule/mod_myobject_standard.php | 15 +-- .../modules/mymodule/modules_myobject.php | 17 ++-- htdocs/mrp/mo_production.php | 91 +++++++++++++------ .../stock/class/mouvementstock.class.php | 2 +- htdocs/public/payment/newpayment.php | 48 +++++++--- htdocs/theme/eldy/global.inc.php | 10 +- htdocs/theme/md/style.css.php | 10 +- 15 files changed, 178 insertions(+), 91 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index aefe642970a..6e5ed9de613 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3206,13 +3206,13 @@ if ($action == 'create') $thirdparty = $soc; $discount_type = 0; - $backtopage = urlencode($_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')); + $backtopage = urlencode($_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.GETPOST('origin', 'alpha').'&originid='.GETPOST('originid', 'int')); include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; print ''; } - $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + $datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); // Date invoice print ''; } // Payment term print ''; if (!empty($conf->global->INVOICE_USE_SITUATION)) diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index 8d49711b121..fb9b06025aa 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -170,9 +170,11 @@ elseif ($modecompta == "RECETTES-DEPENSES") } elseif ($modecompta == "BOOKKEEPING") { + // TODO } elseif ($modecompta == "BOOKKEEPINGCOLLECTED") { + // TODO } $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink = ''.img_previous().''.img_next().''; @@ -387,39 +389,53 @@ if (count($amount)) { // Amount w/o VAT print ''; // Amount with VAT print ''; // Percent diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 498fa314315..39548f3c41e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3522,6 +3522,7 @@ abstract class CommonObject if ($elementTable == 'user') $fieldstatus = "statut"; if ($elementTable == 'expensereport') $fieldstatus = "fk_statut"; if ($elementTable == 'commande_fournisseur_dispatch') $fieldstatus = "status"; + if (is_array($this->fields) && array_key_exists('status', $this->fields)) $fieldstatus = 'status'; $sql = "UPDATE ".MAIN_DB_PREFIX.$elementTable; $sql .= " SET ".$fieldstatus." = ".$status; @@ -3572,7 +3573,7 @@ abstract class CommonObject else { $this->db->rollback(); - dol_syslog(get_class($this)."::setStatus ".$this->error, LOG_ERR); + dol_syslog(get_class($this)."::setStatut ".$this->error, LOG_ERR); return -1; } } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 909d16d39e6..97409544a90 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1567,7 +1567,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi { $accounted = $object->getVentilExportCompta(); $langs->load("accountancy"); - $morehtmlstatus .= '
'.($accounted > 0 ? $langs->trans("Accounted") : ''.$langs->trans("NotYetAccounted").''); + $morehtmlstatus .= '
'.($accounted > 0 ? $langs->trans("Accounted") : $langs->trans("NotYetAccounted")).''; } } diff --git a/htdocs/core/search_page.php b/htdocs/core/search_page.php index 7ca287625eb..194afb86d92 100644 --- a/htdocs/core/search_page.php +++ b/htdocs/core/search_page.php @@ -115,7 +115,7 @@ print "\n"; print "\n"; print '
'; print ''; -print '
'."\n"; +print '
'."\n"; print $searchform; print '
'."\n"; print '
'; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index e4e7768128e..602cc65522e 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1248,6 +1248,7 @@ AskForPreferredShippingMethod=Ask for preferred shipping method for Third Partie FieldEdition=Edition of field %s FillThisOnlyIfRequired=Example: +2 (fill only if timezone offset problems are experienced) GetBarCode=Get barcode +NumberingModules=Numbering models ##### Module password generation PasswordGenerationStandard=Return a password generated according to internal Dolibarr algorithm: 8 characters containing shared numbers and characters in lowercase. PasswordGenerationNone=Do not suggest a generated password. Password must be typed in manually. diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index d7a157c682f..4859162abb0 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -584,8 +584,8 @@ class MyObject extends CommonObject // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); $newref = dol_sanitizeFileName($num); - $dirsource = $conf->myobject->dir_output.'/'.$oldref; - $dirdest = $conf->myobject->dir_output.'/'.$newref; + $dirsource = $conf->mymodule->dir_output.'/myobject/'.$oldref; + $dirdest = $conf->mymodule->dir_output.'/myobject/'.$newref; if (!$error && file_exists($dirsource)) { dol_syslog(get_class($this)."::validate() rename dir ".$dirsource." into ".$dirdest); @@ -594,7 +594,7 @@ class MyObject extends CommonObject { dol_syslog("Rename ok"); // Rename docs starting with $oldref with $newref - $listoffiles = dol_dir_list($conf->myobject->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/')); + $listoffiles = dol_dir_list($conf->mymodule->dir_output.'/myobject/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/')); foreach ($listoffiles as $fileentry) { $dirsource = $fileentry['name']; diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php index f9cc9d0b27c..6a3a274f443 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php @@ -21,12 +21,12 @@ */ /** - * \file htdocs/core/modules/bom/mod_bom_advanced.php - * \ingroup bom + * \file htdocs/core/modules/mymodule/mod_myobject_advanced.php + * \ingroup mymodule * \brief File containing class for advanced numbering model of MyObject */ -require_once DOL_DOCUMENT_ROOT .'/core/modules/bom/modules_bom.php'; +dol_include_once('/mymodule/core/modules/mymodule/modules_myobject.php'); /** @@ -71,15 +71,15 @@ class mod_myobject_advanced extends ModeleNumRefMyObject $texte.= ''; $texte.= '
'.$langs->trans("ProgressDeclared").'
'; - $formproject->selectTasks(-1, GETPOST('taskid', 'int'), 'taskid', 0, 0, 1, 1, 0, 0, 'maxwidth300', $projectstatic->id, ''); - print ''; + $formproject->selectTasks(-1, GETPOST('taskid', 'int'), 'taskid', 0, 0, 1, 1, 0, 0, 'maxwidth300', $projectstatic->id, ''); + print ''; - print ''; + print ''; @@ -1163,16 +1163,16 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) if (!empty($moreforfilter)) { - print '
'; - print $moreforfilter; - print '
'; + print '
'; + print $moreforfilter; + print '
'; } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields .= (is_array($arrayofmassactions) && count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); - print '
'; + print '
'; print ''."\n"; // Fields title search @@ -1186,23 +1186,23 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) $formother->select_year($search_year, 'search_year', 1, 20, 5); print ''; } - if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task - { - if (!empty($arrayfields['t.task_ref']['checked'])) print ''; - if (!empty($arrayfields['t.task_label']['checked'])) print ''; - } - // Author - if (!empty($arrayfields['author']['checked'])) print ''; + if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task + { + if (!empty($arrayfields['t.task_ref']['checked'])) print ''; + if (!empty($arrayfields['t.task_label']['checked'])) print ''; + } + // Author + if (!empty($arrayfields['author']['checked'])) print ''; // Note - if (!empty($arrayfields['t.note']['checked'])) print ''; + if (!empty($arrayfields['t.note']['checked'])) print ''; // Duration - if (!empty($arrayfields['t.task_duration']['checked'])) print ''; + if (!empty($arrayfields['t.task_duration']['checked'])) print ''; // Value in main currency - if (!empty($arrayfields['value']['checked'])) print ''; - // Value billed - if (!empty($arrayfields['valuebilled']['checked'])) print ''; + if (!empty($arrayfields['value']['checked'])) print ''; + // Value billed + if (!empty($arrayfields['valuebilled']['checked'])) print ''; - /* + /* // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; */ @@ -1218,26 +1218,26 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) print ''."\n"; print ''; - if (!empty($arrayfields['t.task_date']['checked'])) print_liste_field_titre($arrayfields['t.task_date']['label'], $_SERVER['PHP_SELF'], 't.task_date,t.task_datehour,t.rowid', '', $param, '', $sortfield, $sortorder); - if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task - { - if (!empty($arrayfields['t.task_ref']['checked'])) print_liste_field_titre($arrayfields['t.task_ref']['label'], $_SERVER['PHP_SELF'], 'pt.ref', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['t.task_label']['checked'])) print_liste_field_titre($arrayfields['t.task_label']['label'], $_SERVER['PHP_SELF'], 'pt.label', '', $param, '', $sortfield, $sortorder); - } - if (!empty($arrayfields['author']['checked'])) print_liste_field_titre($arrayfields['author']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['t.note']['checked'])) print_liste_field_titre($arrayfields['t.note']['label'], $_SERVER['PHP_SELF'], 't.note', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['t.task_date']['checked'])) print_liste_field_titre($arrayfields['t.task_date']['label'], $_SERVER['PHP_SELF'], 't.task_date,t.task_datehour,t.rowid', '', $param, '', $sortfield, $sortorder); + if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task + { + if (!empty($arrayfields['t.task_ref']['checked'])) print_liste_field_titre($arrayfields['t.task_ref']['label'], $_SERVER['PHP_SELF'], 'pt.ref', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['t.task_label']['checked'])) print_liste_field_titre($arrayfields['t.task_label']['label'], $_SERVER['PHP_SELF'], 'pt.label', '', $param, '', $sortfield, $sortorder); + } + if (!empty($arrayfields['author']['checked'])) print_liste_field_titre($arrayfields['author']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['t.note']['checked'])) print_liste_field_titre($arrayfields['t.note']['label'], $_SERVER['PHP_SELF'], 't.note', '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['t.task_duration']['checked'])) print_liste_field_titre($arrayfields['t.task_duration']['label'], $_SERVER['PHP_SELF'], 't.task_duration', '', $param, '', $sortfield, $sortorder, 'right '); - if (!empty($arrayfields['value']['checked'])) print_liste_field_titre($arrayfields['value']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); - if (!empty($arrayfields['valuebilled']['checked'])) print_liste_field_titre($arrayfields['valuebilled']['label'], $_SERVER['PHP_SELF'], 'il.total_ht', '', $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['value']['checked'])) print_liste_field_titre($arrayfields['value']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); + if (!empty($arrayfields['valuebilled']['checked'])) print_liste_field_titre($arrayfields['valuebilled']['label'], $_SERVER['PHP_SELF'], 'il.total_ht', '', $param, '', $sortfield, $sortorder, 'center '); /* - // Extra fields + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; */ - // Hook fields + // 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 - print $hookmanager->resPrint; - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'width="80"', $sortfield, $sortorder, 'center maxwidthsearch '); + $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'width="80"', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; $tasktmp = new Task($db); @@ -1252,7 +1252,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) $totalarray = array(); foreach ($tasks as $task_time) { - if ($i >= $limit) break; + if ($i >= $limit) break; print ''; @@ -1262,125 +1262,125 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) // Date if (!empty($arrayfields['t.task_date']['checked'])) { - print ''; - if (!$i) $totalarray['nbfield']++; + print ''; + if (!$i) $totalarray['nbfield']++; } // Task ref - if (!empty($arrayfields['t.task_ref']['checked'])) - { - if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task - { - print ''; - if (!$i) $totalarray['nbfield']++; - } - } + if (!empty($arrayfields['t.task_ref']['checked'])) + { + if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task + { + print ''; + if (!$i) $totalarray['nbfield']++; + } + } // Task label - if (!empty($arrayfields['t.task_label']['checked'])) - { - if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task - { - print ''; - if (!$i) $totalarray['nbfield']++; - } - } + if (!empty($arrayfields['t.task_label']['checked'])) + { + if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task + { + print ''; + if (!$i) $totalarray['nbfield']++; + } + } - // User - if (!empty($arrayfields['author']['checked'])) - { - print ''; - if (!$i) $totalarray['nbfield']++; - } + // User + if (!empty($arrayfields['author']['checked'])) + { + print ''; + if (!$i) $totalarray['nbfield']++; + } // Note - if (!empty($arrayfields['t.note']['checked'])) - { - print ''; - if (!$i) $totalarray['nbfield']++; - } - elseif ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) - { - print ''; - } + if (!empty($arrayfields['t.note']['checked'])) + { + print ''; + if (!$i) $totalarray['nbfield']++; + } + elseif ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) + { + print ''; + } // Time spent - if (!empty($arrayfields['t.task_duration']['checked'])) - { - print ''; - if (!$i) $totalarray['nbfield']++; - if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.task_duration'; - $totalarray['val']['t.task_duration'] += $task_time->task_duration; - if (!$i) $totalarray['totaldurationfield'] = $totalarray['nbfield']; - $totalarray['totalduration'] += $task_time->task_duration; - } + if (!empty($arrayfields['t.task_duration']['checked'])) + { + print ''; + if (!$i) $totalarray['nbfield']++; + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.task_duration'; + $totalarray['val']['t.task_duration'] += $task_time->task_duration; + if (!$i) $totalarray['totaldurationfield'] = $totalarray['nbfield']; + $totalarray['totalduration'] += $task_time->task_duration; + } // Value spent - if (!empty($arrayfields['value']['checked'])) - { + if (!empty($arrayfields['value']['checked'])) + { print ''; - if (!$i) $totalarray['nbfield']++; - if (!$i) $totalarray['totalvaluebilledfield'] = $totalarray['nbfield']; - $totalarray['totalvaluebilled'] += $valuebilled; - } + // Invoiced + if (!empty($arrayfields['valuebilled']['checked'])) + { + print ''; + if (!$i) $totalarray['nbfield']++; + if (!$i) $totalarray['totalvaluebilledfield'] = $totalarray['nbfield']; + $totalarray['totalvaluebilled'] += $valuebilled; + } - /* - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - */ + /* + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + */ // Fields from hook $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$task_time); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - // Action column + // Action column print ''; - if (!$i) $totalarray['nbfield']++; + print ''; + if (!$i) $totalarray['nbfield']++; print "\n"; @@ -1483,298 +1483,298 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) { - print ''; + print ''; - // Date - if (!empty($arrayfields['t.task_date']['checked'])) - { - print ''; - } + // Date + if (!empty($arrayfields['t.task_date']['checked'])) + { + print ''; + } - // Task ref - if (!empty($arrayfields['t.task_ref']['checked'])) - { - if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task - { - print ''; - } - } + // Task ref + if (!empty($arrayfields['t.task_ref']['checked'])) + { + if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task + { + print ''; + } + } - // Task label - if (!empty($arrayfields['t.task_label']['checked'])) - { - if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task - { - print ''; - } - } + // Task label + if (!empty($arrayfields['t.task_label']['checked'])) + { + if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task + { + print ''; + } + } - // User - if (!empty($arrayfields['author']['checked'])) - { - print ''; - } + // User + if (!empty($arrayfields['author']['checked'])) + { + print ''; + } - // Note - if (!empty($arrayfields['t.note']['checked'])) - { - print ''; - } - elseif ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) - { - print ''; - } + // Note + if (!empty($arrayfields['t.note']['checked'])) + { + print ''; + } + elseif ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) + { + print ''; + } - // Time spent - if (!empty($arrayfields['t.task_duration']['checked'])) - { - print ''; - } + // Time spent + if (!empty($arrayfields['t.task_duration']['checked'])) + { + print ''; + } - // Value spent - if (!empty($arrayfields['value']['checked'])) - { - print ''; - } + // Value spent + if (!empty($arrayfields['value']['checked'])) + { + print ''; + } - // Value billed - if (!empty($arrayfields['valuebilled']['checked'])) - { - print ''; - } + // Value billed + if (!empty($arrayfields['valuebilled']['checked'])) + { + print ''; + } - /* - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - */ + /* + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + */ - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$task_time); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$task_time); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; - // Action column - print ''; + // Action column + print ''; - print "\n"; + print "\n"; - // Line for second dispatching + // Line for second dispatching - print ''; + print ''; - // Date - if (!empty($arrayfields['t.task_date']['checked'])) - { - print ''; - } + // Date + if (!empty($arrayfields['t.task_date']['checked'])) + { + print ''; + } - // Task ref - if (!empty($arrayfields['t.task_ref']['checked'])) - { - if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task - { - print ''; - } - } + // Task ref + if (!empty($arrayfields['t.task_ref']['checked'])) + { + if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task + { + print ''; + } + } - // Task label - if (!empty($arrayfields['t.task_label']['checked'])) - { - if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task - { - print ''; - } - } + // Task label + if (!empty($arrayfields['t.task_label']['checked'])) + { + if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task + { + print ''; + } + } - // User - if (!empty($arrayfields['author']['checked'])) - { - print ''; - } + // User + if (!empty($arrayfields['author']['checked'])) + { + print ''; + } - // Note - if (!empty($arrayfields['t.note']['checked'])) - { - print ''; - } - elseif ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) - { - print ''; - } + // Note + if (!empty($arrayfields['t.note']['checked'])) + { + print ''; + } + elseif ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) + { + print ''; + } - // Time spent - if (!empty($arrayfields['t.task_duration']['checked'])) - { - print ''; - } + // Time spent + if (!empty($arrayfields['t.task_duration']['checked'])) + { + print ''; + } - // Value spent - if (!empty($arrayfields['value']['checked'])) - { - print ''; - } + // Value spent + if (!empty($arrayfields['value']['checked'])) + { + print ''; + } - // Value billed - if (!empty($arrayfields['valuebilled']['checked'])) - { - print ''; - } + // Value billed + if (!empty($arrayfields['valuebilled']['checked'])) + { + print ''; + } - /* - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - */ + /* + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + */ - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$task_time); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$task_time); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; - // Action column - print ''; + // Action column + print ''; - print "\n"; + print "\n"; } $i++; From 458c1e2174c5a9af21e7830e625682656a020002 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 29 Dec 2019 19:58:38 +0000 Subject: [PATCH 076/784] Fixing style errors. --- htdocs/projet/tasks/time.php | 228 +++++++++++++++++------------------ 1 file changed, 114 insertions(+), 114 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 98bd7523605..1f692386c74 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -375,132 +375,132 @@ if ($action == 'confirm_generateinvoice') if (!$error) { - if ($generateinvoicemode=='onelineperuser') { - $arrayoftasks = array(); - foreach ($toselect as $key => $value) - { - // Get userid, timepent - $object->fetchTimeSpent($value); - $arrayoftasks[$object->timespent_fk_user]['timespent'] += $object->timespent_duration; - $arrayoftasks[$object->timespent_fk_user]['totalvaluetodivideby3600'] += ($object->timespent_duration * $object->timespent_thm); - } - - foreach ($arrayoftasks as $userid => $value) - { - $fuser->fetch($userid); - //$pu_ht = $value['timespent'] * $fuser->thm; - $username = $fuser->getFullName($langs); - - // Define qty per hour - $qtyhour = round($value['timespent'] / 3600, 2); - $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); - - // If no unit price known - if (empty($pu_ht)) - { - $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); + if ($generateinvoicemode=='onelineperuser') { + $arrayoftasks = array(); + foreach ($toselect as $key => $value) + { + // Get userid, timepent + $object->fetchTimeSpent($value); + $arrayoftasks[$object->timespent_fk_user]['timespent'] += $object->timespent_duration; + $arrayoftasks[$object->timespent_fk_user]['totalvaluetodivideby3600'] += ($object->timespent_duration * $object->timespent_thm); } - // Add lines - $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); - - // Update lineid into line of timespent - $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; - $sql .= ' WHERE rowid in ('.join(',', $toselect).') AND fk_user = '.$userid; - $result = $db->query($sql); - if (!$result) + foreach ($arrayoftasks as $userid => $value) { - $error++; - setEventMessages($db->lasterror(), null, 'errors'); - break; + $fuser->fetch($userid); + //$pu_ht = $value['timespent'] * $fuser->thm; + $username = $fuser->getFullName($langs); + + // Define qty per hour + $qtyhour = round($value['timespent'] / 3600, 2); + $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); + + // If no unit price known + if (empty($pu_ht)) + { + $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); + } + + // Add lines + $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + + // Update lineid into line of timespent + $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; + $sql .= ' WHERE rowid in ('.join(',', $toselect).') AND fk_user = '.$userid; + $result = $db->query($sql); + if (!$result) + { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + break; + } } - } - } - elseif ($generateinvoicemode=='onelineperperiod') { - $arrayoftasks = array(); - foreach ($toselect as $key => $value) - { - // Get userid, timepent - $object->fetchTimeSpent($value); - $arrayoftasks[$object->timespent_id]['timespent'] = $object->timespent_duration; - $arrayoftasks[$object->timespent_id]['totalvaluetodivideby3600'] = $object->timespent_duration * $object->timespent_thm; - $arrayoftasks[$object->timespent_id]['note'] = $object->timespent_note; - $arrayoftasks[$object->timespent_id]['user'] = $object->timespent_fk_user; - } - - foreach ($arrayoftasks as $timespent_id => $value) - { - $userid = $value['user']; - $fuser->fetch($userid); - //$pu_ht = $value['timespent'] * $fuser->thm; - $username = $fuser->getFullName($langs); - - // Define qty per hour - $qtyhour = round($value['timespent'] / 3600, 2); - $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); - - // If no unit price known - if (empty($pu_ht)) - { - $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); + } + elseif ($generateinvoicemode=='onelineperperiod') { + $arrayoftasks = array(); + foreach ($toselect as $key => $value) + { + // Get userid, timepent + $object->fetchTimeSpent($value); + $arrayoftasks[$object->timespent_id]['timespent'] = $object->timespent_duration; + $arrayoftasks[$object->timespent_id]['totalvaluetodivideby3600'] = $object->timespent_duration * $object->timespent_thm; + $arrayoftasks[$object->timespent_id]['note'] = $object->timespent_note; + $arrayoftasks[$object->timespent_id]['user'] = $object->timespent_fk_user; } - // Add lines - $lineid = $tmpinvoice->addline($value['note'], $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); - - // Update lineid into line of timespent - $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; - $sql .= ' WHERE rowid in ('.join(',', $toselect).') AND fk_user = '.$userid; - $result = $db->query($sql); - if (!$result) + foreach ($arrayoftasks as $timespent_id => $value) { - $error++; - setEventMessages($db->lasterror(), null, 'errors'); - break; + $userid = $value['user']; + $fuser->fetch($userid); + //$pu_ht = $value['timespent'] * $fuser->thm; + $username = $fuser->getFullName($langs); + + // Define qty per hour + $qtyhour = round($value['timespent'] / 3600, 2); + $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); + + // If no unit price known + if (empty($pu_ht)) + { + $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); + } + + // Add lines + $lineid = $tmpinvoice->addline($value['note'], $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + + // Update lineid into line of timespent + $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; + $sql .= ' WHERE rowid in ('.join(',', $toselect).') AND fk_user = '.$userid; + $result = $db->query($sql); + if (!$result) + { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + break; + } } - } - } - elseif ($generateinvoicemode=='onelinepertask') { - $arrayoftasks = array(); - foreach ($toselect as $key => $value) - { - // Get userid, timepent - $object->fetchTimeSpent($value); - // $object->id is the task id - $arrayoftasks[$object->id]['timespent'] += $object->timespent_duration; - $arrayoftasks[$object->id]['totalvaluetodivideby3600'] += $object->timespent_duration * $object->timespent_thm; - } - - foreach ($arrayoftasks as $task_id => $value) - { - $ftask = new Task($db); - $ftask->fetch($task_id); - // Define qty per hour - $qtyhour = round($value['timespent'] / 3600, 2); - $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); - - // If no unit price known - if (empty($pu_ht)) - { - $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); + } + elseif ($generateinvoicemode=='onelinepertask') { + $arrayoftasks = array(); + foreach ($toselect as $key => $value) + { + // Get userid, timepent + $object->fetchTimeSpent($value); + // $object->id is the task id + $arrayoftasks[$object->id]['timespent'] += $object->timespent_duration; + $arrayoftasks[$object->id]['totalvaluetodivideby3600'] += $object->timespent_duration * $object->timespent_thm; } - // Add lines - $lineName = $ftask->ref.' - '.$ftask->label; - $lineid = $tmpinvoice->addline($lineName, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); - - // Update lineid into line of timespent - $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; - $sql .= ' WHERE rowid in ('.join(',', $toselect).')'; - $result = $db->query($sql); - if (!$result) + foreach ($arrayoftasks as $task_id => $value) { - $error++; - setEventMessages($db->lasterror(), null, 'errors'); - break; + $ftask = new Task($db); + $ftask->fetch($task_id); + // Define qty per hour + $qtyhour = round($value['timespent'] / 3600, 2); + $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); + + // If no unit price known + if (empty($pu_ht)) + { + $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); + } + + // Add lines + $lineName = $ftask->ref.' - '.$ftask->label; + $lineid = $tmpinvoice->addline($lineName, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + + // Update lineid into line of timespent + $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; + $sql .= ' WHERE rowid in ('.join(',', $toselect).')'; + $result = $db->query($sql); + if (!$result) + { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + break; + } } - } - } + } } if (!$error) From ee7fe667494aa20f6ed35ef6f4e66177dbba36f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 31 Dec 2019 14:19:31 +0100 Subject: [PATCH 077/784] Update doc_generic_order_odt.modules.php --- .../commande/doc/doc_generic_order_odt.modules.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index b753f323023..4694cdaf6ee 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -4,7 +4,7 @@ * Copyright (C) 2014 Marcos García * Copyright (C) 2016 Charlie Benke * Copyright (C) 2018-2019 Philippe Grand - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2019 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 @@ -177,11 +177,11 @@ class doc_generic_order_odt extends ModelePDFCommandes } $texte .= ''; } - // Add select to upload a new template file. TODO Copy this feature on other admin pages. - $texte.= '
'.$langs->trans("UploadNewTemplate").' '; - $texte.= ''; - $texte.= ''; - $texte.= '
'; + // Add input to upload a new template file. + $texte .= '
'.$langs->trans("UploadNewTemplate").' '; + $texte .= ''; + $texte .= ''; + $texte .= '
'; $texte .= ''; From 57a5416cbca7a3d2dee462d9926cfeca6a0efe37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 31 Dec 2019 14:20:39 +0100 Subject: [PATCH 078/784] Update doc_generic_proposal_odt.modules.php --- .../modules/propale/doc/doc_generic_proposal_odt.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index b4b3d2fb3e0..fde5f08d318 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -205,7 +205,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales $texte .= '
'.$form->select_dolusers(($search_user > 0 ? $search_user : -1), 'search_user', 1, null, 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200').''.$form->select_dolusers(($search_user > 0 ? $search_user : -1), 'search_user', 1, null, 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200').''.$form->selectyesno('search_valuebilled', $search_valuebilled, 1, false, 1).''.$form->selectyesno('search_valuebilled', $search_valuebilled, 1, false, 1).'
'; - if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) - { - if (empty($task_time->task_date_withhour)) - { - print $form->selectDate(($date2 ? $date2 : $date1), 'timeline', 3, 3, 2, "timespent_date", 1, 0); - } - else print $form->selectDate(($date2 ? $date2 : $date1), 'timeline', 1, 1, 2, "timespent_date", 1, 0); - } - else - { - print dol_print_date(($date2 ? $date2 : $date1), ($task_time->task_date_withhour ? 'dayhour' : 'day')); - } - print ''; + if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) + { + if (empty($task_time->task_date_withhour)) + { + print $form->selectDate(($date2 ? $date2 : $date1), 'timeline', 3, 3, 2, "timespent_date", 1, 0); + } + else print $form->selectDate(($date2 ? $date2 : $date1), 'timeline', 1, 1, 2, "timespent_date", 1, 0); + } + else + { + print dol_print_date(($date2 ? $date2 : $date1), ($task_time->task_date_withhour ? 'dayhour' : 'day')); + } + print ''; - $tasktmp->id = $task_time->fk_task; - $tasktmp->ref = $task_time->ref; - $tasktmp->label = $task_time->label; - print $tasktmp->getNomUrl(1, 'withproject', 'time'); - print ''; + $tasktmp->id = $task_time->fk_task; + $tasktmp->ref = $task_time->ref; + $tasktmp->label = $task_time->label; + print $tasktmp->getNomUrl(1, 'withproject', 'time'); + print ''; - print $task_time->label; - print ''; + print $task_time->label; + print ''; - if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) - { - if (empty($object->id)) $object->fetch($id); - $contactsoftask = $object->getListContactId('internal'); - if (!in_array($task_time->fk_user, $contactsoftask)) { - $contactsoftask[] = $task_time->fk_user; - } - if (count($contactsoftask) > 0) { - print img_object('', 'user', 'class="hideonsmartphone"'); - print $form->select_dolusers($task_time->fk_user, 'userid_line', 0, '', 0, '', $contactsoftask); - } else { - print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); - } - } - else - { - $userstatic->id = $task_time->fk_user; - $userstatic->lastname = $task_time->lastname; - $userstatic->firstname = $task_time->firstname; - $userstatic->photo = $task_time->photo; - $userstatic->statut = $task_time->user_status; - print $userstatic->getNomUrl(-1); - } - print ''; + if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) + { + if (empty($object->id)) $object->fetch($id); + $contactsoftask = $object->getListContactId('internal'); + if (!in_array($task_time->fk_user, $contactsoftask)) { + $contactsoftask[] = $task_time->fk_user; + } + if (count($contactsoftask) > 0) { + print img_object('', 'user', 'class="hideonsmartphone"'); + print $form->select_dolusers($task_time->fk_user, 'userid_line', 0, '', 0, '', $contactsoftask); + } else { + print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); + } + } + else + { + $userstatic->id = $task_time->fk_user; + $userstatic->lastname = $task_time->lastname; + $userstatic->firstname = $task_time->firstname; + $userstatic->photo = $task_time->photo; + $userstatic->statut = $task_time->user_status; + print $userstatic->getNomUrl(-1); + } + print ''; - if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) - { - print ''; - } - else - { - print dol_nl2br($task_time->note); - } - print ''; + if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) + { + print ''; + } + else + { + print dol_nl2br($task_time->note); + } + print ''; - if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) - { - print ''; - print $form->select_duration('new_duration', $task_time->task_duration, 0, 'text'); - } - else - { - print convertSecondToTime($task_time->task_duration, 'allhourmin'); - } - print ''; + if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) + { + print ''; + print $form->select_duration('new_duration', $task_time->task_duration, 0, 'text'); + } + else + { + print convertSecondToTime($task_time->task_duration, 'allhourmin'); + } + print ''; $value = price2num($task_time->thm * $task_time->task_duration / 3600); print price($value, 1, $langs, 1, -1, -1, $conf->currency); @@ -1390,51 +1390,51 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) $totalarray['val']['value'] += $value; if (!$i) $totalarray['totalvaluefield'] = $totalarray['nbfield']; $totalarray['totalvalue'] += $value; - } + } - // Invoiced - if (!empty($arrayfields['valuebilled']['checked'])) - { - print ''; // invoice_id and invoice_line_id - if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) - { - if ($projectstatic->usage_bill_time) - { - if ($task_time->invoice_id) - { - $result = $tmpinvoice->fetch($task_time->invoice_id); - if ($result > 0) - { - print $tmpinvoice->getNomUrl(1); - } - } - else - { - print $langs->trans("No"); - } - } - else - { - print ''.$langs->trans("NA").''; - } - } - print ''; // invoice_id and invoice_line_id + if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + if ($projectstatic->usage_bill_time) + { + if ($task_time->invoice_id) + { + $result = $tmpinvoice->fetch($task_time->invoice_id); + if ($result > 0) + { + print $tmpinvoice->getNomUrl(1); + } + } + else + { + print $langs->trans("No"); + } + } + else + { + print ''.$langs->trans("NA").''; + } + } + print ''; if (($action == 'editline' || $action == 'splitline') && $_GET['lineid'] == $task_time->rowid) { @@ -1443,19 +1443,19 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) print '
'; print ''; } - elseif ($user->rights->projet->lire || $user->rights->projet->all->creer) // Read project and enter time consumed on assigned tasks + elseif ($user->rights->projet->lire || $user->rights->projet->all->creer) // Read project and enter time consumed on assigned tasks { if ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids) || $user->rights->projet->all->creer) { - if ($conf->MAIN_FEATURES_LEVEL >= 2) - { - print ' '; - print 'rowid.$param.'">'; - print img_split(); - print ''; - } + if ($conf->MAIN_FEATURES_LEVEL >= 2) + { + print ' '; + print 'rowid.$param.'">'; + print img_split(); + print ''; + } - print ' '; + print ' '; print 'rowid.$param.'">'; print img_edit(); print ''; @@ -1465,17 +1465,17 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) print img_delete(); print ''; - if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { - $selected = 0; - if (in_array($task_time->rowid, $arrayofselected)) $selected = 1; - print ' '; - print ''; + $selected = 0; + if (in_array($task_time->rowid, $arrayofselected)) $selected = 1; + print ' '; + print ''; } - } + } } - print '
'; - if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) - { - if (empty($task_time->task_date_withhour)) - { - print $form->selectDate(($date2 ? $date2 : $date1), 'timeline', 3, 3, 2, "timespent_date", 1, 0); - } - else print $form->selectDate(($date2 ? $date2 : $date1), 'timeline', 1, 1, 2, "timespent_date", 1, 0); - } - else - { - print dol_print_date(($date2 ? $date2 : $date1), ($task_time->task_date_withhour ? 'dayhour' : 'day')); - } - print ''; + if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) + { + if (empty($task_time->task_date_withhour)) + { + print $form->selectDate(($date2 ? $date2 : $date1), 'timeline', 3, 3, 2, "timespent_date", 1, 0); + } + else print $form->selectDate(($date2 ? $date2 : $date1), 'timeline', 1, 1, 2, "timespent_date", 1, 0); + } + else + { + print dol_print_date(($date2 ? $date2 : $date1), ($task_time->task_date_withhour ? 'dayhour' : 'day')); + } + print ''; - $tasktmp->id = $task_time->fk_task; - $tasktmp->ref = $task_time->ref; - $tasktmp->label = $task_time->label; - print $tasktmp->getNomUrl(1, 'withproject', 'time'); - print ''; + $tasktmp->id = $task_time->fk_task; + $tasktmp->ref = $task_time->ref; + $tasktmp->label = $task_time->label; + print $tasktmp->getNomUrl(1, 'withproject', 'time'); + print ''; - print $task_time->label; - print ''; + print $task_time->label; + print ''; - if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) - { - if (empty($object->id)) $object->fetch($id); - $contactsoftask = $object->getListContactId('internal'); - if (!in_array($task_time->fk_user, $contactsoftask)) { - $contactsoftask[] = $task_time->fk_user; - } - if (count($contactsoftask) > 0) { - print img_object('', 'user', 'class="hideonsmartphone"'); - print $form->select_dolusers($task_time->fk_user, 'userid_line', 0, '', 0, '', $contactsoftask); - } else { - print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); - } - } - else - { - $userstatic->id = $task_time->fk_user; - $userstatic->lastname = $task_time->lastname; - $userstatic->firstname = $task_time->firstname; - $userstatic->photo = $task_time->photo; - $userstatic->statut = $task_time->user_status; - print $userstatic->getNomUrl(-1); - } - print ''; + if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) + { + if (empty($object->id)) $object->fetch($id); + $contactsoftask = $object->getListContactId('internal'); + if (!in_array($task_time->fk_user, $contactsoftask)) { + $contactsoftask[] = $task_time->fk_user; + } + if (count($contactsoftask) > 0) { + print img_object('', 'user', 'class="hideonsmartphone"'); + print $form->select_dolusers($task_time->fk_user, 'userid_line', 0, '', 0, '', $contactsoftask); + } else { + print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); + } + } + else + { + $userstatic->id = $task_time->fk_user; + $userstatic->lastname = $task_time->lastname; + $userstatic->firstname = $task_time->firstname; + $userstatic->photo = $task_time->photo; + $userstatic->statut = $task_time->user_status; + print $userstatic->getNomUrl(-1); + } + print ''; - if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) - { - print ''; - } - else - { - print dol_nl2br($task_time->note); - } - print ''; + if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) + { + print ''; + } + else + { + print dol_nl2br($task_time->note); + } + print ''; - if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) - { - print ''; - print $form->select_duration('new_duration', $task_time->task_duration, 0, 'text'); - } - else - { - print convertSecondToTime($task_time->task_duration, 'allhourmin'); - } - print ''; + if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) + { + print ''; + print $form->select_duration('new_duration', $task_time->task_duration, 0, 'text'); + } + else + { + print convertSecondToTime($task_time->task_duration, 'allhourmin'); + } + print ''; - $value = price2num($task_time->thm * $task_time->task_duration / 3600); - print price($value, 1, $langs, 1, -1, -1, $conf->currency); - print ''; + $value = price2num($task_time->thm * $task_time->task_duration / 3600); + print price($value, 1, $langs, 1, -1, -1, $conf->currency); + print ''; - $valuebilled = price2num($task_time->total_ht); - if (isset($task_time->total_ht)) print price($valuebilled, 1, $langs, 1, -1, -1, $conf->currency); - print ''; + $valuebilled = price2num($task_time->total_ht); + if (isset($task_time->total_ht)) print price($valuebilled, 1, $langs, 1, -1, -1, $conf->currency); + print ''; - print ''; + print '
'; - if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) - { - if (empty($task_time->task_date_withhour)) - { - print $form->selectDate(($date2 ? $date2 : $date1), 'timeline_2', 3, 3, 2, "timespent_date", 1, 0); - } - else print $form->selectDate(($date2 ? $date2 : $date1), 'timeline_2', 1, 1, 2, "timespent_date", 1, 0); - } - else - { - print dol_print_date(($date2 ? $date2 : $date1), ($task_time->task_date_withhour ? 'dayhour' : 'day')); - } - print ''; + if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) + { + if (empty($task_time->task_date_withhour)) + { + print $form->selectDate(($date2 ? $date2 : $date1), 'timeline_2', 3, 3, 2, "timespent_date", 1, 0); + } + else print $form->selectDate(($date2 ? $date2 : $date1), 'timeline_2', 1, 1, 2, "timespent_date", 1, 0); + } + else + { + print dol_print_date(($date2 ? $date2 : $date1), ($task_time->task_date_withhour ? 'dayhour' : 'day')); + } + print ''; - $tasktmp->id = $task_time->fk_task; - $tasktmp->ref = $task_time->ref; - $tasktmp->label = $task_time->label; - print $tasktmp->getNomUrl(1, 'withproject', 'time'); - print ''; + $tasktmp->id = $task_time->fk_task; + $tasktmp->ref = $task_time->ref; + $tasktmp->label = $task_time->label; + print $tasktmp->getNomUrl(1, 'withproject', 'time'); + print ''; - print $task_time->label; - print ''; + print $task_time->label; + print ''; - if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) - { - if (empty($object->id)) $object->fetch($id); - $contactsoftask = $object->getListContactId('internal'); - if (!in_array($task_time->fk_user, $contactsoftask)) { - $contactsoftask[] = $task_time->fk_user; - } - if (count($contactsoftask) > 0) { - print img_object('', 'user', 'class="hideonsmartphone"'); - print $form->select_dolusers($task_time->fk_user, 'userid_line_2', 0, '', 0, '', $contactsoftask); - } else { - print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); - } - } - else - { - $userstatic->id = $task_time->fk_user; - $userstatic->lastname = $task_time->lastname; - $userstatic->firstname = $task_time->firstname; - $userstatic->photo = $task_time->photo; - $userstatic->statut = $task_time->user_status; - print $userstatic->getNomUrl(-1); - } - print ''; + if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) + { + if (empty($object->id)) $object->fetch($id); + $contactsoftask = $object->getListContactId('internal'); + if (!in_array($task_time->fk_user, $contactsoftask)) { + $contactsoftask[] = $task_time->fk_user; + } + if (count($contactsoftask) > 0) { + print img_object('', 'user', 'class="hideonsmartphone"'); + print $form->select_dolusers($task_time->fk_user, 'userid_line_2', 0, '', 0, '', $contactsoftask); + } else { + print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); + } + } + else + { + $userstatic->id = $task_time->fk_user; + $userstatic->lastname = $task_time->lastname; + $userstatic->firstname = $task_time->firstname; + $userstatic->photo = $task_time->photo; + $userstatic->statut = $task_time->user_status; + print $userstatic->getNomUrl(-1); + } + print ''; - if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) - { - print ''; - } - else - { - print dol_nl2br($task_time->note); - } - print ''; + if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) + { + print ''; + } + else + { + print dol_nl2br($task_time->note); + } + print ''; - if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) - { - print ''; - print $form->select_duration('new_duration_2', 0, 0, 'text'); - } - else - { - print convertSecondToTime($task_time->task_duration, 'allhourmin'); - } - print ''; + if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) + { + print ''; + print $form->select_duration('new_duration_2', 0, 0, 'text'); + } + else + { + print convertSecondToTime($task_time->task_duration, 'allhourmin'); + } + print ''; - $value = 0; - print price($value, 1, $langs, 1, -1, -1, $conf->currency); - print ''; + $value = 0; + print price($value, 1, $langs, 1, -1, -1, $conf->currency); + print ''; - $valuebilled = price2num($task_time->total_ht); - if (isset($task_time->total_ht)) print price($valuebilled, 1, $langs, 1, -1, -1, $conf->currency); - print ''; + $valuebilled = price2num($task_time->total_ht); + if (isset($task_time->total_ht)) print price($valuebilled, 1, $langs, 1, -1, -1, $conf->currency); + print ''; - print ''; + print '
'; } } - // Add select to upload a new template file. TODO Copy this feature on other admin pages. + // Add input to upload a new template file. $texte .= '
'.$langs->trans("UploadNewTemplate").' '; $texte .= ''; $texte .= ''; From 4f65f8d0950d07f3bc78e772526e55b8364878a5 Mon Sep 17 00:00:00 2001 From: Guillaume Matheron Date: Thu, 2 Jan 2020 14:13:26 +0100 Subject: [PATCH 079/784] Fixed bug (missing include) in formmargin.class.php, affecting display of propal --- htdocs/core/class/html.formmargin.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index 345a94b3a62..1f091fc81fd 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -21,6 +21,8 @@ * \brief Fichier de la classe des fonctions predefinie de composants html autre */ +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + /** * Classe permettant la generation de composants html autre From e9e0aae1ce8634cf1b2769404734bde76d2669c1 Mon Sep 17 00:00:00 2001 From: Guillaume Matheron Date: Thu, 2 Jan 2020 14:59:53 +0100 Subject: [PATCH 080/784] Added option to bill time spent on a task to an existing draft invoice (for instance a recurrent bill) --- htdocs/core/class/html.form.class.php | 167 ++++++++++++++++++++++++++ htdocs/projet/tasks/time.php | 27 ++++- 2 files changed, 188 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6b0950b4f8d..4681a9f749a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7839,4 +7839,171 @@ class Form return $out; } + + /** + * Output a combo list with invoices qualified for a third party + * + * @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id) + * @param int $selected Id invoice preselected + * @param string $htmlname Name of HTML select + * @param int $maxlength Maximum length of label + * @param int $option_only Return only html options lines without the select tag + * @param string $show_empty Add an empty line ('1' or string to show for empty line) + * @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable) + * @param int $forcefocus Force focus on field (works with javascript only) + * @param int $disabled Disabled + * @param string $morecss More css added to the select component + * @param string $projectsListId ''=Automatic filter on project allowed. List of id=Filter on project ids. + * @param string $showproject 'all' = Show project info, ''=Hide project info + * @param User $usertofilter User object to use for filtering + * @return int Nbr of project if OK, <0 if KO + */ + public function selectInvoice($socid = -1, $selected = '', $htmlname = 'invoiceid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showproject = 'all', $usertofilter = null) + { + global $user,$conf,$langs; + + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + + if (is_null($usertofilter)) + { + $usertofilter = $user; + } + + $out=''; + + $hideunselectables = false; + if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true; + + if (empty($projectsListId)) + { + if (empty($usertofilter->rights->projet->all->lire)) + { + $projectstatic=new Project($this->db); + $projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertofilter, 0, 1); + } + } + + // Search all projects + $sql = 'SELECT f.rowid, f.ref as fref, "nolabel" as flabel, p.rowid as pid, f.ref, + p.title, p.fk_soc, p.fk_statut, p.public,'; + $sql.= ' s.nom as name'; + $sql.= ' FROM '.MAIN_DB_PREFIX .'projet as p'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc,'; + $sql.= ' '.MAIN_DB_PREFIX.'facture as f'; + $sql.= " WHERE p.entity IN (".getEntity('project').")"; + $sql.= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement + //if ($projectsListId) $sql.= " AND p.rowid IN (".$projectsListId.")"; + //if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; + //if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)"; + $sql.= " GROUP BY f.ref ORDER BY p.ref, f.ref ASC"; + + $resql=$this->db->query($sql); + if ($resql) + { + // Use select2 selector + if (! empty($conf->use_javascript_ajax)) + { + include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; + $comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus); + $out.=$comboenhancement; + $morecss='minwidth200imp maxwidth500'; + } + + if (empty($option_only)) { + $out.= ''; + } + + print $out; + + $this->db->free($resql); + return $num; + } + else + { + dol_print_error($this->db); + return -1; + } + } } diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 1f692386c74..485ba8bf173 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -343,6 +343,7 @@ if ($action == 'confirm_generateinvoice') $db->begin(); $idprod = GETPOST('productid', 'int'); $generateinvoicemode = GETPOST('generateinvoicemode', 'string'); + $invoiceToUse = GETPOST('invoiceid', 'int'); if ($idprod > 0) { @@ -366,12 +367,17 @@ if ($action == 'confirm_generateinvoice') $tmpinvoice->date = dol_mktime(GETPOST('rehour', 'int'), GETPOST('remin', 'int'), GETPOST('resec', 'int'), GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $tmpinvoice->fk_project = $projectstatic->id; - $result = $tmpinvoice->create($user); - if ($result <= 0) - { - $error++; - setEventMessages($tmpinvoice->error, $tmpinvoice->errors, 'errors'); - } + if ($invoiceToUse) { + $tmpinvoice->fetch($invoiceToUse); + } + else { + $result = $tmpinvoice->create($user); + if ($result <= 0) + { + $error++; + setEventMessages($tmpinvoice->error, $tmpinvoice->errors, 'errors'); + } + } if (!$error) { @@ -947,6 +953,15 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) print '
'; + print $langs->trans('InvoiceToUse'); + print ''; + $form->selectInvoice('invoice', '', 'invoiceid',24,0,$langs->trans('NewInvoice'), + 1,0,0,'maxwidth500','','all'); + print '
'; print $langs->trans('ValidateInvoices'); From 92f50f635702b83b93352cabf99b4197807222a9 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 2 Jan 2020 14:00:39 +0000 Subject: [PATCH 081/784] Fixing style errors. --- htdocs/projet/tasks/time.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 485ba8bf173..78eed257ce5 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -958,8 +958,8 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) print $langs->trans('InvoiceToUse'); print ''; - $form->selectInvoice('invoice', '', 'invoiceid',24,0,$langs->trans('NewInvoice'), - 1,0,0,'maxwidth500','','all'); + $form->selectInvoice('invoice', '', 'invoiceid', 24, 0, $langs->trans('NewInvoice'), + 1, 0, 0, 'maxwidth500', '', 'all'); print '
'.$langs->trans('DateInvoice').''; @@ -3223,14 +3223,14 @@ if ($action == 'create') if (!empty($conf->global->INVOICE_POINTOFTAX_DATE)) { print '
'.$langs->trans('DatePointOfTax').''; - $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); + $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int')); print $form->selectDate($date_pointoftax ? $date_pointoftax : -1, 'date_pointoftax', '', '', '', "add", 1, 1); print '
'.$langs->trans('PaymentConditionsShort').''; - $form->select_conditions_paiements(isset($_POST['cond_reglement_id']) ? $_POST['cond_reglement_id'] : $cond_reglement_id, 'cond_reglement_id'); + $form->select_conditions_paiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id'); print '
'; - if ($modecompta != 'CREANCES-DETTES') - { + if ($modecompta == 'RECETTES-DEPENSES') { if ($key > 0) { - print ''; + //print ''; } else { - print ''; + //print ''; } - } else { + } + elseif ($modecompta == 'CREANCES-DETTES') { if ($key > 0) { print ''; } else { - print ''; + //print ''; } print price($amount_ht[$key]); + if ($key > 0) print ''; } print ''; - if ($modecompta != 'CREANCES-DETTES') { + if ($modecompta == 'RECETTES-DEPENSES') { if ($key > 0) { - print ''; + //print ''; } else { - print ''; + //print ''; } - } else { + } + elseif ($modecompta == 'CREANCES-DETTES') { if ($key > 0) { print ''; } else { - print ''; + //print ''; } } print price($amount[$key]); + if ($modecompta == 'RECETTES-DEPENSES') { + if ($key > 0) { + //print ''; + } else { + //print ''; + } + } + elseif ($modecompta == 'CREANCES-DETTES') { + if ($key > 0) { + print ''; + } + } print '
'; - $tooltip=$langs->trans("GenericMaskCodes", $langs->transnoentities("Bom"), $langs->transnoentities("Bom")); + $tooltip=$langs->trans("GenericMaskCodes", $langs->transnoentities("MyObject"), $langs->transnoentities("MyObject")); $tooltip.=$langs->trans("GenericMaskCodes2"); $tooltip.=$langs->trans("GenericMaskCodes3"); - $tooltip.=$langs->trans("GenericMaskCodes4a", $langs->transnoentities("Bom"), $langs->transnoentities("Bom")); + $tooltip.=$langs->trans("GenericMaskCodes4a", $langs->transnoentities("MyObject"), $langs->transnoentities("MyObject")); $tooltip.=$langs->trans("GenericMaskCodes5"); // Parametrage du prefix $texte.= ''; - $texte.= ''; + $texte.= ''; $texte.= ''; @@ -137,9 +137,9 @@ class mod_myobject_advanced extends ModeleNumRefMyObject return 0; } - $date = ($object->date_bom ? $object->date_bom : $object->date); + $date = $object->date; - $numFinal=get_next_value($db, $mask, 'bom_bom', 'ref', '', null, $date); + $numFinal=get_next_value($db, $mask, 'mymodule_myobject', 'ref', '', null, $date); return $numFinal; } diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php index 0da53adb55f..f9a786dfe55 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php @@ -18,11 +18,12 @@ */ /** - * \file htdocs/core/modules/bom/mod_bom_standard.php - * \ingroup bom + * \file htdocs/core/modules/mymodule/mod_myobject_standard.php + * \ingroup mymodule * \brief File of class to manage MyObject numbering rules standard */ -require_once DOL_DOCUMENT_ROOT .'/core/modules/bom/modules_bom.php'; +dol_include_once('/mymodule/core/modules/mymodule/modules_myobject.php'); + /** * Class to manage customer order numbering rules standard @@ -85,7 +86,7 @@ class mod_myobject_standard extends ModeleNumRefMyObject $posindice=8; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; - $sql.= " FROM ".MAIN_DB_PREFIX."bom"; + $sql.= " FROM ".MAIN_DB_PREFIX."mymodule_myobject"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; $sql.= " AND entity = ".$conf->entity; @@ -119,7 +120,7 @@ class mod_myobject_standard extends ModeleNumRefMyObject // D'abord on recupere la valeur max $posindice=9; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; - $sql.= " FROM ".MAIN_DB_PREFIX."bom_bom"; + $sql.= " FROM ".MAIN_DB_PREFIX."mymodule_myobject"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; $sql.= " AND entity = ".$conf->entity; @@ -132,7 +133,7 @@ class mod_myobject_standard extends ModeleNumRefMyObject } else { - dol_syslog("mod_bom_standard::getNextValue", LOG_DEBUG); + dol_syslog("mod_myobject_standard::getNextValue", LOG_DEBUG); return -1; } @@ -143,7 +144,7 @@ class mod_myobject_standard extends ModeleNumRefMyObject if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is else $num = sprintf("%04s", $max+1); - dol_syslog("mod_bom_standard::getNextValue return ".$this->prefix.$yymm."-".$num); + dol_syslog("mod_myobject_standard::getNextValue return ".$this->prefix.$yymm."-".$num); return $this->prefix.$yymm."-".$num; } } diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php b/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php index 4598a010287..5aa9642a898 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php @@ -23,10 +23,9 @@ */ /** - * \file htdocs/core/modules/bom/modules_bom.php - * \ingroup bom - * \brief File that contains parent class for boms models - * and parent class for boms numbering models + * \file htdocs/core/modules/mymodule/modules_myobject.php + * \ingroup mymodule + * \brief File that contains parent class for myobjects document models and parent class for myobjects numbering models */ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; @@ -34,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir /** - * Parent class for boms models + * Parent class for documents models */ abstract class ModelePDFMyObject extends CommonDocGenerator { @@ -52,7 +51,7 @@ abstract class ModelePDFMyObject extends CommonDocGenerator // phpcs:enable global $conf; - $type = 'bom'; + $type = 'mymodule_myobject'; $list = array(); include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; @@ -65,7 +64,7 @@ abstract class ModelePDFMyObject extends CommonDocGenerator /** - * Parent class to manage numbering of BOMs + * Parent class to manage numbering of MyObject */ abstract class ModeleNumRefMyObject { @@ -92,7 +91,7 @@ abstract class ModeleNumRefMyObject public function info() { global $langs; - $langs->load("mrp"); + $langs->load("mymodule@mymodule"); return $langs->trans("NoDescription"); } @@ -104,7 +103,7 @@ abstract class ModeleNumRefMyObject public function getExample() { global $langs; - $langs->load("mrp"); + $langs->load("mymodule@mymodule"); return $langs->trans("NoExample"); } diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 415e7cc7f99..840e46c9c1c 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -182,25 +182,39 @@ if (empty($reshook)) } } - if (! $error) { - // Record consumption - $moline = new MoLine($db); - - $result = $moline->create($user); - if ($result <= 0) { + $idstockmove = 0; + if (! $error && GETPOST('idwarehouse-'.$line->id.'-'.$i) > 0) { + // Record stock movement + $id_product_batch = 0; + $idstockmove = $stockmove->livraison($user, $line->fk_product, GETPOST('idwarehouse-'.$line->id.'-'.$i), GETPOST('qty-'.$line->id.'-'.$i), 0, $labelmovement, dol_now(), '', '', GETPOST('batch-'.$line->id.'-'.$i), $id_product_batch, $codemovement); + if ($idstockmove < 0) { $error++; - setEventMessages($moline->error, $moline->errors, 'errors'); + setEventMessages($stockmove->error, $stockmove->errors, 'errors'); } } if (! $error) { - // Record stock movement - $id_product_batch = 0; - $result = $stockmove->livraison($user, $line->fk_product, GETPOST('idwarehouse-'.$line->id.'-'.$i), GETPOST('qty-'.$line->id.'-'.$i), 0, $labelmovement, dol_now(), '', '', GETPOST('batch-'.$line->id.'-'.$i), $id_product_batch, $codemovement); - if ($result <= 0) { + $pos = 0; + // Record consumption + $moline = new MoLine($db); + $moline->fk_mo = $object->id; + $moline->position = $pos; + $moline->fk_product = $line->fk_product; + $moline->fk_warehouse = GETPOST('idwarehouse-'.$line->id.'-'.$i); + $moline->qty = GETPOST('qty-'.$line->id.'-'.$i); + $moline->batch = GETPOST('batch-'.$line->id.'-'.$i); + $moline->role = 'consumed'; + $moline->fk_mrp_production = $line->id; + $moline->fk_stock_movement = $idstockmove; + $moline->fk_user_creat = $user->id; + + $resultmoline = $moline->create($user); + if ($resultmoline <= 0) { $error++; - setEventMessages($stockmove->error, $stockmove->errors, 'errors'); + setEventMessages($moline->error, $moline->errors, 'errors'); } + + $pos++; } $i++; @@ -230,25 +244,39 @@ if (empty($reshook)) } } - if (! $error) { - // Record production - $moline = new MoLine($db); - - $result = $moline->create($user); - if ($result <= 0) { + $idstockmove = 0; + if (! $error && GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i) > 0) { + // Record stock movement + $id_product_batch = 0; + $idstockmove = $stockmove->reception($user, $line->fk_product, GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i), GETPOST('qtytoproduce-'.$line->id.'-'.$i), 0, $labelmovement, dol_now(), '', '', GETPOST('batchtoproduce-'.$line->id.'-'.$i), $id_product_batch, $codemovement); + if ($idstockmove < 0) { $error++; - setEventMessages($moline->error, $moline->errors, 'errors'); + setEventMessages($stockmove->error, $stockmove->errors, 'errors'); } } if (! $error) { - // Record stock movement - $id_product_batch = 0; - $result = $stockmove->reception($user, $line->fk_product, GETPOST('idwarehouse-'.$line->id.'-'.$i), GETPOST('qty-'.$line->id.'-'.$i), 0, $labelmovement, dol_now(), '', '', GETPOST('batch-'.$line->id.'-'.$i), $id_product_batch, $codemovement); - if ($result <= 0) { + $pos = 0; + // Record production + $moline = new MoLine($db); + $moline->fk_mo = $object->id; + $moline->position = $pos; + $moline->fk_product = $line->fk_product; + $moline->fk_warehouse = GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i); + $moline->qty = GETPOST('qtytoproduce-'.$line->id.'-'.$i); + $moline->batch = GETPOST('batchtoproduce-'.$line->id.'-'.$i); + $moline->role = 'produced'; + $moline->fk_mrp_production = $line->id; + $moline->fk_stock_movement = $idstockmove; + $moline->fk_user_creat = $user->id; + + $resultmoline = $moline->create($user); + if ($resultmoline <= 0) { $error++; - setEventMessages($stockmove->error, $stockmove->errors, 'errors'); + setEventMessages($moline->error, $moline->errors, 'errors'); } + + $pos++; } $i++; @@ -261,9 +289,13 @@ if (empty($reshook)) $qtyremaintoconsume = 0; $qtyremaintoproduce = 0; if ($qtyremaintoconsume == 0 && $qtyremaintoproduce == 0) { - $object->setStatut($object::STATUS_INPROGRESS); + $result = $object->setStatut($object::STATUS_INPROGRESS, 0, '', 'MRP_MO_PRODUCED'); } else { - $object->setStatut($object::STATUS_PRODUCED); + $result = $object->setStatut($object::STATUS_PRODUCED, 0, '', 'MRP_MO_PRODUCED'); + } + if ($result <= 0) { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -273,13 +305,11 @@ if (empty($reshook)) } else { $db->commit(); } - } } - /* * View */ @@ -498,12 +528,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($action == 'consumeandproduceall') { $defaultstockmovementlabel = GETPOST('inventorylabel', 'alphanohtml') ? GETPOST('inventorylabel', 'alphanohtml') : $langs->trans("ProductionForRefAndDate", $object->ref, dol_print_date(dol_now(), 'standard')); - $defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $object->ref.'_'.dol_print_date(dol_now(), 'dayhourlog'); + //$defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $object->ref.'_'.dol_print_date(dol_now(), 'dayhourlog'); + $defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $object->ref; print '
'; print ''.$langs->trans("ConfirmProductionDesc", $langs->transnoentitiesnoconv("Confirm")).'
'; print $langs->trans("MovementLabel").':   '; - print $langs->trans("InventoryCode").':

'; + print $langs->trans("InventoryCode").':

'; print ' '.$langs->trans("AutoCloseMO").'
'; print ''; print '   '; diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index a85b375b085..c50d816f14f 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -97,7 +97,7 @@ class MouvementStock extends CommonObject * @param int $entrepot_id Id of warehouse * @param int $qty Qty of movement (can be <0 or >0 depending on parameter type) * @param int $type Direction of movement: - * 0=input (stock increase by a stock transfer), 1=output (stock decrease after by a stock transfer), + * 0=input (stock increase by a stock transfer), 1=output (stock decrease by a stock transfer), * 2=output (stock decrease), 3=input (stock increase) * Note that qty should be > 0 with 0 or 3, < 0 with 1 or 2. * @param int $price Unit price HT of product, used to calculate average weighted price (PMP in french). If 0, average weighted price is not changed. diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 1357f9a86bb..f91ec5e0653 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -843,7 +843,11 @@ if (!$source) { $found = true; $tag = GETPOST("tag", 'alpha'); - $fulltag = "TAG=".$tag; + if (GETPOST('fulltag', 'alpha')) { + $fulltag = GETPOST('fulltag', 'alpha'); + } else { + $fulltag = "TAG=".$tag; + } // Creditor print '
'; print ''; print '
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 1).' 
'.$langs->trans("Creditor"); @@ -910,8 +914,12 @@ if ($source == 'order') $amount = price2num($amount); } - $fulltag = 'ORD='.$order->id.'.CUS='.$order->thirdparty->id; - if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } + if (GETPOST('fulltag', 'alpha')) { + $fulltag = GETPOST('fulltag', 'alpha'); + } else { + $fulltag = 'ORD='.$order->id.'.CUS='.$order->thirdparty->id; + if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } + } $fulltag = dol_string_unaccent($fulltag); // Creditor @@ -1029,9 +1037,12 @@ if ($source == 'invoice') $amount = price2num($amount); } - $fulltag = 'INV='.$invoice->id.'.CUS='.$invoice->thirdparty->id; - //$fulltag.='.NAM='.strtr($invoice->thirdparty->name,"-"," "); - if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } + if (GETPOST('fulltag', 'alpha')) { + $fulltag = GETPOST('fulltag', 'alpha'); + } else { + $fulltag = 'INV='.$invoice->id.'.CUS='.$invoice->thirdparty->id; + if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } + } $fulltag = dol_string_unaccent($fulltag); // Creditor @@ -1202,9 +1213,12 @@ if ($source == 'contractline') $amount = price2num($amount); } - $fulltag = 'COL='.$contractline->id.'.CON='.$contract->id.'.CUS='.$contract->thirdparty->id.'.DAT='.dol_print_date(dol_now(), '%Y%m%d%H%M'); - //$fulltag.='.NAM='.strtr($contract->thirdparty->name,"-"," "); - if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } + if (GETPOST('fulltag', 'alpha')) { + $fulltag = GETPOST('fulltag', 'alpha'); + } else { + $fulltag = 'COL='.$contractline->id.'.CON='.$contract->id.'.CUS='.$contract->thirdparty->id.'.DAT='.dol_print_date(dol_now(), '%Y%m%d%H%M%S'); + if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } + } $fulltag = dol_string_unaccent($fulltag); $qty = 1; @@ -1367,8 +1381,12 @@ if ($source == 'membersubscription') $amount = price2num($amount); } - $fulltag = 'MEM='.$member->id.'.DAT='.dol_print_date(dol_now(), '%Y%m%d%H%M'); - if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } + if (GETPOST('fulltag', 'alpha')) { + $fulltag = GETPOST('fulltag', 'alpha'); + } else { + $fulltag = 'MEM='.$member->id.'.DAT='.dol_print_date(dol_now(), '%Y%m%d%H%M%S'); + if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } + } $fulltag = dol_string_unaccent($fulltag); // Creditor @@ -1531,8 +1549,12 @@ if ($source == 'donation') $amount = price2num($amount); } - $fulltag = 'DON='.$don->ref.'.DAT='.dol_print_date(dol_now(), '%Y%m%d%H%M'); - if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } + if (GETPOST('fulltag', 'alpha')) { + $fulltag = GETPOST('fulltag', 'alpha'); + } else { + $fulltag = 'DON='.$don->ref.'.DAT='.dol_print_date(dol_now(), '%Y%m%d%H%M%S'); + if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } + } $fulltag = dol_string_unaccent($fulltag); // Creditor diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 55a4f3813e9..c8c535a9038 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -5173,9 +5173,17 @@ dd.dropdowndd ul li { /* ============================================================================== */ -/* JMobile */ +/* JMobile - Android */ /* ============================================================================== */ +.searchpage .tagtr .tagtd { + padding-bottom: 3px; +} +.searchpage .tagtr .tagtd .button { + background: unset; + border: unset; +} + li.ui-li-divider .ui-link { color: #FFF !important; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 604bc743f93..50c637be3c9 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -5306,9 +5306,17 @@ dd.dropdowndd ul li { /* ============================================================================== */ -/* JMobile */ +/* JMobile - Android */ /* ============================================================================== */ +.searchpage .tagtr .tagtd { + padding-bottom: 3px; +} +.searchpage .tagtr .tagtd .button { + background: unset; + border: unset; +} + li.ui-li-divider .ui-link { color: #FFF !important; } From d9d70c10b35ed8e50278c53420f98cb38f0f769a Mon Sep 17 00:00:00 2001 From: Guillaume Lafarge Date: Wed, 8 Jan 2020 10:25:58 +0100 Subject: [PATCH 089/784] Add native spellcheck to CKEditor As the native spell checker is disabled by default, this PR removes the default behaviour and restore it to check for spelling and grammar in wysiwyg editor. See : https://ckeditor.com/docs/ckeditor4/latest/features/spellcheck.html#native-browser-spell-checker --- htdocs/core/class/doleditor.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 29bb1c24dce..e524d174e03 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -225,7 +225,8 @@ class DolEditor breakAfterClose : true }); } - }'; + }, + disableNativeSpellChecker: false'; if ($this->uselocalbrowser) { From b7e4d4904fb302ca3080f26c1d2b2abe31b1c22c Mon Sep 17 00:00:00 2001 From: Guillaume Matheron Date: Mon, 13 Jan 2020 14:34:38 +0100 Subject: [PATCH 090/784] Revert "Add document date instead of creation date when exporting FEC file" This reverts commit d13e1ddcdf7d2b89fdc372a149679913173367ba. --- htdocs/accountancy/class/accountancyexport.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index a702244b65b..46b7a532a35 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -718,7 +718,7 @@ class AccountancyExport print $line->piece_num.$separator; // FEC:EcritureDate - print $date_doc.$separator; + print $date_creation.$separator; // FEC:CompteNum print $line->numero_compte.$separator; From 226dbceac05a5fab80e6230a703763bcffaafd30 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Mon, 13 Jan 2020 17:11:50 +0100 Subject: [PATCH 091/784] Update functions.lib.php --- htdocs/core/lib/functions.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 75a7efe53d2..7e04eb590b6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6036,7 +6036,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null)); $substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null); $substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs) : ''); - + $substitutionarray['__SUPPLIER_ORDER_DELAY_DELIVERY__'] = (isset($object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : ''); + $birthday = dol_print_date($object->birth, 'day'); if ($object->id > 0) From f3046589e750c4eb8178f9253a247e9586303745 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Mon, 13 Jan 2020 18:19:51 +0100 Subject: [PATCH 092/784] Update functions.lib.php --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7e04eb590b6..18c31826fd1 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6037,7 +6037,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null); $substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs) : ''); $substitutionarray['__SUPPLIER_ORDER_DELAY_DELIVERY__'] = (isset($object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : ''); - + $birthday = dol_print_date($object->birth, 'day'); if ($object->id > 0) From dcba3d5c7c761668ea7f1faa6b15775faf5bf46a Mon Sep 17 00:00:00 2001 From: TuxGasy Date: Mon, 13 Jan 2020 23:00:06 +0100 Subject: [PATCH 093/784] New: Professional identifiers for Roumania --- htdocs/langs/en_US/companies.lang | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 78f474ff96a..c569a48c84a 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -247,6 +247,12 @@ ProfId3US=- ProfId4US=- ProfId5US=- ProfId6US=- +ProfId1RO=Prof Id 1 (CUI) +ProfId2RO=Prof Id 2 (Nr. Înmatriculare) +ProfId3RO=Prof Id 3 (CAEN) +ProfId4RO=- +ProfId5RO=Prof Id 5 (EUID) +ProfId6RO=- ProfId1RU=Prof Id 1 (OGRN) ProfId2RU=Prof Id 2 (INN) ProfId3RU=Prof Id 3 (KPP) From ef5c1e6c8c6c2116139deae9e4e164f19e92a6d7 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Mon, 13 Jan 2020 23:09:08 +0000 Subject: [PATCH 094/784] Update functions.lib.php --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 18c31826fd1..ad234a02cef 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6036,7 +6036,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null)); $substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null); $substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs) : ''); - $substitutionarray['__SUPPLIER_ORDER_DELAY_DELIVERY__'] = (isset($object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : ''); + $substitutionarray['__SUPPLIER_ORDER_DELAY_DELIVERY__'] = (isset($object->availability_code) ? $outputlangs->transnoentities($object->availability) : ''); $birthday = dol_print_date($object->birth, 'day'); From 43aa5ec6580a379ff668ad8a45b9b166ac8aa349 Mon Sep 17 00:00:00 2001 From: Norbert Penel Date: Tue, 14 Jan 2020 15:31:41 +0100 Subject: [PATCH 095/784] Dbf -> Db & import from table 1 Import a BIG DBF (aka excel openoffice) into a new table then you can see and search content easily 2 Create thirdparties or products from a table --- dev/initdata/import-dbf.php | 220 +++++++++++++++ dev/initdata/importdb-products.php | 241 ++++++++++++++++ dev/initdata/importdb-thirdparties.php | 355 ++++++++++++++++++++++++ dev/initdata/includes/dbase.class.php | 362 +++++++++++++++++++++++++ 4 files changed, 1178 insertions(+) create mode 100644 dev/initdata/import-dbf.php create mode 100644 dev/initdata/importdb-products.php create mode 100644 dev/initdata/importdb-thirdparties.php create mode 100644 dev/initdata/includes/dbase.class.php diff --git a/dev/initdata/import-dbf.php b/dev/initdata/import-dbf.php new file mode 100644 index 00000000000..954f1c8b2ec --- /dev/null +++ b/dev/initdata/import-dbf.php @@ -0,0 +1,220 @@ +#!/usr/bin/env php + + * Copyright (C) 2016 Juanjo Menent + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * WARNING, THIS WILL LOAD MASS DATA ON YOUR INSTANCE + */ + +/** + * \file dev/initdata/import-product.php + * \brief Script example to create a table from a large DBF file (openoffice) + * To purge data, you can have a look at purge-data.php + */ +// Test si mode batch +$sapi_type = php_sapi_name(); +$script_file = basename(__FILE__); + +$path = dirname(__FILE__) . '/'; +if (substr($sapi_type, 0, 3) == 'cgi') { + echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + exit; +} + +// Recupere root dolibarr +$path = dirname($_SERVER["PHP_SELF"]); +require $path . "./../htdocs/master.inc.php"; +require $path . "/includes/dbase.class.php"; + +// Global variables +$version = DOL_VERSION; +$confirmed = 1; +$error = 0; + + +/* + * Main + */ + +@set_time_limit(0); +print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n"; +dol_syslog($script_file . " launched with arg " . implode(',', $argv)); + + +$filepath = $argv[1]; +$filepatherr = $filepath . '.err'; +$startchar = empty($argv[2]) ? 0 : (int) $argv[2]; +$deleteTable = empty($argv[3]) ? 1 : 0; +$startlinenb = empty($argv[3]) ? 1 : (int) $argv[3]; +$endlinenb = empty($argv[4]) ? 0 : (int) $argv[4]; + +if (empty($filepath)) { + print "Usage: php $script_file myfilepath.dbf [removeChatColumnName] [startlinenb] [endlinenb]\n"; + print "Example: php $script_file myfilepath.dbf 0 2 1002\n"; + print "\n"; + exit(-1); +} +if (!file_exists($filepath)) { + print "Error: File " . $filepath . " not found.\n"; + print "\n"; + exit(-1); +} + +$ret = $user->fetch('', 'admin'); +if (!$ret > 0) { + print 'A user with login "admin" and all permissions must be created to use this script.' . "\n"; + exit; +} +$user->getrights(); + +// Ask confirmation +if (!$confirmed) { + print "Hit Enter to continue or CTRL+C to stop...\n"; + $input = trim(fgets(STDIN)); +} + +// Open input and output files +$fhandle = dbase_open($filepath, 0); +if (!$fhandle) { + print 'Error: Failed to open file ' . $filepath . "\n"; + exit(1); +} +$fhandleerr = fopen($filepatherr, 'w'); +if (!$fhandleerr) { + print 'Error: Failed to open file ' . $filepatherr . "\n"; + exit(1); +} + +$langs->setDefaultLang($defaultlang); + +$record_numbers = dbase_numrecords($fhandle); +$table_name = substr(basename($filepath), 0, strpos(basename($filepath), '.')); +print 'Info: ' . $record_numbers . " lines in file \n"; +$header = dbase_get_header_info($fhandle); +if ($deleteTable) { + $db->query("DROP TABLE IF EXISTS `$table_name`"); +} +$sqlCreate = "CREATE TABLE IF NOT EXISTS `$table_name` ( `id` INT(11) NOT NULL AUTO_INCREMENT "; +$fieldArray = array("`id`"); +foreach ($header as $value) { + $fieldName = substr(str_replace('_', '', $value['name']), $startchar); + $fieldArray[] = "`$fieldName`"; + $sqlCreate .= ", `" . $fieldName . "` VARCHAR({$value['length']}) NULL DEFAULT NULL "; +} +$sqlCreate .= ", PRIMARY KEY (`id`)) ENGINE = InnoDB"; +$resql = $db->query($sqlCreate); +if ($resql !== FALSE) { + print "Table $table_name created\n"; +} else { + var_dump($db->errno()); + print "Impossible : " . $sqlCreate . "\n"; + die(); +} + +$i = 0; +$nboflines++; + +$fields = implode(',', $fieldArray); +//var_dump($fieldArray);die(); +$maxLength = 0; +for ($i = 1; $i <= $record_numbers; $i++) { + if ($startlinenb && $i < $startlinenb) + continue; + if ($endlinenb && $i > $endlinenb) + continue; + $row = dbase_get_record_with_names($fhandle, $i); + if ($row === FALSE || (isset($row["deleted"]) && $row["deleted"] == '1')) + continue; + $sqlInsert = "INSERT INTO `$table_name`($fields) VALUES (null,"; + array_shift($row); // remove delete column + foreach ($row as $value) { + $sqlInsert .= "'" . $db->escape(utf8_encode($value)) . "', "; + } + replaceable_echo(implode("\t", $row)); + $sqlInsert = rtrim($sqlInsert, ', '); + $sqlInsert .= ")"; + $resql = $db->query($sqlInsert); + if ($resql === false) { + print "Impossible : " . $sqlInsert . "\n"; + var_dump($row, $db->errno()); + die(); + } +// $fields = (object) $row; +// var_dump($fields); + continue; +} +die(); + + + + + +// commit or rollback +print "Nb of lines qualified: " . $nboflines . "\n"; +print "Nb of errors: " . $error . "\n"; +if ($mode != 'confirmforced' && ($error || $mode != 'confirm')) { + print "Rollback any changes.\n"; + $db->rollback(); +} else { + print "Commit all changes.\n"; + $db->commit(); +} + +$db->close(); +fclose($fhandle); +fclose($fhandleerr); + +exit($error); + +function replaceable_echo($message, $force_clear_lines = NULL) { + static $last_lines = 0; + + if (!is_null($force_clear_lines)) { + $last_lines = $force_clear_lines; + } + + $term_width = exec('tput cols', $toss, $status); + if ($status) { + $term_width = 64; // Arbitrary fall-back term width. + } + + $line_count = 0; + foreach (explode("\n", $message) as $line) { + $line_count += count(str_split($line, $term_width)); + } + + // Erasure MAGIC: Clear as many lines as the last output had. + for ($i = 0; $i < $last_lines; $i++) { + // Return to the beginning of the line + echo "\r"; + // Erase to the end of the line + echo "\033[K"; + // Move cursor Up a line + echo "\033[1A"; + // Return to the beginning of the line + echo "\r"; + // Erase to the end of the line + echo "\033[K"; + // Return to the beginning of the line + echo "\r"; + // Can be consolodated into + // echo "\r\033[K\033[1A\r\033[K\r"; + } + + $last_lines = $line_count; + + echo $message . "\n"; +} diff --git a/dev/initdata/importdb-products.php b/dev/initdata/importdb-products.php new file mode 100644 index 00000000000..249ae129b58 --- /dev/null +++ b/dev/initdata/importdb-products.php @@ -0,0 +1,241 @@ +#!/usr/bin/env php + + * Copyright (C) 2016 Juanjo Menent + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * WARNING, THIS WILL LOAD MASS DATA ON YOUR INSTANCE + */ + +/** + * \file dev/initdata/import-product.php + * \brief Script example to insert products from a csv file. + * To purge data, you can have a look at purge-data.php + */ +// Test si mode batch +$sapi_type = php_sapi_name(); +$script_file = basename(__FILE__); +$path = dirname(__FILE__) . '/'; +if (substr($sapi_type, 0, 3) == 'cgi') { + echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + exit; +} + +// Recupere root dolibarr +$path = preg_replace('/importdb-products.php/i', '', $_SERVER["PHP_SELF"]); +require $path . "../../htdocs/master.inc.php"; +require $path . "includes/dbase.class.php"; +include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; +include_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; + +//$delimiter = ','; +//$enclosure = '"'; +//$linelength = 10000; +//$escape = '/'; +// Global variables +$version = DOL_VERSION; +$confirmed = 1; +$error = 0; + +$tvas = [ + '1' => "20.00", + '2' => "5.50", + '3' => "0.00", + '4' => "20.60", + '5' => "19.60", +]; +$tvasD = [ + '1' => "20", + '2' => "5.5", + '3' => "0", + '4' => "20", + '5' => "20", +]; + +/* + * Main + */ + +@set_time_limit(0); +print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n"; +dol_syslog($script_file . " launched with arg " . implode(',', $argv)); + +$table = $argv[1]; + +if (empty($argv[1])) { + print "Error: Quelle table ?\n"; + print "\n"; + exit(-1); +} + +$ret = $user->fetch('', 'admin'); +if (!$ret > 0) { + print 'A user with login "admin" and all permissions must be created to use this script.' . "\n"; + exit; +} + +$sql = "SELECT * FROM `$table` WHERE 1"; +$resql = $db->query($sql); +if ($resql) + while ($fields = $db->fetch_array($resql)) { + $errorrecord = 0; + if ($fields === FALSE) + continue; + $nboflines++; + + $produit = new Product($db); + $produit->type = 0; + $produit->status = 1; + $produit->ref = trim($fields['REF']); + if ($produit->ref == '') + continue; + print "Process line nb " . $j . ", ref " . $produit->ref; + $produit->label = trim($fields['LIBELLE']); + if ($produit->label == '') + $produit->label = $produit->ref; + if (empty($produit->label)) + continue; + //$produit->description = trim($fields[4] . "\n" . ($fields[5] ? $fields[5] . ' x ' . $fields[6] . ' x ' . $fields[7] : '')); +// $produit->volume = price2num($fields[8]); +// $produit->volume_unit = 0; + $produit->weight = price2num($fields['MASSE']); + $produit->weight_units = 0; // -3 = g + //$produit->customcode = $fields[10]; + $produit->barcode = str_pad($fields['CODE'], 12, "0", STR_PAD_LEFT); + $produit->barcode_type = '2'; + $produit->import_key = $fields['CODE']; + + $produit->status = 1; + $produit->status_buy = 1; + + $produit->finished = 1; + +// $produit->multiprices[0] = price2num($fields['TARIF0']); +// $produit->multiprices[1] = price2num($fields['TARIF1']); +// $produit->multiprices[2] = price2num($fields['TARIF2']); +// $produit->multiprices[3] = price2num($fields['TARIF3']); +// $produit->multiprices[4] = price2num($fields['TARIF4']); +// $produit->multiprices[5] = price2num($fields['TARIF5']); +// $produit->multiprices[6] = price2num($fields['TARIF6']); +// $produit->multiprices[7] = price2num($fields['TARIF7']); +// $produit->multiprices[8] = price2num($fields['TARIF8']); +// $produit->multiprices[9] = price2num($fields['TARIF9']); +// $produit->price_min = null; +// $produit->price_min_ttc = null; +// $produit->price = price2num($fields[11]); +// $produit->price_ttc = price2num($fields[12]); +// $produit->price_base_type = 'TTC'; +// $produit->tva_tx = price2num($fields[13]); + $produit->tva_tx = (int) ($tvas[$fields['CODTVA']]); + $produit->tva_npr = 0; +// $produit->cost_price = price2num($fields[16]); + //compta + + $produit->accountancy_code_buy = trim($fields['COMACH']); + $produit->accountancy_code_sell = trim($fields['COMVEN']); +// $produit->accountancy_code_sell_intra=trim($fields['COMVEN']); +// $produit->accountancy_code_sell_export=trim($fields['COMVEN']); + // Extrafields +// $produit->array_options['options_ecotaxdeee'] = price2num($fields[17]); + + $produit->seuil_stock_alerte = $fields['STALERTE']; + $ret = $produit->create($user, 0); + if ($ret < 0) { + print " - Error in create result code = " . $ret . " - " . $produit->errorsToString(); + $errorrecord++; + } else { + print " - Creation OK with ref " . $produit->ref . " - id = " . $ret; + } + + dol_syslog("Add prices"); + + // If we use price level, insert price for each level + if (!$errorrecord && 1) { + //$ret1 = $produit->updatePrice($produit->price_ttc, $produit->price_base_type, $user, $produit->tva_tx, $produit->price_min, 1, $produit->tva_npr, 0, 0, array()); + $ret1 = false; + for ($i = 0; $i < 10; $i++) { + if ($fields['TARIF' . ($i)] == 0) + continue; + $ret1 = $ret1 || $produit->updatePrice(price2num($fields['TARIF' . ($i)]), 'HT', $user, $produit->tva_tx, $produit->price_min, $i + 1, $produit->tva_npr, 0, 0, array()) < 0; + } + if ($ret1) { + print " - Error in updatePrice result " . $produit->errorsToString(); + $errorrecord++; + } else { + print " - updatePrice OK"; + } + } + + +// dol_syslog("Add multilangs"); + // Add alternative languages +// if (!$errorrecord && 1) { +// $produit->multilangs['fr_FR'] = array('label' => $produit->label, 'description' => $produit->description, 'note' => $produit->note_private); +// $produit->multilangs['en_US'] = array('label' => $fields[3], 'description' => $produit->description, 'note' => $produit->note_private); +// +// $ret = $produit->setMultiLangs($user); +// if ($ret < 0) { +// print " - Error in setMultiLangs result code = " . $ret . " - " . $produit->errorsToString(); +// $errorrecord++; +// } else { +// print " - setMultiLangs OK"; +// } +// } + + + dol_syslog("Add stocks"); + // stocks + if (!$errorrecord && $fields['STOCK'] != 0) { + $rets = $produit->correct_stock($user, 1, $fields['STOCK'], 0, 'Stock importé'); + if ($rets < 0) { + print " - Error in correct_stock result " . $produit->errorsToString(); + $errorrecord++; + } else { + print " - correct_stock OK"; + } + } + + //update date créa + if (!$errorrecord) { + $date = substr($fields['DATCREA'], 0, 4) . '-' . substr($fields['DATCREA'], 4, 2) . '-' . substr($fields['DATCREA'], 6, 2); + $retd = $db->query("UPDATE `llx_product` SET `datec` = '$date 00:00:00' WHERE `llx_product`.`rowid` = $produit->id"); + if ($retd < 1) { + print " - Error in update date créa result " . $produit->errorsToString(); + $errorrecord++; + } else { + print " - update date créa OK"; + } + } + print "\n"; + + if ($errorrecord) { + print( 'Error on record nb ' . $i . " - " . $produit->errorsToString() . "\n"); + var_dump($db); + die(); + $error++; // $errorrecord will be reset + } + $j++; + } else + die("error : $sql"); + + + + +// commit or rollback +print "Nb of lines qualified: " . $nboflines . "\n"; +print "Nb of errors: " . $error . "\n"; +$db->close(); + +exit($error); diff --git a/dev/initdata/importdb-thirdparties.php b/dev/initdata/importdb-thirdparties.php new file mode 100644 index 00000000000..af92ce70261 --- /dev/null +++ b/dev/initdata/importdb-thirdparties.php @@ -0,0 +1,355 @@ +#!/usr/bin/env php + + * Copyright (C) 2016 Juanjo Menent + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * WARNING, THIS WILL LOAD MASS DATA ON YOUR INSTANCE + */ + +/** + * \file dev/initdata/import-product.php + * \brief Script example to insert products from a csv file. + * To purge data, you can have a look at purge-data.php + */ +// Test si mode batch +$sapi_type = php_sapi_name(); +$script_file = basename(__FILE__); +$path = dirname(__FILE__) . '/'; +if (substr($sapi_type, 0, 3) == 'cgi') { + echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + exit; +} + +// Recupere root dolibarr +$path = preg_replace('/importdb-thirdparties.php/i', '', $_SERVER["PHP_SELF"]); +require $path . "../../htdocs/master.inc.php"; +require $path . "includes/dbase.class.php"; +include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; +include_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; + +//$delimiter = ','; +//$enclosure = '"'; +//$linelength = 10000; +//$escape = '/'; +// Global variables +$version = DOL_VERSION; +$confirmed = 1; +$error = 0; + +$civilPrivate = array("MLLE", + "MM", + "MM/MADAME", + "MME", + "MME.", + "MME²", + "MMONSIEUR", + "MMR", + "MOBNSIEUR", + "MOMSIEUR", + "MON SIEUR", + "MONDIAL", + "MONIEUR", + "MONJSIEUR", + "MONNSIEUR", + "MONRIEUR", + "MONS", + "MONSIEÕR", + "MONSIER", + "MONSIERU", + "MONSIEU", + "monsieue", + "MONSIEUR", + "Monsieur     \"", + "MONSIEUR    \"", + "MONSIEUR   E", + "MONSIEUR  DENIS", + "MONSIEUR ET MME", + "MONSIEUR!", + "MONSIEUR.", + "MONSIEUR.MADAME", + "MONSIEUR3", + "MONSIEURN", + "MONSIEURT", + "MONSIEUR£", + "MONSIEYR", + "Monsigur", + "MONSIIEUR", + "MONSIUER", + "MONSIZEUR", + "MOPNSIEUR", + "MOSIEUR", + "MR", + "Mr  Mme", + "Mr - MME", + "MR BLANC", + "MR ET MME", + "mr mm", + "MR OU MME", + "Mr.", + "MR/MME", + "MRME", + "MRR", + "Mrs", + "Mademoiselle", + "MADAOME", + "madamme", + "MADAME", + "M0NSIEUR", + "M.et Madame", + "M. ET MR", + "M.", + "M%", + "M MME", + "M ET MME", + "M", + "M CROCE", + "M DIEVART", +); + +/* + * Main + */ + +@set_time_limit(0); +print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n"; +dol_syslog($script_file . " launched with arg " . implode(',', $argv)); + +$table = $argv[1]; + +if (empty($argv[1])) { + print "Error: Quelle table ?\n"; + print "\n"; + exit(-1); +} + +$ret = $user->fetch('', 'admin'); +if (!$ret > 0) { + print 'A user with login "admin" and all permissions must be created to use this script.' . "\n"; + exit; +} + +$sql = "SELECT * FROM `$table` WHERE 1 "; //ORDER BY REMISE DESC,`LCIVIL` DESC"; +$resql = $db->query($sql); +//$db->begin(); +if ($resql) + while ($fields = $db->fetch_array($resql)) { + $i++; + $errorrecord = 0; + + if ($startlinenb && $i < $startlinenb) + continue; + if ($endlinenb && $i > $endlinenb) + continue; + + $nboflines++; + + $object = new Societe($db); + $object->import_key = $fields['CODE']; + $object->state = 1; + $object->client = 3; + $object->fournisseur = 0; + + $object->name = $fields['FCIVIL'] . ' ' . $fields['FNOM']; + //$object->name_alias = $fields[0] != $fields[13] ? trim($fields[0]) : ''; + + $date = $fields['DATCREA'] ? $fields['DATCREA'] : ($fields['DATMOD'] ? $fields['DATMOD'] : '20200101'); + $object->code_client = 'CU' . substr($date, 2, 2) . substr($date, 4, 2) . '-' . str_pad(substr($fields['CODE'], 0, 5), 5, "0", STR_PAD_LEFT); + + + $object->address = trim($fields['FADR1']); + if ($fields['FADR2']) + $object->address .= "\n" . trim($fields['FADR2']); + if ($fields['FADR3']) + $object->address .= "\n" . trim($fields['FADR3']); + + $object->zip = trim($fields['FPOSTE']); + $object->town = trim($fields['FVILLE']); + if ($fields['FPAYS']) + $object->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['FPAYS']))), 'c_country', 'label', 'rowid'); + else + $object->country_id = 1; + $object->phone = trim($fields['FTEL']) ? trim($fields['FTEL']) : trim($fields['FCONTACT']); + $object->phone = substr($object->phone, 0, 20); + $object->fax = trim($fields['FFAX']) ? trim($fields['FFAX']) : trim($fields['FCONTACT']); + $object->fax = substr($object->fax, 0, 20); + $object->email = trim($fields['FMAIL']); +// $object->idprof2 = trim($fields[29]); + $object->tva_intra = str_replace(['.', ' '], '', $fields['TVAINTRA']); + $object->tva_intra = substr($object->tva_intra, 0, 20); + $object->default_lang = 'fr_FR'; + + $object->cond_reglement_id = dol_getIdFromCode($db, 'PT_ORDER', 'c_payment_term', 'code', 'rowid', 1); + $object->multicurrency_code = 'EUR'; + + if ($fields['REMISE'] != '0.00') { + $object->remise_percent = abs($fields['REMISE']); + } + +// $object->code_client = $fields[9]; +// $object->code_fournisseur = $fields[10]; + + + if ($fields['FCIVIL']) { + $labeltype = in_array($fields['FCIVIL'], $civilPrivate) ? 'TE_PRIVATE' : 'TE_SMALL'; + $object->typent_id = dol_getIdFromCode($db, $labeltype, 'c_typent', 'code'); + } + + // Set price level + $object->price_level = $fields['TARIF'] + 1; +// if ($labeltype == 'Revendeur') +// $object->price_level = 2; + + print "Process line nb " . $i . ", code " . $fields['CODE'] . ", name " . $object->name; + + + // Extrafields + $object->array_options['options_banque'] = $fields['BANQUE']; + $object->array_options['options_banque2'] = $fields['BANQUE2']; + $object->array_options['options_banquevalid'] = $fields['VALID']; + + if (!$errorrecord) { + $ret = $object->create($user); + if ($ret < 0) { + print " - Error in create result code = " . $ret . " - " . $object->errorsToString(); + $errorrecord++; + var_dump($object->code_client, $db); + die(); + } else { + print " - Creation OK with name " . $object->name . " - id = " . $ret; + } + } + + if (!$errorrecord) { + dol_syslog("Set price level"); + $object->set_price_level($object->price_level, $user); + } + if (!$errorrecord && @$object->remise_percent) { + dol_syslog("Set remise client"); + $object->set_remise_client($object->remise_percent, 'Importé', $user); + } + + dol_syslog("Add contact"); + // Insert an invoice contact if there is an invoice email != standard email + if (!$errorrecord && ($fields['LCIVIL'] || $fields['LNOM'])) { + $madame = array("MADAME", + "MADEMOISELLE", + "MELLE", + "MLLE", + "MM", + "Mme", + "MNE", + ); + $monsieur = array("M", + "M ET MME", + "M MME", + "M.", + "M. MME", + "M. OU Mme", + "M.ou Madame", + "MONSEUR", + "MONSIER", + "MONSIEU", + "MONSIEUR", + "monsieur:mme", + "MONSIEUR¨", + "MONSIEZUR", + "MONSIUER", + "MONSKIEUR", + "MR", + ); + $ret1 = $ret2 = 0; + + $contact = new Contact($db); + if (in_array($fields['LCIVIL'], $madame)) { + // une dame + $contact->civility_id = 'MME'; + $contact->lastname = $fields['LNOM']; + } elseif (in_array($fields['LCIVIL'], $monsieur)) { + // un monsieur + $contact->civility_id = 'MR'; + $contact->lastname = $fields['LNOM']; + } elseif (in_array($fields['LCIVIL'], ['DOCTEUR'])) { + // un monsieur + $contact->civility_id = 'DR'; + $contact->lastname = $fields['LNOM']; + } else { + // un a rattraper + $contact->lastname = $fields['LCIVIL'] . " " . $fields['LNOM']; + } + $contact->address = trim($fields['LADR1']); + if ($fields['LADR2']) + $contact->address .= "\n" . trim($fields['LADR2']); + if ($fields['LADR3']) + $contact->address .= "\n" . trim($fields['LADR3']); + + $contact->zip = trim($fields['LPOSTE']); + $contact->town = trim($fields['LVILLE']); + if ($fields['FPAYS']) + $contact->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['LPAYS']))), 'c_country', 'label', 'rowid'); + else + $contact->country_id = 1; + $contact->email = $fields['LMAIL']; + $contact->phone = trim($fields['LTEL']) ? trim($fields['LTEL']) : trim($fields['LCONTACT']); + $contact->fax = trim($fields['LFAX']) ? trim($fields['LFAX']) : trim($fields['LCONTACT']); + $contact->socid = $object->id; + + $ret1 = $contact->create($user); + if ($ret1 > 0) { + //$ret2=$contact->add_contact($object->id, 'BILLING'); + } + if ($ret1 < 0 || $ret2 < 0) { + print " - Error in create contact result code = " . $ret1 . " " . $ret2 . " - " . $contact->errorsToString(); + $errorrecord++; + } else { + print " - create contact OK"; + } + } + + + //update date créa + if (!$errorrecord) { + $datec = substr($date, 0, 4) . '-' . substr($date, 4, 2) . '-' . substr($date, 6, 2); + $retd = $db->query("UPDATE `llx_societe` SET `datec` = '$datec 00:00:00' WHERE `rowid` = $object->id"); + if ($retd < 1) { + print " - Error in update date créa result " . $object->errorsToString(); + $errorrecord++; + } else { + print " - update date créa OK"; + } + } + print "\n"; + + if ($errorrecord) { + print( 'Error on record nb ' . $i . " - " . $object->errorsToString() . "\n"); + var_dump($db, $object, $contact); +// $db->rollback(); + die(); + $error++; // $errorrecord will be reset + } + $j++; + } else + die("error : $sql"); + +$db->commit(); + + + +// commit or rollback +print "Nb of lines qualified: " . $nboflines . "\n"; +print "Nb of errors: " . $error . "\n"; +$db->close(); + +exit($error); diff --git a/dev/initdata/includes/dbase.class.php b/dev/initdata/includes/dbase.class.php new file mode 100644 index 00000000000..99cc4480b5f --- /dev/null +++ b/dev/initdata/includes/dbase.class.php @@ -0,0 +1,362 @@ +fd = $fd; + // Byte 4-7 (32-bit number): Number of records in the database file. Currently 0 + fseek($this->fd, 4, SEEK_SET); + $this->recordCount = self::getInt32($fd); + // Byte 8-9 (16-bit number): Number of bytes in the header. + fseek($this->fd, 8, SEEK_SET); + $this->headerLength = self::getInt16($fd); + // Number of fields is (headerLength - 33) / 32) + $this->fieldCount = ($this->headerLength - 33) / 32; + // Byte 10-11 (16-bit number): Number of bytes in record. + fseek($this->fd, 10, SEEK_SET); + $this->recordLength = self::getInt16($fd); + // Byte 32 - n (32 bytes each): Field descriptor array + fseek($fd, 32, SEEK_SET); + for ($i = 0; $i < $this->fieldCount; $i++) { + $data = fread($this->fd, 32); + $field = array_map('trim', unpack('a11name/a1type/c4/c1length/c1precision/s1workid/c1example/c10/c1production', $data)); + $this->fields[] = $field; + } + } + + //bool dbase_close ( resource $dbase_identifier ) + public function close() { + fclose($this->fd); + } + + //array dbase_get_header_info ( resource $dbase_identifier ) + public function get_header_info() { + return $this->fields; + } + + //int dbase_numfields ( resource $dbase_identifier ) + public function numfields() { + return $this->fieldCount; + } + + //int dbase_numrecords ( resource $dbase_identifier ) + public function numrecords() { + return $this->recordCount; + } + + //bool dbase_add_record ( resource $dbase_identifier , array $record ) + public function add_record($record) { + if (count($record) != $this->fieldCount) + return false; + // Seek to end of file, minus the end of file marker + fseek($this->fd, 0, SEEK_END); + // Put the deleted flag + self::putChar8($this->fd, 0x20); + // Put the record + if (!$this->putRecord($record)) + return false; + // Update the record count + fseek($this->fd, 4); + self::putInt32($this->fd, ++$this->recordCount); + return true; + } + + //bool dbase_replace_record ( resource $dbase_identifier , array $record , int $record_number ) + public function replace_record($record, $record_number) { + if (count($record) != $this->fieldCount) + return false; + if ($record_number < 1 || $record_number > $this->recordCount) + return false; + // Skip to the record location, plus the 1 byte for the deleted flag + fseek($this->fd, $this->headerLength + ($this->recordLength * ($record_number - 1)) + 1); + return $this->putRecord($record); + } + + //bool dbase_delete_record ( resource $dbase_identifier , int $record_number ) + public function delete_record($record_number) { + if ($record_number < 1 || $record_number > $this->recordCount) + return false; + fseek($this->fd, $this->headerLength + ($this->recordLength * ($record_number - 1))); + self::putChar8($this->fd, 0x2A); + return true; + } + + //array dbase_get_record ( resource $dbase_identifier , int $record_number ) + public function get_record($record_number) { + if ($record_number < 1 || $record_number > $this->recordCount) + return false; + fseek($this->fd, $this->headerLength + ($this->recordLength * ($record_number - 1))); + $record = array( + 'deleted' => self::getChar8($this->fd) == 0x2A ? 1 : 0 + ); + foreach ($this->fields as $i => &$field) { + $value = trim(fread($this->fd, $field['length'])); + if ($field['type'] == 'L') { + $value = strtolower($value); + if ($value == 't' || $value == 'y') + $value = true; + else if ($value == 'f' || $value == 'n') + $value = false; + else + $value = null; + } + $record[$i] = $value; + } + return $record; + } + + //array dbase_get_record_with_names ( resource $dbase_identifier , int $record_number ) + public function get_record_with_names($record_number) { + if ($record_number < 1 || $record_number > $this->recordCount) + return false; + $record = $this->get_record($record_number); + foreach ($this->fields as $i => &$field) { + $record[$field['name']] = $record[$i]; + unset($record[$i]); + } + return $record; + } + + //bool dbase_pack ( resource $dbase_identifier ) + public function pack() { + $in_offset = $out_offset = $this->headerLength; + $new_count = 0; + $rec_count = $this->recordCount; + while ($rec_count > 0) { + fseek($this->fd, $in_offset, SEEK_SET); + $record = fread($this->fd, $this->recordLength); + $deleted = substr($record, 0, 1); + if ($deleted != '*') { + fseek($this->fd, $out_offset, SEEK_SET); + fwrite($this->fd, $record); + $out_offset += $this->recordLength; + $new_count++; + } + $in_offset += $this->recordLength; + $rec_count--; + } + ftruncate($this->fd, $out_offset); + // Update the record count + fseek($this->fd, 4); + self::putInt32($this->fd, $new_count); + } + + /* + * A few utilitiy functions + */ + + private static function length($field) { + switch ($field[1]) { + case 'D': // Date: Numbers and a character to separate month, day, and year (stored internally as 8 digits in YYYYMMDD format) + return 8; + case 'T': // DateTime (YYYYMMDDhhmmss.uuu) (FoxPro) + return 18; + case 'M': // Memo (ignored): All ASCII characters (stored internally as 10 digits representing a .dbt block number, right justified, padded with whitespaces) + case 'N': // Number: -.0123456789 (right justified, padded with whitespaces) + case 'F': // Float: -.0123456789 (right justified, padded with whitespaces) + case 'C': // String: All ASCII characters (padded with whitespaces up to the field's length) + return $field[2]; + case 'L': // Boolean: YyNnTtFf? (? when not initialized) + return 1; + } + return 0; + } + + /* + * Functions for reading and writing bytes + */ + + private static function getChar8($fd) { + return ord(fread($fd, 1)); + } + + private static function putChar8($fd, $value) { + return fwrite($fd, chr($value)); + } + + private static function getInt16($fd, $n = 1) { + $data = fread($fd, 2 * $n); + $i = unpack("S$n", $data); + if ($n == 1) + return (int) $i[1]; + else + return array_merge($i); + } + + private static function putInt16($fd, $value) { + return fwrite($fd, pack('S', $value)); + } + + private static function getInt32($fd, $n = 1) { + $data = fread($fd, 4 * $n); + $i = unpack("L$n", $data); + if ($n == 1) + return (int) $i[1]; + else + return array_merge($i); + } + + private static function putInt32($fd, $value) { + return fwrite($fd, pack('L', $value)); + } + + private static function putString($fd, $value, $length = 254) { + $ret = fwrite($fd, pack('A' . $length, $value)); + } + + private function putRecord($record) { + foreach ($this->fields as $i => &$field) { + $value = $record[$i]; + // Number types are right aligned with spaces + if ($field['type'] == 'N' || $field['type'] == 'F' && strlen($value) < $field['length']) { + $value = str_repeat(' ', $field['length'] - strlen($value)) . $value; + } + self::putString($this->fd, $value, $field['length']); + } + return true; + } + +} + +if (!function_exists('dbase_open')) { + + function dbase_open($filename, $mode) { + return DBase::open($filename, $mode); + } + + function dbase_create($filename, $fields, $type = DBASE_TYPE_DBASE) { + return DBase::create($filename, $fields, $type); + } + + function dbase_close($dbase_identifier) { + return $dbase_identifier->close(); + } + + function dbase_get_header_info($dbase_identifier) { + return $dbase_identifier->get_header_info(); + } + + function dbase_numfields($dbase_identifier) { + $dbase_identifier->numfields(); + } + + function dbase_numrecords($dbase_identifier) { + return $dbase_identifier->numrecords(); + } + + function dbase_add_record($dbase_identifier, $record) { + return $dbase_identifier->add_record($record); + } + + function dbase_delete_record($dbase_identifier, $record_number) { + return $dbase_identifier->delete_record($record_number); + } + + function dbase_replace_record($dbase_identifier, $record, $record_number) { + return $dbase_identifier->replace_record($record, $record_number); + } + + function dbase_get_record($dbase_identifier, $record_number) { + return $dbase_identifier->get_record($record_number); + } + + function dbase_get_record_with_names($dbase_identifier, $record_number) { + return $dbase_identifier->get_record_with_names($record_number); + } + + function dbase_pack($dbase_identifier) { + return $dbase_identifier->pack(); + } + +} \ No newline at end of file From ece3face5e66c41bce11ab68582e69d28b0c77cc Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 14 Jan 2020 14:34:36 +0000 Subject: [PATCH 096/784] Fixing style errors. --- dev/initdata/import-dbf.php | 11 +- dev/initdata/importdb-products.php | 250 +++++++++--------- dev/initdata/importdb-thirdparties.php | 340 ++++++++++++------------- dev/initdata/includes/dbase.class.php | 110 +++++--- 4 files changed, 373 insertions(+), 338 deletions(-) diff --git a/dev/initdata/import-dbf.php b/dev/initdata/import-dbf.php index 954f1c8b2ec..de904ca76e1 100644 --- a/dev/initdata/import-dbf.php +++ b/dev/initdata/import-dbf.php @@ -116,7 +116,7 @@ foreach ($header as $value) { } $sqlCreate .= ", PRIMARY KEY (`id`)) ENGINE = InnoDB"; $resql = $db->query($sqlCreate); -if ($resql !== FALSE) { +if ($resql !== false) { print "Table $table_name created\n"; } else { var_dump($db->errno()); @@ -136,7 +136,7 @@ for ($i = 1; $i <= $record_numbers; $i++) { if ($endlinenb && $i > $endlinenb) continue; $row = dbase_get_record_with_names($fhandle, $i); - if ($row === FALSE || (isset($row["deleted"]) && $row["deleted"] == '1')) + if ($row === false || (isset($row["deleted"]) && $row["deleted"] == '1')) continue; $sqlInsert = "INSERT INTO `$table_name`($fields) VALUES (null,"; array_shift($row); // remove delete column @@ -152,8 +152,8 @@ for ($i = 1; $i <= $record_numbers; $i++) { var_dump($row, $db->errno()); die(); } -// $fields = (object) $row; -// var_dump($fields); + // $fields = (object) $row; + // var_dump($fields); continue; } die(); @@ -179,7 +179,8 @@ fclose($fhandleerr); exit($error); -function replaceable_echo($message, $force_clear_lines = NULL) { +function replaceable_echo($message, $force_clear_lines = null) +{ static $last_lines = 0; if (!is_null($force_clear_lines)) { diff --git a/dev/initdata/importdb-products.php b/dev/initdata/importdb-products.php index 249ae129b58..08e960dfdc6 100644 --- a/dev/initdata/importdb-products.php +++ b/dev/initdata/importdb-products.php @@ -89,145 +89,145 @@ if (!$ret > 0) { $sql = "SELECT * FROM `$table` WHERE 1"; $resql = $db->query($sql); if ($resql) - while ($fields = $db->fetch_array($resql)) { - $errorrecord = 0; - if ($fields === FALSE) - continue; - $nboflines++; +while ($fields = $db->fetch_array($resql)) { + $errorrecord = 0; + if ($fields === false) + continue; + $nboflines++; - $produit = new Product($db); - $produit->type = 0; - $produit->status = 1; - $produit->ref = trim($fields['REF']); - if ($produit->ref == '') - continue; - print "Process line nb " . $j . ", ref " . $produit->ref; - $produit->label = trim($fields['LIBELLE']); - if ($produit->label == '') - $produit->label = $produit->ref; - if (empty($produit->label)) - continue; - //$produit->description = trim($fields[4] . "\n" . ($fields[5] ? $fields[5] . ' x ' . $fields[6] . ' x ' . $fields[7] : '')); -// $produit->volume = price2num($fields[8]); -// $produit->volume_unit = 0; - $produit->weight = price2num($fields['MASSE']); - $produit->weight_units = 0; // -3 = g - //$produit->customcode = $fields[10]; - $produit->barcode = str_pad($fields['CODE'], 12, "0", STR_PAD_LEFT); - $produit->barcode_type = '2'; - $produit->import_key = $fields['CODE']; + $produit = new Product($db); + $produit->type = 0; + $produit->status = 1; + $produit->ref = trim($fields['REF']); + if ($produit->ref == '') + continue; + print "Process line nb " . $j . ", ref " . $produit->ref; + $produit->label = trim($fields['LIBELLE']); + if ($produit->label == '') + $produit->label = $produit->ref; + if (empty($produit->label)) + continue; + //$produit->description = trim($fields[4] . "\n" . ($fields[5] ? $fields[5] . ' x ' . $fields[6] . ' x ' . $fields[7] : '')); + // $produit->volume = price2num($fields[8]); + // $produit->volume_unit = 0; + $produit->weight = price2num($fields['MASSE']); + $produit->weight_units = 0; // -3 = g + //$produit->customcode = $fields[10]; + $produit->barcode = str_pad($fields['CODE'], 12, "0", STR_PAD_LEFT); + $produit->barcode_type = '2'; + $produit->import_key = $fields['CODE']; - $produit->status = 1; - $produit->status_buy = 1; + $produit->status = 1; + $produit->status_buy = 1; - $produit->finished = 1; + $produit->finished = 1; -// $produit->multiprices[0] = price2num($fields['TARIF0']); -// $produit->multiprices[1] = price2num($fields['TARIF1']); -// $produit->multiprices[2] = price2num($fields['TARIF2']); -// $produit->multiprices[3] = price2num($fields['TARIF3']); -// $produit->multiprices[4] = price2num($fields['TARIF4']); -// $produit->multiprices[5] = price2num($fields['TARIF5']); -// $produit->multiprices[6] = price2num($fields['TARIF6']); -// $produit->multiprices[7] = price2num($fields['TARIF7']); -// $produit->multiprices[8] = price2num($fields['TARIF8']); -// $produit->multiprices[9] = price2num($fields['TARIF9']); -// $produit->price_min = null; -// $produit->price_min_ttc = null; -// $produit->price = price2num($fields[11]); -// $produit->price_ttc = price2num($fields[12]); -// $produit->price_base_type = 'TTC'; -// $produit->tva_tx = price2num($fields[13]); - $produit->tva_tx = (int) ($tvas[$fields['CODTVA']]); - $produit->tva_npr = 0; -// $produit->cost_price = price2num($fields[16]); - //compta + // $produit->multiprices[0] = price2num($fields['TARIF0']); + // $produit->multiprices[1] = price2num($fields['TARIF1']); + // $produit->multiprices[2] = price2num($fields['TARIF2']); + // $produit->multiprices[3] = price2num($fields['TARIF3']); + // $produit->multiprices[4] = price2num($fields['TARIF4']); + // $produit->multiprices[5] = price2num($fields['TARIF5']); + // $produit->multiprices[6] = price2num($fields['TARIF6']); + // $produit->multiprices[7] = price2num($fields['TARIF7']); + // $produit->multiprices[8] = price2num($fields['TARIF8']); + // $produit->multiprices[9] = price2num($fields['TARIF9']); + // $produit->price_min = null; + // $produit->price_min_ttc = null; + // $produit->price = price2num($fields[11]); + // $produit->price_ttc = price2num($fields[12]); + // $produit->price_base_type = 'TTC'; + // $produit->tva_tx = price2num($fields[13]); + $produit->tva_tx = (int) ($tvas[$fields['CODTVA']]); + $produit->tva_npr = 0; + // $produit->cost_price = price2num($fields[16]); + //compta - $produit->accountancy_code_buy = trim($fields['COMACH']); - $produit->accountancy_code_sell = trim($fields['COMVEN']); -// $produit->accountancy_code_sell_intra=trim($fields['COMVEN']); -// $produit->accountancy_code_sell_export=trim($fields['COMVEN']); - // Extrafields -// $produit->array_options['options_ecotaxdeee'] = price2num($fields[17]); + $produit->accountancy_code_buy = trim($fields['COMACH']); + $produit->accountancy_code_sell = trim($fields['COMVEN']); + // $produit->accountancy_code_sell_intra=trim($fields['COMVEN']); + // $produit->accountancy_code_sell_export=trim($fields['COMVEN']); + // Extrafields + // $produit->array_options['options_ecotaxdeee'] = price2num($fields[17]); - $produit->seuil_stock_alerte = $fields['STALERTE']; - $ret = $produit->create($user, 0); - if ($ret < 0) { - print " - Error in create result code = " . $ret . " - " . $produit->errorsToString(); - $errorrecord++; - } else { - print " - Creation OK with ref " . $produit->ref . " - id = " . $ret; - } + $produit->seuil_stock_alerte = $fields['STALERTE']; + $ret = $produit->create($user, 0); + if ($ret < 0) { + print " - Error in create result code = " . $ret . " - " . $produit->errorsToString(); + $errorrecord++; + } else { + print " - Creation OK with ref " . $produit->ref . " - id = " . $ret; + } - dol_syslog("Add prices"); + dol_syslog("Add prices"); - // If we use price level, insert price for each level - if (!$errorrecord && 1) { - //$ret1 = $produit->updatePrice($produit->price_ttc, $produit->price_base_type, $user, $produit->tva_tx, $produit->price_min, 1, $produit->tva_npr, 0, 0, array()); - $ret1 = false; - for ($i = 0; $i < 10; $i++) { - if ($fields['TARIF' . ($i)] == 0) - continue; - $ret1 = $ret1 || $produit->updatePrice(price2num($fields['TARIF' . ($i)]), 'HT', $user, $produit->tva_tx, $produit->price_min, $i + 1, $produit->tva_npr, 0, 0, array()) < 0; - } - if ($ret1) { - print " - Error in updatePrice result " . $produit->errorsToString(); - $errorrecord++; - } else { - print " - updatePrice OK"; - } - } + // If we use price level, insert price for each level + if (!$errorrecord && 1) { + //$ret1 = $produit->updatePrice($produit->price_ttc, $produit->price_base_type, $user, $produit->tva_tx, $produit->price_min, 1, $produit->tva_npr, 0, 0, array()); + $ret1 = false; + for ($i = 0; $i < 10; $i++) { + if ($fields['TARIF' . ($i)] == 0) + continue; + $ret1 = $ret1 || $produit->updatePrice(price2num($fields['TARIF' . ($i)]), 'HT', $user, $produit->tva_tx, $produit->price_min, $i + 1, $produit->tva_npr, 0, 0, array()) < 0; + } + if ($ret1) { + print " - Error in updatePrice result " . $produit->errorsToString(); + $errorrecord++; + } else { + print " - updatePrice OK"; + } + } -// dol_syslog("Add multilangs"); - // Add alternative languages -// if (!$errorrecord && 1) { -// $produit->multilangs['fr_FR'] = array('label' => $produit->label, 'description' => $produit->description, 'note' => $produit->note_private); -// $produit->multilangs['en_US'] = array('label' => $fields[3], 'description' => $produit->description, 'note' => $produit->note_private); -// -// $ret = $produit->setMultiLangs($user); -// if ($ret < 0) { -// print " - Error in setMultiLangs result code = " . $ret . " - " . $produit->errorsToString(); -// $errorrecord++; -// } else { -// print " - setMultiLangs OK"; -// } -// } + // dol_syslog("Add multilangs"); + // Add alternative languages + // if (!$errorrecord && 1) { + // $produit->multilangs['fr_FR'] = array('label' => $produit->label, 'description' => $produit->description, 'note' => $produit->note_private); + // $produit->multilangs['en_US'] = array('label' => $fields[3], 'description' => $produit->description, 'note' => $produit->note_private); + // + // $ret = $produit->setMultiLangs($user); + // if ($ret < 0) { + // print " - Error in setMultiLangs result code = " . $ret . " - " . $produit->errorsToString(); + // $errorrecord++; + // } else { + // print " - setMultiLangs OK"; + // } + // } - dol_syslog("Add stocks"); - // stocks - if (!$errorrecord && $fields['STOCK'] != 0) { - $rets = $produit->correct_stock($user, 1, $fields['STOCK'], 0, 'Stock importé'); - if ($rets < 0) { - print " - Error in correct_stock result " . $produit->errorsToString(); - $errorrecord++; - } else { - print " - correct_stock OK"; - } - } + dol_syslog("Add stocks"); + // stocks + if (!$errorrecord && $fields['STOCK'] != 0) { + $rets = $produit->correct_stock($user, 1, $fields['STOCK'], 0, 'Stock importé'); + if ($rets < 0) { + print " - Error in correct_stock result " . $produit->errorsToString(); + $errorrecord++; + } else { + print " - correct_stock OK"; + } + } - //update date créa - if (!$errorrecord) { - $date = substr($fields['DATCREA'], 0, 4) . '-' . substr($fields['DATCREA'], 4, 2) . '-' . substr($fields['DATCREA'], 6, 2); - $retd = $db->query("UPDATE `llx_product` SET `datec` = '$date 00:00:00' WHERE `llx_product`.`rowid` = $produit->id"); - if ($retd < 1) { - print " - Error in update date créa result " . $produit->errorsToString(); - $errorrecord++; - } else { - print " - update date créa OK"; - } - } - print "\n"; + //update date créa + if (!$errorrecord) { + $date = substr($fields['DATCREA'], 0, 4) . '-' . substr($fields['DATCREA'], 4, 2) . '-' . substr($fields['DATCREA'], 6, 2); + $retd = $db->query("UPDATE `llx_product` SET `datec` = '$date 00:00:00' WHERE `llx_product`.`rowid` = $produit->id"); + if ($retd < 1) { + print " - Error in update date créa result " . $produit->errorsToString(); + $errorrecord++; + } else { + print " - update date créa OK"; + } + } + print "\n"; - if ($errorrecord) { - print( 'Error on record nb ' . $i . " - " . $produit->errorsToString() . "\n"); - var_dump($db); - die(); - $error++; // $errorrecord will be reset - } - $j++; - } else + if ($errorrecord) { + print( 'Error on record nb ' . $i . " - " . $produit->errorsToString() . "\n"); + var_dump($db); + die(); + $error++; // $errorrecord will be reset + } + $j++; +} else die("error : $sql"); diff --git a/dev/initdata/importdb-thirdparties.php b/dev/initdata/importdb-thirdparties.php index af92ce70261..195c1d16b82 100644 --- a/dev/initdata/importdb-thirdparties.php +++ b/dev/initdata/importdb-thirdparties.php @@ -145,202 +145,202 @@ $sql = "SELECT * FROM `$table` WHERE 1 "; //ORDER BY REMISE DESC,`LCIVIL` DESC"; $resql = $db->query($sql); //$db->begin(); if ($resql) - while ($fields = $db->fetch_array($resql)) { - $i++; - $errorrecord = 0; +while ($fields = $db->fetch_array($resql)) { + $i++; + $errorrecord = 0; - if ($startlinenb && $i < $startlinenb) - continue; - if ($endlinenb && $i > $endlinenb) - continue; + if ($startlinenb && $i < $startlinenb) + continue; + if ($endlinenb && $i > $endlinenb) + continue; - $nboflines++; + $nboflines++; - $object = new Societe($db); - $object->import_key = $fields['CODE']; - $object->state = 1; - $object->client = 3; - $object->fournisseur = 0; + $object = new Societe($db); + $object->import_key = $fields['CODE']; + $object->state = 1; + $object->client = 3; + $object->fournisseur = 0; - $object->name = $fields['FCIVIL'] . ' ' . $fields['FNOM']; - //$object->name_alias = $fields[0] != $fields[13] ? trim($fields[0]) : ''; + $object->name = $fields['FCIVIL'] . ' ' . $fields['FNOM']; + //$object->name_alias = $fields[0] != $fields[13] ? trim($fields[0]) : ''; - $date = $fields['DATCREA'] ? $fields['DATCREA'] : ($fields['DATMOD'] ? $fields['DATMOD'] : '20200101'); - $object->code_client = 'CU' . substr($date, 2, 2) . substr($date, 4, 2) . '-' . str_pad(substr($fields['CODE'], 0, 5), 5, "0", STR_PAD_LEFT); + $date = $fields['DATCREA'] ? $fields['DATCREA'] : ($fields['DATMOD'] ? $fields['DATMOD'] : '20200101'); + $object->code_client = 'CU' . substr($date, 2, 2) . substr($date, 4, 2) . '-' . str_pad(substr($fields['CODE'], 0, 5), 5, "0", STR_PAD_LEFT); - $object->address = trim($fields['FADR1']); - if ($fields['FADR2']) - $object->address .= "\n" . trim($fields['FADR2']); - if ($fields['FADR3']) - $object->address .= "\n" . trim($fields['FADR3']); + $object->address = trim($fields['FADR1']); + if ($fields['FADR2']) + $object->address .= "\n" . trim($fields['FADR2']); + if ($fields['FADR3']) + $object->address .= "\n" . trim($fields['FADR3']); - $object->zip = trim($fields['FPOSTE']); - $object->town = trim($fields['FVILLE']); - if ($fields['FPAYS']) - $object->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['FPAYS']))), 'c_country', 'label', 'rowid'); - else - $object->country_id = 1; - $object->phone = trim($fields['FTEL']) ? trim($fields['FTEL']) : trim($fields['FCONTACT']); - $object->phone = substr($object->phone, 0, 20); - $object->fax = trim($fields['FFAX']) ? trim($fields['FFAX']) : trim($fields['FCONTACT']); - $object->fax = substr($object->fax, 0, 20); - $object->email = trim($fields['FMAIL']); -// $object->idprof2 = trim($fields[29]); - $object->tva_intra = str_replace(['.', ' '], '', $fields['TVAINTRA']); - $object->tva_intra = substr($object->tva_intra, 0, 20); - $object->default_lang = 'fr_FR'; + $object->zip = trim($fields['FPOSTE']); + $object->town = trim($fields['FVILLE']); + if ($fields['FPAYS']) + $object->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['FPAYS']))), 'c_country', 'label', 'rowid'); + else + $object->country_id = 1; + $object->phone = trim($fields['FTEL']) ? trim($fields['FTEL']) : trim($fields['FCONTACT']); + $object->phone = substr($object->phone, 0, 20); + $object->fax = trim($fields['FFAX']) ? trim($fields['FFAX']) : trim($fields['FCONTACT']); + $object->fax = substr($object->fax, 0, 20); + $object->email = trim($fields['FMAIL']); + // $object->idprof2 = trim($fields[29]); + $object->tva_intra = str_replace(['.', ' '], '', $fields['TVAINTRA']); + $object->tva_intra = substr($object->tva_intra, 0, 20); + $object->default_lang = 'fr_FR'; - $object->cond_reglement_id = dol_getIdFromCode($db, 'PT_ORDER', 'c_payment_term', 'code', 'rowid', 1); - $object->multicurrency_code = 'EUR'; + $object->cond_reglement_id = dol_getIdFromCode($db, 'PT_ORDER', 'c_payment_term', 'code', 'rowid', 1); + $object->multicurrency_code = 'EUR'; - if ($fields['REMISE'] != '0.00') { - $object->remise_percent = abs($fields['REMISE']); - } + if ($fields['REMISE'] != '0.00') { + $object->remise_percent = abs($fields['REMISE']); + } -// $object->code_client = $fields[9]; -// $object->code_fournisseur = $fields[10]; + // $object->code_client = $fields[9]; + // $object->code_fournisseur = $fields[10]; - if ($fields['FCIVIL']) { - $labeltype = in_array($fields['FCIVIL'], $civilPrivate) ? 'TE_PRIVATE' : 'TE_SMALL'; - $object->typent_id = dol_getIdFromCode($db, $labeltype, 'c_typent', 'code'); - } + if ($fields['FCIVIL']) { + $labeltype = in_array($fields['FCIVIL'], $civilPrivate) ? 'TE_PRIVATE' : 'TE_SMALL'; + $object->typent_id = dol_getIdFromCode($db, $labeltype, 'c_typent', 'code'); + } - // Set price level - $object->price_level = $fields['TARIF'] + 1; -// if ($labeltype == 'Revendeur') -// $object->price_level = 2; + // Set price level + $object->price_level = $fields['TARIF'] + 1; + // if ($labeltype == 'Revendeur') + // $object->price_level = 2; - print "Process line nb " . $i . ", code " . $fields['CODE'] . ", name " . $object->name; + print "Process line nb " . $i . ", code " . $fields['CODE'] . ", name " . $object->name; - // Extrafields - $object->array_options['options_banque'] = $fields['BANQUE']; - $object->array_options['options_banque2'] = $fields['BANQUE2']; - $object->array_options['options_banquevalid'] = $fields['VALID']; + // Extrafields + $object->array_options['options_banque'] = $fields['BANQUE']; + $object->array_options['options_banque2'] = $fields['BANQUE2']; + $object->array_options['options_banquevalid'] = $fields['VALID']; - if (!$errorrecord) { - $ret = $object->create($user); - if ($ret < 0) { - print " - Error in create result code = " . $ret . " - " . $object->errorsToString(); - $errorrecord++; - var_dump($object->code_client, $db); - die(); - } else { - print " - Creation OK with name " . $object->name . " - id = " . $ret; - } - } + if (!$errorrecord) { + $ret = $object->create($user); + if ($ret < 0) { + print " - Error in create result code = " . $ret . " - " . $object->errorsToString(); + $errorrecord++; + var_dump($object->code_client, $db); + die(); + } else { + print " - Creation OK with name " . $object->name . " - id = " . $ret; + } + } - if (!$errorrecord) { - dol_syslog("Set price level"); - $object->set_price_level($object->price_level, $user); - } - if (!$errorrecord && @$object->remise_percent) { - dol_syslog("Set remise client"); - $object->set_remise_client($object->remise_percent, 'Importé', $user); - } + if (!$errorrecord) { + dol_syslog("Set price level"); + $object->set_price_level($object->price_level, $user); + } + if (!$errorrecord && @$object->remise_percent) { + dol_syslog("Set remise client"); + $object->set_remise_client($object->remise_percent, 'Importé', $user); + } - dol_syslog("Add contact"); - // Insert an invoice contact if there is an invoice email != standard email - if (!$errorrecord && ($fields['LCIVIL'] || $fields['LNOM'])) { - $madame = array("MADAME", - "MADEMOISELLE", - "MELLE", - "MLLE", - "MM", - "Mme", - "MNE", - ); - $monsieur = array("M", - "M ET MME", - "M MME", - "M.", - "M. MME", - "M. OU Mme", - "M.ou Madame", - "MONSEUR", - "MONSIER", - "MONSIEU", - "MONSIEUR", - "monsieur:mme", - "MONSIEUR¨", - "MONSIEZUR", - "MONSIUER", - "MONSKIEUR", - "MR", - ); - $ret1 = $ret2 = 0; + dol_syslog("Add contact"); + // Insert an invoice contact if there is an invoice email != standard email + if (!$errorrecord && ($fields['LCIVIL'] || $fields['LNOM'])) { + $madame = array("MADAME", + "MADEMOISELLE", + "MELLE", + "MLLE", + "MM", + "Mme", + "MNE", + ); + $monsieur = array("M", + "M ET MME", + "M MME", + "M.", + "M. MME", + "M. OU Mme", + "M.ou Madame", + "MONSEUR", + "MONSIER", + "MONSIEU", + "MONSIEUR", + "monsieur:mme", + "MONSIEUR¨", + "MONSIEZUR", + "MONSIUER", + "MONSKIEUR", + "MR", + ); + $ret1 = $ret2 = 0; - $contact = new Contact($db); - if (in_array($fields['LCIVIL'], $madame)) { - // une dame - $contact->civility_id = 'MME'; - $contact->lastname = $fields['LNOM']; - } elseif (in_array($fields['LCIVIL'], $monsieur)) { - // un monsieur - $contact->civility_id = 'MR'; - $contact->lastname = $fields['LNOM']; - } elseif (in_array($fields['LCIVIL'], ['DOCTEUR'])) { - // un monsieur - $contact->civility_id = 'DR'; - $contact->lastname = $fields['LNOM']; - } else { - // un a rattraper - $contact->lastname = $fields['LCIVIL'] . " " . $fields['LNOM']; - } - $contact->address = trim($fields['LADR1']); - if ($fields['LADR2']) - $contact->address .= "\n" . trim($fields['LADR2']); - if ($fields['LADR3']) - $contact->address .= "\n" . trim($fields['LADR3']); + $contact = new Contact($db); + if (in_array($fields['LCIVIL'], $madame)) { + // une dame + $contact->civility_id = 'MME'; + $contact->lastname = $fields['LNOM']; + } elseif (in_array($fields['LCIVIL'], $monsieur)) { + // un monsieur + $contact->civility_id = 'MR'; + $contact->lastname = $fields['LNOM']; + } elseif (in_array($fields['LCIVIL'], ['DOCTEUR'])) { + // un monsieur + $contact->civility_id = 'DR'; + $contact->lastname = $fields['LNOM']; + } else { + // un a rattraper + $contact->lastname = $fields['LCIVIL'] . " " . $fields['LNOM']; + } + $contact->address = trim($fields['LADR1']); + if ($fields['LADR2']) + $contact->address .= "\n" . trim($fields['LADR2']); + if ($fields['LADR3']) + $contact->address .= "\n" . trim($fields['LADR3']); - $contact->zip = trim($fields['LPOSTE']); - $contact->town = trim($fields['LVILLE']); - if ($fields['FPAYS']) - $contact->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['LPAYS']))), 'c_country', 'label', 'rowid'); - else - $contact->country_id = 1; - $contact->email = $fields['LMAIL']; - $contact->phone = trim($fields['LTEL']) ? trim($fields['LTEL']) : trim($fields['LCONTACT']); - $contact->fax = trim($fields['LFAX']) ? trim($fields['LFAX']) : trim($fields['LCONTACT']); - $contact->socid = $object->id; + $contact->zip = trim($fields['LPOSTE']); + $contact->town = trim($fields['LVILLE']); + if ($fields['FPAYS']) + $contact->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['LPAYS']))), 'c_country', 'label', 'rowid'); + else + $contact->country_id = 1; + $contact->email = $fields['LMAIL']; + $contact->phone = trim($fields['LTEL']) ? trim($fields['LTEL']) : trim($fields['LCONTACT']); + $contact->fax = trim($fields['LFAX']) ? trim($fields['LFAX']) : trim($fields['LCONTACT']); + $contact->socid = $object->id; - $ret1 = $contact->create($user); - if ($ret1 > 0) { - //$ret2=$contact->add_contact($object->id, 'BILLING'); - } - if ($ret1 < 0 || $ret2 < 0) { - print " - Error in create contact result code = " . $ret1 . " " . $ret2 . " - " . $contact->errorsToString(); - $errorrecord++; - } else { - print " - create contact OK"; - } - } + $ret1 = $contact->create($user); + if ($ret1 > 0) { + //$ret2=$contact->add_contact($object->id, 'BILLING'); + } + if ($ret1 < 0 || $ret2 < 0) { + print " - Error in create contact result code = " . $ret1 . " " . $ret2 . " - " . $contact->errorsToString(); + $errorrecord++; + } else { + print " - create contact OK"; + } + } - //update date créa - if (!$errorrecord) { - $datec = substr($date, 0, 4) . '-' . substr($date, 4, 2) . '-' . substr($date, 6, 2); - $retd = $db->query("UPDATE `llx_societe` SET `datec` = '$datec 00:00:00' WHERE `rowid` = $object->id"); - if ($retd < 1) { - print " - Error in update date créa result " . $object->errorsToString(); - $errorrecord++; - } else { - print " - update date créa OK"; - } - } - print "\n"; + //update date créa + if (!$errorrecord) { + $datec = substr($date, 0, 4) . '-' . substr($date, 4, 2) . '-' . substr($date, 6, 2); + $retd = $db->query("UPDATE `llx_societe` SET `datec` = '$datec 00:00:00' WHERE `rowid` = $object->id"); + if ($retd < 1) { + print " - Error in update date créa result " . $object->errorsToString(); + $errorrecord++; + } else { + print " - update date créa OK"; + } + } + print "\n"; - if ($errorrecord) { - print( 'Error on record nb ' . $i . " - " . $object->errorsToString() . "\n"); - var_dump($db, $object, $contact); -// $db->rollback(); - die(); - $error++; // $errorrecord will be reset - } - $j++; - } else + if ($errorrecord) { + print( 'Error on record nb ' . $i . " - " . $object->errorsToString() . "\n"); + var_dump($db, $object, $contact); + // $db->rollback(); + die(); + $error++; // $errorrecord will be reset + } + $j++; +} else die("error : $sql"); $db->commit(); diff --git a/dev/initdata/includes/dbase.class.php b/dev/initdata/includes/dbase.class.php index 99cc4480b5f..ba0e18db15d 100644 --- a/dev/initdata/includes/dbase.class.php +++ b/dev/initdata/includes/dbase.class.php @@ -8,7 +8,8 @@ define('DBASE_RDWR', 2); define('DBASE_TYPE_DBASE', 0); define('DBASE_TYPE_FOXPRO', 1); -class DBase { +class DBase +{ private $fd; private $headerLength = 0; @@ -18,7 +19,8 @@ class DBase { private $recordCount = 0; //resource dbase_open ( string $filename , int $mode ) - public static function open($filename, $mode) { + public static function open($filename, $mode) + { if (!file_exists($filename)) return false; $modes = array('r', 'w', 'r+'); @@ -30,7 +32,8 @@ class DBase { } //resource dbase_create ( string $filename , array $fields [, int $type = DBASE_TYPE_DBASE ] ) - public static function create($filename, $fields, $type = DBASE_TYPE_DBASE) { + public static function create($filename, $fields, $type = DBASE_TYPE_DBASE) + { if (file_exists($filename)) return false; $fd = fopen($filename, 'c+'); @@ -93,7 +96,8 @@ class DBase { } // Create DBase instance - private function __construct($fd) { + private function __construct($fd) + { $this->fd = $fd; // Byte 4-7 (32-bit number): Number of records in the database file. Currently 0 fseek($this->fd, 4, SEEK_SET); @@ -116,27 +120,32 @@ class DBase { } //bool dbase_close ( resource $dbase_identifier ) - public function close() { + public function close() + { fclose($this->fd); } //array dbase_get_header_info ( resource $dbase_identifier ) - public function get_header_info() { + public function get_header_info() + { return $this->fields; } //int dbase_numfields ( resource $dbase_identifier ) - public function numfields() { + public function numfields() + { return $this->fieldCount; } //int dbase_numrecords ( resource $dbase_identifier ) - public function numrecords() { + public function numrecords() + { return $this->recordCount; } //bool dbase_add_record ( resource $dbase_identifier , array $record ) - public function add_record($record) { + public function add_record($record) + { if (count($record) != $this->fieldCount) return false; // Seek to end of file, minus the end of file marker @@ -153,7 +162,8 @@ class DBase { } //bool dbase_replace_record ( resource $dbase_identifier , array $record , int $record_number ) - public function replace_record($record, $record_number) { + public function replace_record($record, $record_number) + { if (count($record) != $this->fieldCount) return false; if ($record_number < 1 || $record_number > $this->recordCount) @@ -164,7 +174,8 @@ class DBase { } //bool dbase_delete_record ( resource $dbase_identifier , int $record_number ) - public function delete_record($record_number) { + public function delete_record($record_number) + { if ($record_number < 1 || $record_number > $this->recordCount) return false; fseek($this->fd, $this->headerLength + ($this->recordLength * ($record_number - 1))); @@ -173,7 +184,8 @@ class DBase { } //array dbase_get_record ( resource $dbase_identifier , int $record_number ) - public function get_record($record_number) { + public function get_record($record_number) + { if ($record_number < 1 || $record_number > $this->recordCount) return false; fseek($this->fd, $this->headerLength + ($this->recordLength * ($record_number - 1))); @@ -186,7 +198,7 @@ class DBase { $value = strtolower($value); if ($value == 't' || $value == 'y') $value = true; - else if ($value == 'f' || $value == 'n') + elseif ($value == 'f' || $value == 'n') $value = false; else $value = null; @@ -197,7 +209,8 @@ class DBase { } //array dbase_get_record_with_names ( resource $dbase_identifier , int $record_number ) - public function get_record_with_names($record_number) { + public function get_record_with_names($record_number) + { if ($record_number < 1 || $record_number > $this->recordCount) return false; $record = $this->get_record($record_number); @@ -209,7 +222,8 @@ class DBase { } //bool dbase_pack ( resource $dbase_identifier ) - public function pack() { + public function pack() + { $in_offset = $out_offset = $this->headerLength; $new_count = 0; $rec_count = $this->recordCount; @@ -236,7 +250,8 @@ class DBase { * A few utilitiy functions */ - private static function length($field) { + private static function length($field) + { switch ($field[1]) { case 'D': // Date: Numbers and a character to separate month, day, and year (stored internally as 8 digits in YYYYMMDD format) return 8; @@ -257,15 +272,18 @@ class DBase { * Functions for reading and writing bytes */ - private static function getChar8($fd) { + private static function getChar8($fd) + { return ord(fread($fd, 1)); } - private static function putChar8($fd, $value) { + private static function putChar8($fd, $value) + { return fwrite($fd, chr($value)); } - private static function getInt16($fd, $n = 1) { + private static function getInt16($fd, $n = 1) + { $data = fread($fd, 2 * $n); $i = unpack("S$n", $data); if ($n == 1) @@ -274,11 +292,13 @@ class DBase { return array_merge($i); } - private static function putInt16($fd, $value) { + private static function putInt16($fd, $value) + { return fwrite($fd, pack('S', $value)); } - private static function getInt32($fd, $n = 1) { + private static function getInt32($fd, $n = 1) + { $data = fread($fd, 4 * $n); $i = unpack("L$n", $data); if ($n == 1) @@ -287,15 +307,18 @@ class DBase { return array_merge($i); } - private static function putInt32($fd, $value) { + private static function putInt32($fd, $value) + { return fwrite($fd, pack('L', $value)); } - private static function putString($fd, $value, $length = 254) { + private static function putString($fd, $value, $length = 254) + { $ret = fwrite($fd, pack('A' . $length, $value)); } - private function putRecord($record) { + private function putRecord($record) + { foreach ($this->fields as $i => &$field) { $value = $record[$i]; // Number types are right aligned with spaces @@ -306,57 +329,68 @@ class DBase { } return true; } - } if (!function_exists('dbase_open')) { - function dbase_open($filename, $mode) { + function dbase_open($filename, $mode) + { return DBase::open($filename, $mode); } - function dbase_create($filename, $fields, $type = DBASE_TYPE_DBASE) { + function dbase_create($filename, $fields, $type = DBASE_TYPE_DBASE) + { return DBase::create($filename, $fields, $type); } - function dbase_close($dbase_identifier) { + function dbase_close($dbase_identifier) + { return $dbase_identifier->close(); } - function dbase_get_header_info($dbase_identifier) { + function dbase_get_header_info($dbase_identifier) + { return $dbase_identifier->get_header_info(); } - function dbase_numfields($dbase_identifier) { + function dbase_numfields($dbase_identifier) + { $dbase_identifier->numfields(); } - function dbase_numrecords($dbase_identifier) { + function dbase_numrecords($dbase_identifier) + { return $dbase_identifier->numrecords(); } - function dbase_add_record($dbase_identifier, $record) { + function dbase_add_record($dbase_identifier, $record) + { return $dbase_identifier->add_record($record); } - function dbase_delete_record($dbase_identifier, $record_number) { + function dbase_delete_record($dbase_identifier, $record_number) + { return $dbase_identifier->delete_record($record_number); } - function dbase_replace_record($dbase_identifier, $record, $record_number) { + function dbase_replace_record($dbase_identifier, $record, $record_number) + { return $dbase_identifier->replace_record($record, $record_number); } - function dbase_get_record($dbase_identifier, $record_number) { + function dbase_get_record($dbase_identifier, $record_number) + { return $dbase_identifier->get_record($record_number); } - function dbase_get_record_with_names($dbase_identifier, $record_number) { + function dbase_get_record_with_names($dbase_identifier, $record_number) + { return $dbase_identifier->get_record_with_names($record_number); } - function dbase_pack($dbase_identifier) { + function dbase_pack($dbase_identifier) + { return $dbase_identifier->pack(); } -} \ No newline at end of file +} From a893b4220263317dc5dd81134a34704577396396 Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Wed, 15 Jan 2020 10:02:18 +0100 Subject: [PATCH 097/784] Show extra short php function overview --- htdocs/admin/system/phpinfo.php | 103 +++++++++++++++++++++++++++++--- 1 file changed, 96 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index bcc3aba20d4..fc98460892c 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -28,6 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $langs->load("admin"); +$langs->load("install"); +$langs->load("errors"); if (! $user->admin) accessforbidden(); @@ -66,20 +68,107 @@ if ($maxphp > 0 && $maxphp2 > 0 && $maxphp > $maxphp2) print '
'; } - print ''; print ''; print "\n"; +$ErrorPicturePath = "../../theme/eldy/img/error.png"; +$WarningPicturePath = "../../theme/eldy/img/warning.png"; +$OkayPicturePath = "../../theme/eldy/img/tick.png"; -// Get PHP version -$phpversion=version_php(); -print '\n"; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Version")."".$phpversion."
'.$langs->trans("Version").''; +if (versioncompare(versionphparray(), array(5,5,0)) < 0) +{ + print 'Error '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror)); +} +elseif (versioncompare(versionphparray(), array(5,5,0)) < 0) +{ + print 'Error '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionwarning)); +} +else +{ + print 'Ok '.versiontostring(versionphparray()); +} + +print '
GET and POST support'; + +if (! isset($_GET["testget"]) && ! isset($_POST["testpost"])) +{ + print 'Warning '.$langs->trans("PHPSupportPOSTGETKo"); + print ' ('.$langs->trans("Recheck").')'; +} +else +{ + print 'Ok '.$langs->trans("PHPSupportPOSTGETOk"); +} + +print '
Sessions support'; + +if (! function_exists("session_id")) +{ + print 'Error '.$langs->trans("ErrorPHPDoesNotSupportSessions"); +} +else +{ + print 'Ok '.$langs->trans("PHPSupportSessions"); +} + +print '
GD support'; + +if (! function_exists("imagecreate")) +{ + print 'Error '.$langs->trans("ErrorPHPDoesNotSupportGD"); +} +else +{ + print 'Ok '.$langs->trans("PHPSupportGD"); +} + +print '
Curl support'; + +if (! function_exists("curl_init")) +{ + print 'Error '.$langs->trans("ErrorPHPDoesNotSupportCurl"); +} +else +{ + print 'Ok '.$langs->trans("PHPSupportCurl"); +} + +print '
UTF-8 support'; + +if (! function_exists("utf8_encode")) +{ + print 'Error '.$langs->trans("ErrorPHPDoesNotSupportUTF8"); +} +else +{ + print 'Ok '.$langs->trans("PHPSupportUTF8"); +} + +print '
Intl support'; + +if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@localhost') +{ + if (! function_exists("locale_get_primary_language") || ! function_exists("locale_get_region")) + { + print 'Error '.$langs->trans("ErrorPHPDoesNotSupportIntl"); + } + else + { + print 'Ok '.$langs->trans("PHPSupportIntl"); + } +} + +print '
'; -print '
'; - - // Get php_info array $phparray=phpinfo_array(); From c47da64476065e2c0f7f03176a4f8940c536213d Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Wed, 15 Jan 2020 10:13:55 +0100 Subject: [PATCH 098/784] A few fixes --- htdocs/admin/system/phpinfo.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index fc98460892c..237973f26df 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -78,13 +78,15 @@ $OkayPicturePath = "../../theme/eldy/img/tick.png"; print '
'.$langs->trans("Version").''; -if (versioncompare(versionphparray(), array(5,5,0)) < 0) +$arrayphpminversionerror = array(5,5,0); +$arrayphpminversionwarning = array(5,5,0); +if (versioncompare(versionphparray(), , $arrayphpminversionerror) < 0) { print 'Error '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror)); } -elseif (versioncompare(versionphparray(), array(5,5,0)) < 0) +elseif (versioncompare(versionphparray(), $arrayphpminversionwarning) < 0) { - print 'Error '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionwarning)); + print 'Warning '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionwarning)); } else { @@ -109,7 +111,7 @@ print '
Sessions support'; if (! function_exists("session_id")) { - print 'Error '.$langs->trans("ErrorPHPDoesNotSupportSessions"); + print 'Error '.$langs->trans("ErrorPHPDoesNotSupportSessions"); } else { @@ -121,7 +123,7 @@ print '
GD support'; if (! function_exists("imagecreate")) { - print 'Error '.$langs->trans("ErrorPHPDoesNotSupportGD"); + print 'Warning '.$langs->trans("ErrorPHPDoesNotSupportGD"); } else { @@ -133,7 +135,7 @@ print '
Curl support'; if (! function_exists("curl_init")) { - print 'Error '.$langs->trans("ErrorPHPDoesNotSupportCurl"); + print 'Warning '.$langs->trans("ErrorPHPDoesNotSupportCurl"); } else { @@ -145,7 +147,7 @@ print '
UTF-8 support'; if (! function_exists("utf8_encode")) { - print 'Error '.$langs->trans("ErrorPHPDoesNotSupportUTF8"); + print 'Warning '.$langs->trans("ErrorPHPDoesNotSupportUTF8"); } else { @@ -159,7 +161,7 @@ if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@loc { if (! function_exists("locale_get_primary_language") || ! function_exists("locale_get_region")) { - print 'Error '.$langs->trans("ErrorPHPDoesNotSupportIntl"); + print 'Warning '.$langs->trans("ErrorPHPDoesNotSupportIntl"); } else { From 503671a307e63c5f1d08eef0a4225b009c4f45c6 Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Wed, 15 Jan 2020 10:21:36 +0100 Subject: [PATCH 099/784] Fix lint error --- htdocs/admin/system/phpinfo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index 237973f26df..45d9166811a 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -80,7 +80,7 @@ print '
'.$langs->trans("Version").''; $arrayphpminversionerror = array(5,5,0); $arrayphpminversionwarning = array(5,5,0); -if (versioncompare(versionphparray(), , $arrayphpminversionerror) < 0) +if (versioncompare(versionphparray(), $arrayphpminversionerror) < 0) { print 'Error '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror)); } From 82757e6d03b0cab91503bce87803e02d9c596e59 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Jan 2020 12:23:14 +0100 Subject: [PATCH 100/784] Move files --- dev/initdata/{ => dbf}/import-dbf.php | 6 +++--- dev/initdata/{ => dbf}/importdb-products.php | 4 ++-- dev/initdata/{ => dbf}/importdb-thirdparties.php | 2 +- dev/initdata/{ => dbf}/includes/dbase.class.php | 2 -- dev/initdata/generate-invoice.php | 2 +- dev/initdata/generate-order.php | 2 +- dev/initdata/generate-product.php | 2 +- dev/initdata/generate-proposal.php | 2 +- dev/initdata/generate-thirdparty.php | 2 +- dev/initdata/import-products.php | 2 +- dev/initdata/import-thirdparties.php | 2 +- dev/initdata/import-users.php | 2 +- 12 files changed, 14 insertions(+), 16 deletions(-) rename dev/initdata/{ => dbf}/import-dbf.php (95%) rename dev/initdata/{ => dbf}/importdb-products.php (97%) rename dev/initdata/{ => dbf}/importdb-thirdparties.php (98%) rename dev/initdata/{ => dbf}/includes/dbase.class.php (99%) diff --git a/dev/initdata/import-dbf.php b/dev/initdata/dbf/import-dbf.php similarity index 95% rename from dev/initdata/import-dbf.php rename to dev/initdata/dbf/import-dbf.php index de904ca76e1..a694a878404 100644 --- a/dev/initdata/import-dbf.php +++ b/dev/initdata/dbf/import-dbf.php @@ -20,9 +20,9 @@ */ /** - * \file dev/initdata/import-product.php + * \file dev/initdata/import-dbf.php * \brief Script example to create a table from a large DBF file (openoffice) - * To purge data, you can have a look at purge-data.php + * To purge data, you can have a look at purge-data.php */ // Test si mode batch $sapi_type = php_sapi_name(); @@ -30,7 +30,7 @@ $script_file = basename(__FILE__); $path = dirname(__FILE__) . '/'; if (substr($sapi_type, 0, 3) == 'cgi') { - echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; exit; } diff --git a/dev/initdata/importdb-products.php b/dev/initdata/dbf/importdb-products.php similarity index 97% rename from dev/initdata/importdb-products.php rename to dev/initdata/dbf/importdb-products.php index 08e960dfdc6..845064f0688 100644 --- a/dev/initdata/importdb-products.php +++ b/dev/initdata/dbf/importdb-products.php @@ -29,7 +29,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path = dirname(__FILE__) . '/'; if (substr($sapi_type, 0, 3) == 'cgi') { - echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; exit; } @@ -75,7 +75,7 @@ dol_syslog($script_file . " launched with arg " . implode(',', $argv)); $table = $argv[1]; if (empty($argv[1])) { - print "Error: Quelle table ?\n"; + print "Error: Which table ?\n"; print "\n"; exit(-1); } diff --git a/dev/initdata/importdb-thirdparties.php b/dev/initdata/dbf/importdb-thirdparties.php similarity index 98% rename from dev/initdata/importdb-thirdparties.php rename to dev/initdata/dbf/importdb-thirdparties.php index 195c1d16b82..8f0eb0635f0 100644 --- a/dev/initdata/importdb-thirdparties.php +++ b/dev/initdata/dbf/importdb-thirdparties.php @@ -29,7 +29,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path = dirname(__FILE__) . '/'; if (substr($sapi_type, 0, 3) == 'cgi') { - echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; exit; } diff --git a/dev/initdata/includes/dbase.class.php b/dev/initdata/dbf/includes/dbase.class.php similarity index 99% rename from dev/initdata/includes/dbase.class.php rename to dev/initdata/dbf/includes/dbase.class.php index ba0e18db15d..f7383d344a2 100644 --- a/dev/initdata/includes/dbase.class.php +++ b/dev/initdata/dbf/includes/dbase.class.php @@ -10,7 +10,6 @@ define('DBASE_TYPE_FOXPRO', 1); class DBase { - private $fd; private $headerLength = 0; private $fields = array(); @@ -392,5 +391,4 @@ if (!function_exists('dbase_open')) { { return $dbase_identifier->pack(); } - } diff --git a/dev/initdata/generate-invoice.php b/dev/initdata/generate-invoice.php index 0c754b1c874..220144f2a7d 100755 --- a/dev/initdata/generate-invoice.php +++ b/dev/initdata/generate-invoice.php @@ -26,7 +26,7 @@ // Test si mode batch $sapi_type = php_sapi_name(); if (substr($sapi_type, 0, 3) == 'cgi') { - echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; exit; } diff --git a/dev/initdata/generate-order.php b/dev/initdata/generate-order.php index b66d3a3abc9..129313c70fd 100755 --- a/dev/initdata/generate-order.php +++ b/dev/initdata/generate-order.php @@ -27,7 +27,7 @@ // Test si mode batch $sapi_type = php_sapi_name(); if (substr($sapi_type, 0, 3) == 'cgi') { - echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; exit; } diff --git a/dev/initdata/generate-product.php b/dev/initdata/generate-product.php index 83951c57df7..49fd9860467 100755 --- a/dev/initdata/generate-product.php +++ b/dev/initdata/generate-product.php @@ -27,7 +27,7 @@ // Test si mode batch $sapi_type = php_sapi_name(); if (substr($sapi_type, 0, 3) == 'cgi') { - echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; exit; } diff --git a/dev/initdata/generate-proposal.php b/dev/initdata/generate-proposal.php index ad8cf6025bb..d0b2cd4aa56 100755 --- a/dev/initdata/generate-proposal.php +++ b/dev/initdata/generate-proposal.php @@ -27,7 +27,7 @@ // Test si mode batch $sapi_type = php_sapi_name(); if (substr($sapi_type, 0, 3) == 'cgi') { - echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; exit; } diff --git a/dev/initdata/generate-thirdparty.php b/dev/initdata/generate-thirdparty.php index 9f740b5705d..91c7c969b75 100755 --- a/dev/initdata/generate-thirdparty.php +++ b/dev/initdata/generate-thirdparty.php @@ -27,7 +27,7 @@ // Test si mode batch $sapi_type = php_sapi_name(); if (substr($sapi_type, 0, 3) == 'cgi') { - echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; exit; } diff --git a/dev/initdata/import-products.php b/dev/initdata/import-products.php index e55f13c7c82..4288c5bf3b1 100755 --- a/dev/initdata/import-products.php +++ b/dev/initdata/import-products.php @@ -30,7 +30,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path=dirname(__FILE__).'/'; if (substr($sapi_type, 0, 3) == 'cgi') { - echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; exit; } diff --git a/dev/initdata/import-thirdparties.php b/dev/initdata/import-thirdparties.php index 558745e8d06..ef1dfcc99ab 100755 --- a/dev/initdata/import-thirdparties.php +++ b/dev/initdata/import-thirdparties.php @@ -30,7 +30,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path=dirname(__FILE__).'/'; if (substr($sapi_type, 0, 3) == 'cgi') { - echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; exit; } diff --git a/dev/initdata/import-users.php b/dev/initdata/import-users.php index 64af2f9eb64..60a672adf12 100755 --- a/dev/initdata/import-users.php +++ b/dev/initdata/import-users.php @@ -30,7 +30,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path=dirname(__FILE__).'/'; if (substr($sapi_type, 0, 3) == 'cgi') { - echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; exit; } From 6e367b64066f2a23136f19283aab020a579e5c0c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Jan 2020 12:56:36 +0100 Subject: [PATCH 101/784] Fix detection --- htdocs/admin/system/phpinfo.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index 45d9166811a..16825530374 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -96,7 +96,7 @@ else print '
GET and POST support'; -if (! isset($_GET["testget"]) && ! isset($_POST["testpost"])) +if (! isset($_GET["testget"]) && ! isset($_POST["testpost"]) && ! isset($_GET["mainmenu"])) { print 'Warning '.$langs->trans("PHPSupportPOSTGETKo"); print ' ('.$langs->trans("Recheck").')'; @@ -172,6 +172,8 @@ if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@loc print '
'; +print '
'; + // Get php_info array $phparray=phpinfo_array(); foreach($phparray as $key => $value) From d771efe37c7da03a80dc9973f55ea676c3bdc256 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Jan 2020 13:08:29 +0100 Subject: [PATCH 102/784] Fix phpcs --- .travis.yml | 2 +- dev/initdata/dbf/import-dbf.php | 10 ++++++++++ dev/initdata/dbf/includes/dbase.class.php | 8 ++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0aaa07158c1..fa2291162ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -285,7 +285,7 @@ script: # Ensure we catch errors set -e #parallel-lint --exclude htdocs/includes --blame . - parallel-lint --exclude dev/namespacemig --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/composer/autoload_static.php --blame . + parallel-lint --exclude dev/namespacemig --exclude dev/initdata/dbf/includes --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/composer/autoload_static.php --blame . set +e echo diff --git a/dev/initdata/dbf/import-dbf.php b/dev/initdata/dbf/import-dbf.php index a694a878404..0718a472cd6 100644 --- a/dev/initdata/dbf/import-dbf.php +++ b/dev/initdata/dbf/import-dbf.php @@ -179,6 +179,14 @@ fclose($fhandleerr); exit($error); + +/** + * replaceable_echo + * + * @param string $message Message + * @param int $force_clear_lines Force clear messages + * @return void + */ function replaceable_echo($message, $force_clear_lines = null) { static $last_lines = 0; @@ -187,6 +195,8 @@ function replaceable_echo($message, $force_clear_lines = null) $last_lines = $force_clear_lines; } + $toss = array(); + $status = 0; $term_width = exec('tput cols', $toss, $status); if ($status) { $term_width = 64; // Arbitrary fall-back term width. diff --git a/dev/initdata/dbf/includes/dbase.class.php b/dev/initdata/dbf/includes/dbase.class.php index f7383d344a2..0c2f6820a96 100644 --- a/dev/initdata/dbf/includes/dbase.class.php +++ b/dev/initdata/dbf/includes/dbase.class.php @@ -1,4 +1,9 @@ Date: Wed, 15 Jan 2020 13:24:23 +0100 Subject: [PATCH 103/784] Removed useless include --- htdocs/core/class/html.formmargin.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index e382d63566d..6857eddf44a 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -21,8 +21,6 @@ * \brief Fichier de la classe des fonctions predefinie de composants html autre */ -require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; - /** * Classe permettant la generation de composants html autre From ce2b0b9cad131f15b700d6d08112a113cb1ce748 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Jan 2020 13:51:06 +0100 Subject: [PATCH 104/784] Trans --- htdocs/langs/en_US/projects.lang | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 6d062056d4d..c06743613ad 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -255,3 +255,7 @@ ProjectFollowTasks=Follow tasks UsageOpportunity=Usage: Opportunity UsageTasks=Usage: Tasks UsageBillTimeShort=Usage: Bill time +InvoiceToUse=Draft invoice to use +NewInvoice=New invoice +OneLinePerTask=One line per task +OneLinePerPeriod=One line per period \ No newline at end of file From 64564e75ae3a33cdeb94fe4f33184d627710861f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Jan 2020 13:55:17 +0100 Subject: [PATCH 105/784] Add entity into unique key --- htdocs/install/mysql/migration/11.0.0-12.0.0.sql | 10 +++++++--- htdocs/install/mysql/tables/llx_bookmark.key.sql | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 7d8cd906ffe..27f769885af 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -33,9 +33,13 @@ -- For v12 + ALTER TABLE llx_bookmark DROP INDEX uk_bookmark_url; -ALTER TABLE llx_bookmark MODIFY COLUMN url TEXT; -- change from VARCHAR(255) to allow longer URLs -ALTER TABLE llx_bookmark ADD UNIQUE uk_bookmark_title (fk_user, title); +ALTER TABLE llx_bookmark DROP INDEX uk_bookmark_title; + +ALTER TABLE llx_bookmark MODIFY COLUMN url TEXT; + +ALTER TABLE llx_bookmark ADD UNIQUE uk_bookmark_title (fk_user, entity, title); ALTER TABLE llx_societe_rib ADD COLUMN stripe_account varchar(128); @@ -45,7 +49,7 @@ create table llx_object_lang ( rowid integer AUTO_INCREMENT PRIMARY KEY, fk_object integer DEFAULT 0 NOT NULL, - type_object varchar(32) NOT NULL, -- 'thirdparty', 'contact', '...' + type_object varchar(32) NOT NULL, property varchar(32) NOT NULL, lang varchar(5) DEFAULT 0 NOT NULL, value text, diff --git a/htdocs/install/mysql/tables/llx_bookmark.key.sql b/htdocs/install/mysql/tables/llx_bookmark.key.sql index 7f4090d32f4..2c0cac1922e 100644 --- a/htdocs/install/mysql/tables/llx_bookmark.key.sql +++ b/htdocs/install/mysql/tables/llx_bookmark.key.sql @@ -17,4 +17,4 @@ -- =================================================================== -ALTER TABLE llx_bookmark ADD UNIQUE uk_bookmark_title (fk_user, title); +ALTER TABLE llx_bookmark ADD UNIQUE uk_bookmark_title (fk_user, entity, title); From eddc38e37f77ef85778ddfb4d5bfa6e0181d51d6 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 15 Jan 2020 13:18:25 +0000 Subject: [PATCH 106/784] Fixing style errors. --- htdocs/projet/tasks/time.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 779bd6ac2fd..efaaa5b75ca 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -235,8 +235,8 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$_POST["cancel $result = $object->delTimeSpent($user); $object->fetch($id, $ref); - $object->timespent_note = $_POST["timespent_note_line"]; - $object->timespent_old_duration = $_POST["old_duration"]; + $object->timespent_note = $_POST["timespent_note_line"]; + $object->timespent_old_duration = $_POST["old_duration"]; $object->timespent_duration = $_POST["new_durationhour"] * 60 * 60; // We store duration in seconds $object->timespent_duration += ($_POST["new_durationmin"] ? $_POST["new_durationmin"] : 0) * 60; // We store duration in seconds if (GETPOST("timelinehour") != '' && GETPOST("timelinehour") >= 0) // If hour was entered From 62b84810bd2ea6f1ed83b4406222c6ff8517eb23 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Jan 2020 14:25:16 +0100 Subject: [PATCH 107/784] Exclude includes in dev --- dev/setup/codesniffer/ruleset.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 015733ed95f..460f815755e 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -6,6 +6,7 @@ build/html build/aps dev/namespacemig + dev/initdata/dbf/includes documents htdocs/core/class/lessc.class.php htdocs/custom From 53ddbc1eb530c101aefd53f24a7301040dee9035 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Wed, 15 Jan 2020 16:24:04 +0100 Subject: [PATCH 108/784] FIX remove repeated sql fields in product list --- htdocs/product/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index debe8ba2c1e..c2fda22e532 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -291,7 +291,7 @@ $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.fk_product_type, p.barcode, p $sql .= ' p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,'; $sql .= ' p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy,'; $sql .= ' p.datec as date_creation, p.tms as date_update, p.pmp, p.stock,'; -$sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.height, p.surface, p.surface_units, p.volume, p.volume_units, p.width, p.width_units, p.height, p.height_units,'; +$sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units,'; if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ' p.fk_unit, cu.label as cu_label,'; $sql .= ' MIN(pfp.unitprice) as minsellprice'; if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) { @@ -380,7 +380,7 @@ $sql .= $hookmanager->resPrint; $sql .= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.tva_tx, p.price_ttc, p.price_base_type,"; $sql .= " p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,"; $sql .= ' p.datec, p.tms, p.entity, p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.pmp, p.stock,'; -$sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.height, p.surface, p.surface_units, p.volume, p.volume_units, p.width, p.width_units, p.height, p.height_units'; +$sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units'; if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ', p.fk_unit, cu.label'; if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) { From 09c9ee97d98985cc88f862ff08dec5aad737579b Mon Sep 17 00:00:00 2001 From: Norbert Penel Date: Wed, 15 Jan 2020 18:36:57 +0100 Subject: [PATCH 109/784] Fix modulbuilder create forms 'fk_product' => array('type' => 'integer:Product:product/class/product.class.php' ... the input was arriving with a select2 instead of an ajax search --- htdocs/core/class/html.form.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index d085ca66563..2c2064a0619 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5910,6 +5910,7 @@ class Form //var_dump($objecttmp->filter); $prefixforautocompletemode = $objecttmp->element; if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode = 'company'; + if ($prefixforautocompletemode == 'product') $prefixforautocompletemode='produit'; $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT dol_syslog(get_class($this)."::selectForForms object->filter=".$objecttmp->filter, LOG_DEBUG); From d07fa80a28fd244699af3f6029a8230f74302a48 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Jan 2020 21:09:11 +0100 Subject: [PATCH 110/784] Removed export driver using phpexcel. --- .../modules/export/export_excel.modules.php | 526 ------------------ .../export/export_excel2007.modules.php | 135 ----- 2 files changed, 661 deletions(-) delete mode 100644 htdocs/core/modules/export/export_excel.modules.php delete mode 100644 htdocs/core/modules/export/export_excel2007.modules.php diff --git a/htdocs/core/modules/export/export_excel.modules.php b/htdocs/core/modules/export/export_excel.modules.php deleted file mode 100644 index 43cb4d6e9cd..00000000000 --- a/htdocs/core/modules/export/export_excel.modules.php +++ /dev/null @@ -1,526 +0,0 @@ - - * Copyright (C) 2012 Marcos García - * - * 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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/core/modules/export/export_excel.modules.php - * \ingroup export - * \brief File of class to generate export file with Excel format - */ - -require_once DOL_DOCUMENT_ROOT.'/core/modules/export/modules_export.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - - -/** - * Class to build export files with Excel format - */ -class ExportExcel extends ModeleExports -{ - /** - * @var string ID - */ - public $id; - - /** - * @var string Export Excel label - */ - public $label; - - public $extension; - - /** - * Dolibarr version of the loaded document - * @var string - */ - public $version = 'dolibarr'; - - public $label_lib; - - public $version_lib; - - public $workbook; // Handle file - - public $worksheet; // Handle sheet - - public $row; - - public $col; - - public $file; // To save filename - - - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - public function __construct($db) - { - global $conf, $langs; - $this->db = $db; - - $this->id='excel'; // Same value then xxx in file name export_xxx.modules.php - $this->label='Excel 95 (old library)'; // Label of driver - $this->desc = $langs->trans('Excel95FormatDesc'); - $this->extension='xls'; // Extension for generated file by this driver - $this->picto='mime/xls'; // Picto - $this->version='1.30'; // Driver version - - $this->disabled = (in_array(constant('PHPEXCEL_PATH'), array('disabled','disabled/'))?1:0); // A condition to disable module (used for native debian packages) - - if (empty($this->disabled)) - { - // If driver use an external library, put its name here - if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) - { - require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_workbookbig.inc.php'; - require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_worksheet.inc.php'; - require_once PHP_WRITEEXCEL_PATH.'functions.writeexcel_utility.inc.php'; - $this->label_lib='PhpWriteExcel'; - $this->version_lib='unknown'; - } - else - { - require_once PHPEXCEL_PATH.'PHPExcel.php'; - require_once PHPEXCEL_PATH.'PHPExcel/Style/Alignment.php'; - $this->label_lib='PhpExcel'; - $this->version_lib='1.8.0'; // No way to get info from library - } - } - - $this->row=0; - } - - /** - * getDriverId - * - * @return string - */ - public function getDriverId() - { - return $this->id; - } - - /** - * getDriverLabel - * - * @return string Return driver label - */ - public function getDriverLabel() - { - return $this->label; - } - - /** - * getDriverDesc - * - * @return string - */ - public function getDriverDesc() - { - return $this->desc; - } - - /** - * getDriverExtension - * - * @return string - */ - public function getDriverExtension() - { - return $this->extension; - } - - /** - * getDriverVersion - * - * @return string - */ - public function getDriverVersion() - { - return $this->version; - } - - /** - * getLibLabel - * - * @return string - */ - public function getLibLabel() - { - return $this->label_lib; - } - - /** - * getLibVersion - * - * @return string - */ - public function getLibVersion() - { - return $this->version_lib; - } - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Open output file - * - * @param string $file File name to generate - * @param Translate $outputlangs Output language object - * @return int <0 if KO, >=0 if OK - */ - public function open_file($file, $outputlangs) - { - // phpcs:enable - global $user,$conf,$langs; - - if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) - { - $outputlangs->charset_output='ISO-8859-1'; // Because Excel 5 format is ISO - } - - dol_syslog(get_class($this)."::open_file file=".$file); - $this->file=$file; - - $ret=1; - - $outputlangs->load("exports"); - if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) { - require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_workbookbig.inc.php'; - require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_worksheet.inc.php'; - require_once PHP_WRITEEXCEL_PATH.'functions.writeexcel_utility.inc.php'; - $this->workbook = new writeexcel_workbookbig($file); - $this->workbook->set_tempdir($conf->export->dir_temp); // Set temporary directory - $this->workbook->set_sheetname($outputlangs->trans("Sheet")); - $this->worksheet = &$this->workbook->addworksheet(); - } - else - { - require_once PHPEXCEL_PATH.'PHPExcel.php'; - require_once PHPEXCEL_PATH.'PHPExcel/Style/Alignment.php'; - - if ($this->id == 'excel2007') - { - if (! class_exists('ZipArchive')) // For Excel2007, PHPExcel need ZipArchive - { - $langs->load("errors"); - $this->error=$langs->trans('ErrorPHPNeedModule', 'zip'); - return -1; - } - } - - if (!empty($conf->global->MAIN_USE_FILECACHE_EXPORT_EXCEL_DIR)) { - $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_discISAM; - $cacheSettings = array ( - 'dir' => $conf->global->MAIN_USE_FILECACHE_EXPORT_EXCEL_DIR - ); - PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings); - } - - $this->workbook = new PHPExcel(); - $this->workbook->getProperties()->setCreator($user->getFullName($outputlangs).' - '.DOL_APPLICATION_TITLE.' '.DOL_VERSION); - //$this->workbook->getProperties()->setLastModifiedBy('Dolibarr '.DOL_VERSION); - $this->workbook->getProperties()->setTitle(basename($file)); - $this->workbook->getProperties()->setSubject(basename($file)); - $this->workbook->getProperties()->setDescription(DOL_APPLICATION_TITLE.' '.DOL_VERSION); - - $this->workbook->setActiveSheetIndex(0); - $this->workbook->getActiveSheet()->setTitle($outputlangs->trans("Sheet")); - $this->workbook->getActiveSheet()->getDefaultRowDimension()->setRowHeight(16); - } - return $ret; - } - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Write header - * - * @param Translate $outputlangs Object lang to translate values - * @return int <0 if KO, >0 if OK - */ - public function write_header($outputlangs) - { - // phpcs:enable - //$outputlangs->charset_output='ISO-8859-1'; // Because Excel 5 format is ISO - - return 0; - } - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Output title line into file - * - * @param array $array_export_fields_label Array with list of label of fields - * @param array $array_selected_sorted Array with list of field to export - * @param Translate $outputlangs Object lang to translate values - * @param array $array_types Array with types of fields - * @return int <0 if KO, >0 if OK - */ - public function write_title($array_export_fields_label, $array_selected_sorted, $outputlangs, $array_types) - { - // phpcs:enable - global $conf; - - // Create a format for the column headings - if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) - { - $outputlangs->charset_output='ISO-8859-1'; // Because Excel 5 format is ISO - - $formatheader =$this->workbook->addformat(); - $formatheader->set_bold(); - $formatheader->set_color('blue'); - //$formatheader->set_size(12); - //$formatheader->set_font("Courier New"); - //$formatheader->set_align('center'); - } - else - { - $this->workbook->getActiveSheet()->getStyle('1')->getFont()->setBold(true); - $this->workbook->getActiveSheet()->getStyle('1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT); - } - - $this->col=0; - foreach($array_selected_sorted as $code => $value) - { - $alias=$array_export_fields_label[$code]; - //print "dd".$alias; - if (empty($alias)) dol_print_error('', 'Bad value for field with code='.$code.'. Try to redefine export.'); - if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) - { - $this->worksheet->write($this->row, $this->col, $outputlangs->transnoentities($alias), $formatheader); - } - else - { - $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, $outputlangs->transnoentities($alias)); - if (! empty($array_types[$code]) && in_array($array_types[$code], array('Date','Numeric','TextAuto'))) // Set autowidth for some types - { - $this->workbook->getActiveSheet()->getColumnDimension($this->column2Letter($this->col + 1))->setAutoSize(true); - } - } - $this->col++; - } - $this->row++; - return 0; - } - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Output record line into file - * - * @param array $array_selected_sorted Array with list of field to export - * @param resource $objp A record from a fetch with all fields from select - * @param Translate $outputlangs Object lang to translate values - * @param array $array_types Array with types of fields - * @return int <0 if KO, >0 if OK - */ - public function write_record($array_selected_sorted, $objp, $outputlangs, $array_types) - { - // phpcs:enable - global $conf; - - // Create a format for the column headings - if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) - { - $outputlangs->charset_output='ISO-8859-1'; // Because Excel 5 format is ISO - } - - // Define first row - $this->col=0; - - $reg=array(); - - foreach($array_selected_sorted as $code => $value) - { - if (strpos($code, ' as ') == 0) $alias=str_replace(array('.','-','(',')'), '_', $code); - else $alias=substr($code, strpos($code, ' as ') + 4); - if (empty($alias)) dol_print_error('', 'Bad value for field with code='.$code.'. Try to redefine export.'); - $newvalue=$objp->$alias; - - $newvalue=$this->excel_clean($newvalue); - $typefield=isset($array_types[$code])?$array_types[$code]:''; - - if (preg_match('/^Select:/i', $typefield, $reg) && $typefield = substr($typefield, 7)) - { - $array = unserialize($typefield); - $array = $array['options']; - $newvalue = $array[$newvalue]; - } - - // Traduction newvalue - if (preg_match('/^\((.*)\)$/i', $newvalue, $reg)) - { - $newvalue=$outputlangs->transnoentities($reg[1]); - } - else - { - $newvalue=$outputlangs->convToOutputCharset($newvalue); - } - - if (preg_match('/^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$/i', $newvalue)) - { - if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) - { - $formatdate=$this->workbook->addformat(); - $formatdate->set_num_format('yyyy-mm-dd'); - //$formatdate->set_num_format(0x0f); - $arrayvalue=preg_split('/[.,]/', xl_parse_date($newvalue)); - //print "x".$arrayvalue[0].'.'.strval($arrayvalue[1]).'
'; - $newvalue=strval($arrayvalue[0]).'.'.strval($arrayvalue[1]); // $newvalue=strval(36892.521); directly does not work because . will be convert into , later - $this->worksheet->write($this->row, $this->col, $newvalue, PHPExcel_Shared_Date::PHPToExcel($formatdate)); - } - else - { - $newvalue=dol_stringtotime($newvalue); - $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, PHPExcel_Shared_Date::PHPToExcel($newvalue)); - $coord=$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->getCoordinate(); - $this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('yyyy-mm-dd'); - } - } - elseif (preg_match('/^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]$/i', $newvalue)) - { - if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) - { - $formatdatehour=$this->workbook->addformat(); - $formatdatehour->set_num_format('yyyy-mm-dd hh:mm:ss'); - //$formatdatehour->set_num_format(0x0f); - $arrayvalue=preg_split('/[.,]/', xl_parse_date($newvalue)); - //print "x".$arrayvalue[0].'.'.strval($arrayvalue[1]).'
'; - $newvalue=strval($arrayvalue[0]).'.'.strval($arrayvalue[1]); // $newvalue=strval(36892.521); directly does not work because . will be convert into , later - $this->worksheet->write($this->row, $this->col, $newvalue, $formatdatehour); - } - else - { - $newvalue=dol_stringtotime($newvalue); - $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, PHPExcel_Shared_Date::PHPToExcel($newvalue)); - $coord=$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->getCoordinate(); - $this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('yyyy-mm-dd h:mm:ss'); - } - } - else - { - if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) - { - $this->worksheet->write($this->row, $this->col, $newvalue); - } - else - { - if ($typefield == 'Text' || $typefield == 'TextAuto') - { - //$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->setValueExplicit($newvalue, PHPExcel_Cell_DataType::TYPE_STRING); - $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, (string) $newvalue); - $coord=$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->getCoordinate(); - $this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('@'); - $this->workbook->getActiveSheet()->getStyle($coord)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT); - } - else - { - $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, $newvalue); - } - } - } - $this->col++; - } - $this->row++; - return 0; - } - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Write footer - * - * @param Translate $outputlangs Output language object - * @return int <0 if KO, >0 if OK - */ - public function write_footer($outputlangs) - { - // phpcs:enable - return 0; - } - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Close Excel file - * - * @return int <0 if KO, >0 if OK - */ - public function close_file() - { - // phpcs:enable - global $conf; - - if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) - { - $this->workbook->close(); - } - else - { - require_once PHPEXCEL_PATH.'PHPExcel/Writer/Excel5.php'; - $objWriter = new PHPExcel_Writer_Excel5($this->workbook); - $objWriter->save($this->file); - $this->workbook->disconnectWorksheets(); - unset($this->workbook); - } - return 1; - } - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Clean a cell to respect rules of Excel file cells - * - * @param string $newvalue String to clean - * @return string Value cleaned - */ - public function excel_clean($newvalue) - { - // phpcs:enable - // Rule Dolibarr: No HTML - $newvalue=dol_string_nohtmltag($newvalue); - - return $newvalue; - } - - - /** - * Convert a column to letter (1->A, 0->B, 27->AA, ...) - * - * @param int $c Column position - * @return string Letter - */ - public function column2Letter($c) - { - - $c = intval($c); - $letter = ''; - if ($c <= 0) { - return ''; - } - - while ($c != 0) { - $p = ($c - 1) % 26; - $c = intval(($c - $p) / 26); - $letter = chr(65 + $p) . $letter; - } - - return $letter; - } -} diff --git a/htdocs/core/modules/export/export_excel2007.modules.php b/htdocs/core/modules/export/export_excel2007.modules.php deleted file mode 100644 index ac9eb3ddfe6..00000000000 --- a/htdocs/core/modules/export/export_excel2007.modules.php +++ /dev/null @@ -1,135 +0,0 @@ - - * Copyright (C) 2012 Marcos García - * - * 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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/core/modules/export/export_excel2007.modules.php - * \ingroup export - * \brief File of class to generate export file with Excel format - */ - -require_once DOL_DOCUMENT_ROOT.'/core/modules/export/modules_export.php'; -require_once DOL_DOCUMENT_ROOT.'/core/modules/export/export_excel.modules.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - - -/** - * Class to build export files with Excel format - */ -class ExportExcel2007 extends ExportExcel -{ - /** - * @var string ID - */ - public $id; - - /** - * @var string label - */ - public $label; - - public $extension; - - /** - * Dolibarr version of the loaded document - * @var string - */ - public $version = 'dolibarr'; - - public $label_lib; - - public $version_lib; - - public $workbook; // Handle fichier - - public $worksheet; // Handle onglet - - public $row; - - public $col; - - public $file; // To save filename - - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - public function __construct($db) - { - global $conf, $langs; - $this->db = $db; - - $this->id='excel2007'; // Same value then xxx in file name export_xxx.modules.php - $this->label='Excel 2007 (old library)'; // Label of driver - $this->desc = $langs->trans('Excel2007FormatDesc'); - $this->extension='xlsx'; // Extension for generated file by this driver - $this->picto='mime/xls'; // Picto - $this->version='1.30'; // Driver version - - $this->disabled = (in_array(constant('PHPEXCEL_PATH'), array('disabled','disabled/'))?1:0); // A condition to disable module (used for native debian packages) - - if (empty($this->disabled)) - { - // If driver use an external library, put its name here - if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) - { - require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_workbookbig.inc.php'; - require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_worksheet.inc.php'; - require_once PHP_WRITEEXCEL_PATH.'functions.writeexcel_utility.inc.php'; - $this->label_lib='PhpWriteExcel'; - $this->version_lib='unknown'; - } - else - { - require_once PHPEXCEL_PATH.'PHPExcel.php'; - require_once PHPEXCEL_PATH.'PHPExcel/Style/Alignment.php'; - $this->label_lib='PhpExcel'; - $this->version_lib='1.8.0'; // No way to get info from library - } - } - - $this->row=0; - } - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Close Excel file - * - * @return int <0 if KO, >0 if OK - */ - public function close_file() - { - // phpcs:enable - global $conf; - - if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) - { - $this->workbook->close(); - } - else - { - require_once PHPEXCEL_PATH.'PHPExcel/Writer/Excel5.php'; - $objWriter = new PHPExcel_Writer_Excel2007($this->workbook); - $objWriter->save($this->file); - $this->workbook->disconnectWorksheets(); - unset($this->workbook); - } - return 1; - } -} From 023da33297f5aa8c615f093bcd678ef7484cb4a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Jan 2020 22:57:47 +0100 Subject: [PATCH 111/784] Export with the new lib --- test/phpunit/ExportTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/phpunit/ExportTest.php b/test/phpunit/ExportTest.php index 7f440bf067d..296b1a2d9b4 100644 --- a/test/phpunit/ExportTest.php +++ b/test/phpunit/ExportTest.php @@ -246,7 +246,7 @@ class ExportTest extends PHPUnit\Framework\TestCase $expectedresult=1; $this->assertEquals($expectedresult, $result); - $model='excel'; + $model='excel2007new'; // Build export file $result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql); From 8973176d49d71f1787c9eb85d600db0db4fb87af Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Jan 2020 23:01:36 +0100 Subject: [PATCH 112/784] Fix class not found --- htdocs/fourn/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 8d0d5399eb1..23031d09d90 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -36,6 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; if (!empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; +if (!empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; // Load translation files required by page $langs->loadLangs(array( From 2b9dc449806c90d5e6a3219a4dbf500817e2ec84 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Jan 2020 00:03:17 +0100 Subject: [PATCH 113/784] Missing tables --- htdocs/install/mysql/migration/10.0.0-11.0.0.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 08936186036..9db7c2f382d 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -566,3 +566,14 @@ ALTER TABLE llx_emailcollector_emailcollector ADD UNIQUE INDEX uk_emailcollector ALTER TABLE llx_website ADD COLUMN use_manifest integer; ALTER TABLE llx_facture_rec MODIFY COLUMN fk_cond_reglement integer NOT NULL DEFAULT 1; + +create table llx_commande_fournisseur_dispatch_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, -- object id + import_key varchar(14) -- import key +)ENGINE=innodb; + +ALTER TABLE llx_commande_fournisseur_dispatch_extrafields ADD INDEX idx_commande_fournisseur_dispatch_extrafields (fk_object); + From e8fbf4580720a71d6c470c3d9dc40a5ca41e1eff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Jan 2020 00:03:30 +0100 Subject: [PATCH 114/784] Fix v12 --- htdocs/install/mysql/migration/11.0.0-12.0.0.sql | 10 ++++++++++ test/phpunit/ExportTest.php | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index f60f01edcbd..2d9518a69f2 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -30,6 +30,16 @@ -- Missing in v11 +create table llx_commande_fournisseur_dispatch_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, -- object id + import_key varchar(14) -- import key +)ENGINE=innodb; + +ALTER TABLE llx_commande_fournisseur_dispatch_extrafields ADD INDEX idx_commande_fournisseur_dispatch_extrafields (fk_object); + -- For v12 diff --git a/test/phpunit/ExportTest.php b/test/phpunit/ExportTest.php index 296b1a2d9b4..f0ddc1d79d8 100644 --- a/test/phpunit/ExportTest.php +++ b/test/phpunit/ExportTest.php @@ -17,7 +17,7 @@ */ /** - * \file test/phpunit/ImportTest.php + * \file test/phpunit/ExportTest.php * \ingroup test * \brief PHPUnit test * \remarks To run this script as CLI: phpunit filename.php @@ -304,6 +304,7 @@ class ExportTest extends PHPUnit\Framework\TestCase $expectedresult=1; $this->assertEquals($expectedresult,$result); */ + $this->assertEquals(true, true); return true; } From 8728000046fe13c049b0cbae4e8ef572b8bc66f1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Jan 2020 00:23:15 +0100 Subject: [PATCH 115/784] Show log --- test/phpunit/ExportTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/phpunit/ExportTest.php b/test/phpunit/ExportTest.php index f0ddc1d79d8..9e0b4659293 100644 --- a/test/phpunit/ExportTest.php +++ b/test/phpunit/ExportTest.php @@ -237,21 +237,21 @@ class ExportTest extends PHPUnit\Framework\TestCase // Build export file $result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql); $expectedresult=1; - $this->assertEquals($expectedresult, $result); + $this->assertEquals($expectedresult, $result,'Error in CSV export'); $model='tsv'; // Build export file $result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql); $expectedresult=1; - $this->assertEquals($expectedresult, $result); + $this->assertEquals($expectedresult, $result, 'Error in TSV export'); $model='excel2007new'; // Build export file $result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql); $expectedresult=1; - $this->assertEquals($expectedresult, $result); + $this->assertEquals($expectedresult, $result, 'Error in Excel2007new export'); return true; } From 4770bdcb7923f75fca2f476266106f35e3aeb591 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Jan 2020 00:23:28 +0100 Subject: [PATCH 116/784] Show log --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index fa2291162ab..dc21b90b3ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -285,7 +285,7 @@ script: # Ensure we catch errors set -e #parallel-lint --exclude htdocs/includes --blame . - parallel-lint --exclude dev/namespacemig --exclude dev/initdata/dbf/includes --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/composer/autoload_static.php --blame . + #parallel-lint --exclude dev/namespacemig --exclude dev/initdata/dbf/includes --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/composer/autoload_static.php --blame . set +e echo @@ -295,7 +295,7 @@ script: set -e # Exclusions are defined in the ruleset.xml file #phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 . - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; fi + #if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; fi set +e echo @@ -419,7 +419,7 @@ script: - | echo "Unit testing" # Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file. - set -e + set +e phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php phpunitresult=$? echo "Phpunit return code = $phpunitresult" From 8f73bce878b21de70053754afe3b2d988f287a8c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Jan 2020 01:11:39 +0100 Subject: [PATCH 117/784] Add warning if zip lib missing --- .travis.yml | 1 + htdocs/admin/system/phpinfo.php | 11 +++++++++++ htdocs/install/check.php | 18 ++++++++++++++---- htdocs/langs/en_US/install.lang | 2 ++ test/phpunit/ExportTest.php | 3 +++ 5 files changed, 31 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index dc21b90b3ec..4f8cd9de851 100644 --- a/.travis.yml +++ b/.travis.yml @@ -254,6 +254,7 @@ before_script: fi - sudo a2enmod rewrite actions fastcgi alias - echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini + - echo "extension = zip.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars - sudo chown -R travis:travis /var/lib/apache2/fastcgi - ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index 16825530374..807cc34c626 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -169,6 +169,17 @@ if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@loc } } +print 'Zip support'; + +if (!class_exists('ZipArchive')) +{ + print 'Warning '.$langs->trans("ErrorPHPDoesNotSupportZip"); +} +else +{ + print 'Ok '.$langs->trans("PHPSupportZip"); +} + print ''; print ''; diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 9d197c752dc..6fb01d5329c 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -127,7 +127,7 @@ if (!function_exists("imagecreate")) { $langs->load("errors"); print 'Error '.$langs->trans("ErrorPHPDoesNotSupportGD")."
\n"; - // $checksok=0; // If ko, just warning. So check must still be 1 (otherwise no way to install) + // $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install) } else { @@ -140,7 +140,7 @@ if (!function_exists("curl_init")) { $langs->load("errors"); print 'Error '.$langs->trans("ErrorPHPDoesNotSupportCurl")."
\n"; - // $checksok=0; // If ko, just warning. So check must still be 1 (otherwise no way to install) + // $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install) } else { @@ -163,7 +163,7 @@ if (!function_exists("utf8_encode")) { $langs->load("errors"); print 'Error '.$langs->trans("ErrorPHPDoesNotSupportUTF8")."
\n"; - // $checksok=0; // If ko, just warning. So check must still be 1 (otherwise no way to install) + // $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install) } else { @@ -178,7 +178,7 @@ if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@loc { $langs->load("errors"); print 'Error '.$langs->trans("ErrorPHPDoesNotSupportIntl")."
\n"; - // $checksok=0; // If ko, just warning. So check must still be 1 (otherwise no way to install) + // $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install) } else { @@ -186,6 +186,16 @@ if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@loc } } +if (!class_exists('ZipArchive')) +{ + $langs->load("errors"); + print 'Error '.$langs->trans("ErrorPHPDoesNotSupport", "ZIP")."
\n"; + // $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install) +} +else +{ + print 'Ok '.$langs->trans("PHPSupport", "ZIP")."
\n"; +} // Check memory $memrequiredorig = '64M'; diff --git a/htdocs/langs/en_US/install.lang b/htdocs/langs/en_US/install.lang index 708b3bac479..1b173656a47 100644 --- a/htdocs/langs/en_US/install.lang +++ b/htdocs/langs/en_US/install.lang @@ -16,6 +16,7 @@ PHPSupportCurl=This PHP supports Curl. PHPSupportCalendar=This PHP supports calendars extensions. PHPSupportUTF8=This PHP supports UTF8 functions. PHPSupportIntl=This PHP supports Intl functions. +PHPSupport=This PHP supports %s functions. PHPMemoryOK=Your PHP max session memory is set to %s. This should be enough. PHPMemoryTooLow=Your PHP max session memory is set to %s bytes. This is too low. Change your php.ini to set memory_limit parameter to at least %s bytes. Recheck=Click here for a more detailed test @@ -25,6 +26,7 @@ ErrorPHPDoesNotSupportCurl=Your PHP installation does not support Curl. ErrorPHPDoesNotSupportCalendar=Your PHP installation does not support php calendar extensions. ErrorPHPDoesNotSupportUTF8=Your PHP installation does not support UTF8 functions. Dolibarr cannot work correctly. Resolve this before installing Dolibarr. ErrorPHPDoesNotSupportIntl=Your PHP installation does not support Intl functions. +ErrorPHPDoesNotSupport=Your PHP installation does not support %s functions. ErrorDirDoesNotExists=Directory %s does not exist. ErrorGoBackAndCorrectParameters=Go back and check/correct the parameters. ErrorWrongValueForParameter=You may have typed a wrong value for parameter '%s'. diff --git a/test/phpunit/ExportTest.php b/test/phpunit/ExportTest.php index 9e0b4659293..a9e1db601b2 100644 --- a/test/phpunit/ExportTest.php +++ b/test/phpunit/ExportTest.php @@ -235,6 +235,7 @@ class ExportTest extends PHPUnit\Framework\TestCase $model='csv'; // Build export file + print "Process build_file for model = ".$model."\n"; $result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql); $expectedresult=1; $this->assertEquals($expectedresult, $result,'Error in CSV export'); @@ -242,6 +243,7 @@ class ExportTest extends PHPUnit\Framework\TestCase $model='tsv'; // Build export file + print "Process build_file for model = ".$model."\n"; $result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql); $expectedresult=1; $this->assertEquals($expectedresult, $result, 'Error in TSV export'); @@ -249,6 +251,7 @@ class ExportTest extends PHPUnit\Framework\TestCase $model='excel2007new'; // Build export file + print "Process build_file for model = ".$model."\n"; $result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql); $expectedresult=1; $this->assertEquals($expectedresult, $result, 'Error in Excel2007new export'); From 09f7e474764fb072b0700433dad77da82faa8da5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Jan 2020 01:22:43 +0100 Subject: [PATCH 118/784] Try with libzip --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4f8cd9de851..b8017dcd4b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -254,7 +254,7 @@ before_script: fi - sudo a2enmod rewrite actions fastcgi alias - echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - - echo "extension = zip.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini + - echo "extension = libzip.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars - sudo chown -R travis:travis /var/lib/apache2/fastcgi - ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm From ace43a4227cb3cf1945316f3a59a0069e057a7b6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Jan 2020 01:40:14 +0100 Subject: [PATCH 119/784] Fix message --- htdocs/admin/system/phpinfo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index 807cc34c626..09da33c071e 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -173,11 +173,11 @@ print 'Zip support'; if (!class_exists('ZipArchive')) { - print 'Warning '.$langs->trans("ErrorPHPDoesNotSupportZip"); + print 'Warning '.$langs->trans("ErrorPHPDoesNotSupport", "Zip"); } else { - print 'Ok '.$langs->trans("PHPSupportZip"); + print 'Ok '.$langs->trans("PHPSupport", "Zip"); } print ''; From 1cc94ddb44f60c77ad6e2b802d11023799e1c655 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Jan 2020 01:44:01 +0100 Subject: [PATCH 120/784] Fix travis --- .travis.yml | 6 +++--- test/phpunit/ExportTest.php | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index b8017dcd4b4..d38b4cda4ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -286,7 +286,7 @@ script: # Ensure we catch errors set -e #parallel-lint --exclude htdocs/includes --blame . - #parallel-lint --exclude dev/namespacemig --exclude dev/initdata/dbf/includes --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/composer/autoload_static.php --blame . + parallel-lint --exclude dev/namespacemig --exclude dev/initdata/dbf/includes --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/composer/autoload_static.php --blame . set +e echo @@ -296,7 +296,7 @@ script: set -e # Exclusions are defined in the ruleset.xml file #phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 . - #if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; fi + if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; fi set +e echo @@ -420,7 +420,7 @@ script: - | echo "Unit testing" # Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file. - set +e + set -e phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php phpunitresult=$? echo "Phpunit return code = $phpunitresult" diff --git a/test/phpunit/ExportTest.php b/test/phpunit/ExportTest.php index a9e1db601b2..8115ae033aa 100644 --- a/test/phpunit/ExportTest.php +++ b/test/phpunit/ExportTest.php @@ -251,10 +251,12 @@ class ExportTest extends PHPUnit\Framework\TestCase $model='excel2007new'; // Build export file + /* ko on php 7.4 on travis (zip not available) print "Process build_file for model = ".$model."\n"; $result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql); $expectedresult=1; $this->assertEquals($expectedresult, $result, 'Error in Excel2007new export'); + */ return true; } From 74ac6a320414ea723219e222f0a04a7b526812b6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Jan 2020 02:00:52 +0100 Subject: [PATCH 121/784] Fix phpcs --- test/phpunit/ExportTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/phpunit/ExportTest.php b/test/phpunit/ExportTest.php index 8115ae033aa..00b3e80a9d5 100644 --- a/test/phpunit/ExportTest.php +++ b/test/phpunit/ExportTest.php @@ -238,7 +238,7 @@ class ExportTest extends PHPUnit\Framework\TestCase print "Process build_file for model = ".$model."\n"; $result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql); $expectedresult=1; - $this->assertEquals($expectedresult, $result,'Error in CSV export'); + $this->assertEquals($expectedresult, $result, 'Error in CSV export'); $model='tsv'; From 23865739947186e0ac440b8b1edb8442b133d24c Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Thu, 16 Jan 2020 01:53:00 +0000 Subject: [PATCH 122/784] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- htdocs/mrp/lib/mrp_mo.lib.php | 12 +- htdocs/mrp/mo_card.php | 6 +- .../stock/class/mouvementstock.class.php | 270 +++++++++--------- 3 files changed, 144 insertions(+), 144 deletions(-) diff --git a/htdocs/mrp/lib/mrp_mo.lib.php b/htdocs/mrp/lib/mrp_mo.lib.php index c3f8e7825d4..e1813a3f99c 100644 --- a/htdocs/mrp/lib/mrp_mo.lib.php +++ b/htdocs/mrp/lib/mrp_mo.lib.php @@ -45,10 +45,10 @@ function moPrepareHead($object) $head[$h][1] = $langs->trans("Production"); $arrayproduced = $object->fetchLinesLinked('produced', 0); $nbProduced = 0; - foreach($arrayproduced as $lineproduced) { + foreach ($arrayproduced as $lineproduced) { $nbProduced += $lineproduced['qty']; } - $head[$h][1].= ''.$nbProduced.' / '.$object->qty.''; + $head[$h][1] .= ''.$nbProduced.' / '.$object->qty.''; $head[$h][2] = 'production'; $h++; @@ -59,19 +59,19 @@ function moPrepareHead($object) if (!empty($object->note_public)) $nbNote++; $head[$h][0] = dol_buildpath('/mrp/mo_note.php', 1).'?id='.$object->id; $head[$h][1] = $langs->trans('Notes'); - if ($nbNote > 0) $head[$h][1].= ''.$nbNote.''; + if ($nbNote > 0) $head[$h][1] .= ''.$nbNote.''; $head[$h][2] = 'note'; $h++; } require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->mrp->dir_output . "/mo/" . dol_sanitizeFileName($object->ref); + $upload_dir = $conf->mrp->dir_output."/mo/".dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); - $nbLinks=Link::count($db, $object->element, $object->id); + $nbLinks = Link::count($db, $object->element, $object->id); $head[$h][0] = dol_buildpath("/mrp/mo_document.php", 1).'?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ''.($nbFiles+$nbLinks).''; + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ''.($nbFiles + $nbLinks).''; $head[$h][2] = 'document'; $h++; diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index bb3b19511ea..0c3e1927de0 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -136,7 +136,7 @@ if (empty($reshook)) else $backtopage = DOL_URL_ROOT.'/mrp/mo_card.php?id='.($id > 0 ? $id : '__ID__'); } } - if ($cancel && ! empty($backtopageforcancel)) { + if ($cancel && !empty($backtopageforcancel)) { $backtopage = $backtopageforcancel; } @@ -522,7 +522,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (!empty($object->lines)) { $i = 0; - foreach($object->lines as $line) { + foreach ($object->lines as $line) { if ($line->role == 'toconsume') { if ($i) print ', '; $tmpproduct = new Product($db); @@ -541,7 +541,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (!empty($object->lines)) { $i = 0; - foreach($object->lines as $line) { + foreach ($object->lines as $line) { if ($line->role == 'toproduce') { if ($i) print ', '; $tmpproduct = new Product($db); diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 40d27e26eaf..41d002eece8 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -124,19 +124,19 @@ class MouvementStock extends CommonObject dol_syslog(get_class($this)."::_create start userid=$user->id, fk_product=$fk_product, warehouse_id=$entrepot_id, qty=$qty, type=$type, price=$price, label=$label, inventorycode=$inventorycode, datem=".$datem.", eatby=".$eatby.", sellby=".$sellby.", batch=".$batch.", skip_batch=".$skip_batch); // Clean parameters - if (empty($price)) $price=0; - $now=(! empty($datem) ? $datem : dol_now()); + if (empty($price)) $price = 0; + $now = (!empty($datem) ? $datem : dol_now()); // Check parameters if (empty($fk_product)) return 0; if ($eatby < 0) { - $this->errors[]='ErrorBadValueForParameterEatBy'; + $this->errors[] = 'ErrorBadValueForParameterEatBy'; return -1; } if ($sellby < 0) { - $this->errors[]='ErrorBadValueForParameterSellBy'; + $this->errors[] = 'ErrorBadValueForParameterSellBy'; return -1; } @@ -155,7 +155,7 @@ class MouvementStock extends CommonObject $mvid = 0; $product = new Product($this->db); - $result=$product->fetch($fk_product); + $result = $product->fetch($fk_product); if ($result < 0) { dol_print_error('', "Failed to fetch product"); @@ -167,11 +167,11 @@ class MouvementStock extends CommonObject $product->load_stock('novirtual'); // Test if product require batch data. If yes, and there is not, we throw an error. - if (! empty($conf->productbatch->enabled) && $product->hasbatch() && ! $skip_batch) + if (!empty($conf->productbatch->enabled) && $product->hasbatch() && !$skip_batch) { if (empty($batch)) { - $this->errors[]=$langs->trans("ErrorTryToMakeMoveOnProductRequiringBatchData", $product->ref); + $this->errors[] = $langs->trans("ErrorTryToMakeMoveOnProductRequiringBatchData", $product->ref); dol_syslog("Try to make a movement of a product with status_batch on without any batch data"); $this->db->rollback(); @@ -185,13 +185,13 @@ class MouvementStock extends CommonObject // If found and eatby/sellby not defined into table and not provided, we do nothing // If not found, we add record $sql = "SELECT pb.rowid, pb.batch, pb.eatby, pb.sellby FROM ".MAIN_DB_PREFIX."product_lot as pb"; - $sql.= " WHERE pb.fk_product = ".$fk_product." AND pb.batch = '".$this->db->escape($batch)."'"; + $sql .= " WHERE pb.fk_product = ".$fk_product." AND pb.batch = '".$this->db->escape($batch)."'"; dol_syslog(get_class($this)."::_create scan serial for this product to check if eatby and sellby match", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); - $i=0; + $i = 0; if ($num > 0) { while ($i < $num) @@ -201,12 +201,12 @@ class MouvementStock extends CommonObject { if ($eatby) { - $tmparray=dol_getdate($eatby, true); - $eatbywithouthour=dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); + $tmparray = dol_getdate($eatby, true); + $eatbywithouthour = dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); if ($this->db->jdate($obj->eatby) != $eatby && $this->db->jdate($obj->eatby) != $eatbywithouthour) // We test date without hours and with hours for backward compatibility { // If found and eatby/sellby defined into table and provided and differs, return error - $this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby), 'dayhour'), dol_print_date($eatby, 'dayhour')); + $this->errors[] = $langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby), 'dayhour'), dol_print_date($eatby, 'dayhour')); dol_syslog("ThisSerialAlreadyExistWithDifferentDate batch=".$batch.", eatby found into product_lot = ".$obj->eatby." = ".dol_print_date($this->db->jdate($obj->eatby), 'dayhourrfc')." so eatbywithouthour = ".$eatbywithouthour." = ".dol_print_date($eatbywithouthour)." - eatby provided = ".$eatby." = ".dol_print_date($eatby, 'dayhourrfc'), LOG_ERR); $this->db->rollback(); return -3; @@ -238,12 +238,12 @@ class MouvementStock extends CommonObject { if ($sellby) { - $tmparray=dol_getdate($sellby, true); - $sellbywithouthour=dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); + $tmparray = dol_getdate($sellby, true); + $sellbywithouthour = dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); if ($this->db->jdate($obj->sellby) != $sellby && $this->db->jdate($obj->sellby) != $sellbywithouthour) // We test date without hours and with hours for backward compatibility { // If found and eatby/sellby defined into table and provided and differs, return error - $this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby)); + $this->errors[] = $langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby)); dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby)), LOG_ERR); $this->db->rollback(); return -3; @@ -303,25 +303,25 @@ class MouvementStock extends CommonObject } // Define if we must make the stock change (If product type is a service or if stock is used also for services) - $movestock=0; - if ($product->type != Product::TYPE_SERVICE || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) $movestock=1; + $movestock = 0; + if ($product->type != Product::TYPE_SERVICE || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) $movestock = 1; // Check if stock is enough when qty is < 0 // Note that qty should be > 0 with type 0 or 3, < 0 with type 1 or 2. if ($movestock && $qty < 0 && empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) { - if (! empty($conf->productbatch->enabled) && $product->hasbatch() && ! $skip_batch) + if (!empty($conf->productbatch->enabled) && $product->hasbatch() && !$skip_batch) { - $foundforbatch=0; - $qtyisnotenough=0; - foreach($product->stock_warehouse[$entrepot_id]->detail_batch as $batchcursor => $prodbatch) + $foundforbatch = 0; + $qtyisnotenough = 0; + foreach ($product->stock_warehouse[$entrepot_id]->detail_batch as $batchcursor => $prodbatch) { if ($batch != $batchcursor) continue; - $foundforbatch=1; + $foundforbatch = 1; if ($prodbatch->qty < abs($qty)) $qtyisnotenough = $prodbatch->qty; break; } - if (! $foundforbatch || $qtyisnotenough) + if (!$foundforbatch || $qtyisnotenough) { $langs->load("stocks"); include_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; @@ -350,10 +350,10 @@ class MouvementStock extends CommonObject if ($movestock && $entrepot_id > 0) // Change stock for current product, change for subproduct is done after { $fk_project = 0; - if(!empty($this->origin)) { // This is set by caller for tracking reason + if (!empty($this->origin)) { // This is set by caller for tracking reason $origintype = $this->origin->element; $fk_origin = $this->origin->id; - if($origintype == 'project') $fk_project = $fk_origin; + if ($origintype == 'project') $fk_project = $fk_origin; else { $res = $this->origin->fetch($fk_origin); @@ -372,22 +372,22 @@ class MouvementStock extends CommonObject } $sql = "INSERT INTO ".MAIN_DB_PREFIX."stock_mouvement("; - $sql.= " datem, fk_product, batch, eatby, sellby,"; - $sql.= " fk_entrepot, value, type_mouvement, fk_user_author, label, inventorycode, price, fk_origin, origintype, fk_projet"; - $sql.= ")"; - $sql.= " VALUES ('".$this->db->idate($now)."', ".$this->product_id.", "; - $sql.= " ".($batch?"'".$batch."'":"null").", "; - $sql.= " ".($eatby?"'".$this->db->idate($eatby)."'":"null").", "; - $sql.= " ".($sellby?"'".$this->db->idate($sellby)."'":"null").", "; - $sql.= " ".$this->entrepot_id.", ".$this->qty.", ".$this->type.","; - $sql.= " ".$user->id.","; - $sql.= " '".$this->db->escape($label)."',"; - $sql.= " ".($inventorycode?"'".$this->db->escape($inventorycode)."'":"null").","; - $sql.= " '".price2num($price)."',"; - $sql.= " '".$fk_origin."',"; - $sql.= " '".$origintype."',"; - $sql.= " ". $fk_project; - $sql.= ")"; + $sql .= " datem, fk_product, batch, eatby, sellby,"; + $sql .= " fk_entrepot, value, type_mouvement, fk_user_author, label, inventorycode, price, fk_origin, origintype, fk_projet"; + $sql .= ")"; + $sql .= " VALUES ('".$this->db->idate($now)."', ".$this->product_id.", "; + $sql .= " ".($batch ? "'".$batch."'" : "null").", "; + $sql .= " ".($eatby ? "'".$this->db->idate($eatby)."'" : "null").", "; + $sql .= " ".($sellby ? "'".$this->db->idate($sellby)."'" : "null").", "; + $sql .= " ".$this->entrepot_id.", ".$this->qty.", ".$this->type.","; + $sql .= " ".$user->id.","; + $sql .= " '".$this->db->escape($label)."',"; + $sql .= " ".($inventorycode ? "'".$this->db->escape($inventorycode)."'" : "null").","; + $sql .= " '".price2num($price)."',"; + $sql .= " '".$fk_origin."',"; + $sql .= " '".$origintype."',"; + $sql .= " ".$fk_project; + $sql .= ")"; dol_syslog(get_class($this)."::_create insert record into stock_mouvement", LOG_DEBUG); $resql = $this->db->query($sql); @@ -399,24 +399,24 @@ class MouvementStock extends CommonObject } else { - $this->errors[]=$this->db->lasterror(); + $this->errors[] = $this->db->lasterror(); $error = -1; } // Define current values for qty and pmp - $oldqty=$product->stock_reel; - $oldpmp=$product->pmp; - $oldqtywarehouse=0; + $oldqty = $product->stock_reel; + $oldpmp = $product->pmp; + $oldqtywarehouse = 0; // Test if there is already a record for couple (warehouse / product) $alreadyarecord = 0; - if (! $error) + if (!$error) { $sql = "SELECT rowid, reel FROM ".MAIN_DB_PREFIX."product_stock"; - $sql.= " WHERE fk_entrepot = ".$entrepot_id." AND fk_product = ".$fk_product; // This is a unique key + $sql .= " WHERE fk_entrepot = ".$entrepot_id." AND fk_product = ".$fk_product; // This is a unique key dol_syslog(get_class($this)."::_create check if a record already exists in product_stock", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); @@ -430,25 +430,25 @@ class MouvementStock extends CommonObject } else { - $this->errors[]=$this->db->lasterror(); + $this->errors[] = $this->db->lasterror(); $error = -2; } } // Calculate new PMP. - $newpmp=0; - if (! $error) + $newpmp = 0; + if (!$error) { // Note: PMP is calculated on stock input only (type of movement = 0 or 3). If type == 0 or 3, qty should be > 0. // Note: Price should always be >0 or 0. PMP should be always >0 (calculated on input) if (($type == 0 || $type == 3) && $price > 0) { - $oldqtytouse=($oldqty >= 0?$oldqty:0); + $oldqtytouse = ($oldqty >= 0 ? $oldqty : 0); // We make a test on oldpmp>0 to avoid to use normal rule on old data with no pmp field defined - if ($oldpmp > 0) $newpmp=price2num((($oldqtytouse * $oldpmp) + ($qty * $price)) / ($oldqtytouse + $qty), 'MU'); + if ($oldpmp > 0) $newpmp = price2num((($oldqtytouse * $oldpmp) + ($qty * $price)) / ($oldqtytouse + $qty), 'MU'); else { - $newpmp=$price; // For this product, PMP was not yet set. We set it to input price. + $newpmp = $price; // For this product, PMP was not yet set. We set it to input price. } //print "oldqtytouse=".$oldqtytouse." oldpmp=".$oldpmp." oldqtywarehousetouse=".$oldqtywarehousetouse." "; //print "qty=".$qty." newpmp=".$newpmp; @@ -465,25 +465,25 @@ class MouvementStock extends CommonObject } } // Update stock quantity - if (! $error) + if (!$error) { if ($alreadyarecord > 0) { $sql = "UPDATE ".MAIN_DB_PREFIX."product_stock SET reel = reel + ".$qty; - $sql.= " WHERE fk_entrepot = ".$entrepot_id." AND fk_product = ".$fk_product; + $sql .= " WHERE fk_entrepot = ".$entrepot_id." AND fk_product = ".$fk_product; } else { $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_stock"; - $sql.= " (reel, fk_entrepot, fk_product) VALUES "; - $sql.= " (".$qty.", ".$entrepot_id.", ".$fk_product.")"; + $sql .= " (reel, fk_entrepot, fk_product) VALUES "; + $sql .= " (".$qty.", ".$entrepot_id.", ".$fk_product.")"; } dol_syslog(get_class($this)."::_create update stock value", LOG_DEBUG); - $resql=$this->db->query($sql); - if (! $resql) + $resql = $this->db->query($sql); + if (!$resql) { - $this->errors[]=$this->db->lasterror(); + $this->errors[] = $this->db->lasterror(); $error = -3; } elseif (empty($fk_product_stock)) @@ -493,61 +493,61 @@ class MouvementStock extends CommonObject } // Update detail stock for batch product - if (! $error && ! empty($conf->productbatch->enabled) && $product->hasbatch() && ! $skip_batch) + if (!$error && !empty($conf->productbatch->enabled) && $product->hasbatch() && !$skip_batch) { if ($id_product_batch > 0) { - $result=$this->createBatch($id_product_batch, $qty); + $result = $this->createBatch($id_product_batch, $qty); } else { - $param_batch=array('fk_product_stock' =>$fk_product_stock, 'batchnumber'=>$batch); - $result=$this->createBatch($param_batch, $qty); + $param_batch = array('fk_product_stock' =>$fk_product_stock, 'batchnumber'=>$batch); + $result = $this->createBatch($param_batch, $qty); } - if ($result<0) $error++; + if ($result < 0) $error++; } // Update PMP and denormalized value of stock qty at product level - if (! $error) + if (!$error) { // $sql = "UPDATE ".MAIN_DB_PREFIX."product SET pmp = ".$newpmp.", stock = ".$this->db->ifsql("stock IS NULL", 0, "stock") . " + ".$qty; // $sql.= " WHERE rowid = ".$fk_product; // Update pmp + denormalized fields because we change content of produt_stock. Warning: Do not use "SET p.stock", does not works with pgsql $sql = "UPDATE ".MAIN_DB_PREFIX."product as p SET pmp = ".$newpmp.", "; - $sql.= " stock=(SELECT SUM(ps.reel) FROM ".MAIN_DB_PREFIX."product_stock as ps WHERE ps.fk_product = p.rowid)"; - $sql.= " WHERE rowid = ".$fk_product; + $sql .= " stock=(SELECT SUM(ps.reel) FROM ".MAIN_DB_PREFIX."product_stock as ps WHERE ps.fk_product = p.rowid)"; + $sql .= " WHERE rowid = ".$fk_product; dol_syslog(get_class($this)."::_create update AWP", LOG_DEBUG); - $resql=$this->db->query($sql); - if (! $resql) + $resql = $this->db->query($sql); + if (!$resql) { - $this->errors[]=$this->db->lasterror(); + $this->errors[] = $this->db->lasterror(); $error = -4; } } // If stock is now 0, we can remove entry into llx_product_stock, but only if there is no child lines into llx_product_batch (detail of batch, because we can imagine // having a lot1/qty=X and lot2/qty=-X, so 0 but we must not loose repartition of different lot. - $sql="DELETE FROM ".MAIN_DB_PREFIX."product_stock WHERE reel = 0 AND rowid NOT IN (SELECT fk_product_stock FROM ".MAIN_DB_PREFIX."product_batch as pb)"; - $resql=$this->db->query($sql); + $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_stock WHERE reel = 0 AND rowid NOT IN (SELECT fk_product_stock FROM ".MAIN_DB_PREFIX."product_batch as pb)"; + $resql = $this->db->query($sql); // We do not test error, it can fails if there is child in batch details } // Add movement for sub products (recursive call) - if (! $error && ! empty($conf->global->PRODUIT_SOUSPRODUITS) && empty($conf->global->INDEPENDANT_SUBPRODUCT_STOCK)) + if (!$error && !empty($conf->global->PRODUIT_SOUSPRODUITS) && empty($conf->global->INDEPENDANT_SUBPRODUCT_STOCK)) { - $error = $this->_createSubProduct($user, $fk_product, $entrepot_id, $qty, $type, 0, $label, $inventorycode); // we use 0 as price, because pmp is not changed for subproduct + $error = $this->_createSubProduct($user, $fk_product, $entrepot_id, $qty, $type, 0, $label, $inventorycode); // we use 0 as price, because pmp is not changed for subproduct } - if ($movestock && ! $error) + if ($movestock && !$error) { // Call trigger - $result=$this->call_trigger('STOCK_MOVEMENT', $user); + $result = $this->call_trigger('STOCK_MOVEMENT', $user); if ($result < 0) $error++; // End call triggers } - if (! $error) + if (!$error) { $this->db->commit(); return $mvid; @@ -591,12 +591,12 @@ class MouvementStock extends CommonObject $sql .= " t.eatby,"; $sql .= " t.sellby,"; $sql .= " t.fk_projet as fk_project"; - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; - $sql.= ' WHERE 1 = 1'; + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; + $sql .= ' WHERE 1 = 1'; //if (null !== $ref) { //$sql .= ' AND t.ref = ' . '\'' . $ref . '\''; //} else { - $sql .= ' AND t.rowid = ' . $id; + $sql .= ' AND t.rowid = '.$id; //} $resql = $this->db->query($sql); @@ -640,10 +640,10 @@ class MouvementStock extends CommonObject return 0; } } else { - $this->errors[] = 'Error ' . $this->db->lasterror(); - dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); + $this->errors[] = 'Error '.$this->db->lasterror(); + dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); - return - 1; + return -1; } } @@ -672,19 +672,19 @@ class MouvementStock extends CommonObject $pqtys = array(); $sql = "SELECT fk_product_pere, fk_product_fils, qty"; - $sql.= " FROM ".MAIN_DB_PREFIX."product_association"; - $sql.= " WHERE fk_product_pere = ".$idProduct; - $sql.= " AND incdec = 1"; + $sql .= " FROM ".MAIN_DB_PREFIX."product_association"; + $sql .= " WHERE fk_product_pere = ".$idProduct; + $sql .= " AND incdec = 1"; dol_syslog(get_class($this)."::_createSubProduct for parent product ".$idProduct, LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { - $i=0; - while ($obj=$this->db->fetch_object($resql)) + $i = 0; + while ($obj = $this->db->fetch_object($resql)) { - $pids[$i]=$obj->fk_product_fils; - $pqtys[$i]=$obj->qty; + $pids[$i] = $obj->fk_product_fils; + $pqtys[$i] = $obj->qty; $i++; } $this->db->free($resql); @@ -695,12 +695,12 @@ class MouvementStock extends CommonObject } // Create movement for each subproduct - foreach($pids as $key => $value) + foreach ($pids as $key => $value) { - if (! $error) + if (!$error) { $tmpmove = clone $this; - $result = $tmpmove->_create($user, $pids[$key], $entrepot_id, ($qty * $pqtys[$key]), $type, 0, $label, $inventorycode); // This will also call _createSubProduct making this recursive + $result = $tmpmove->_create($user, $pids[$key], $entrepot_id, ($qty * $pqtys[$key]), $type, 0, $label, $inventorycode); // This will also call _createSubProduct making this recursive if ($result < 0) { $this->error = $tmpmove->error; @@ -736,7 +736,7 @@ class MouvementStock extends CommonObject * @param string $inventorycode Inventory code * @return int <0 if KO, >0 if OK */ - public function livraison($user, $fk_product, $entrepot_id, $qty, $price = 0, $label = '', $datem = '', $eatby = '', $sellby = '', $batch = '', $id_product_batch = 0, $inventorycode='') + public function livraison($user, $fk_product, $entrepot_id, $qty, $price = 0, $label = '', $datem = '', $eatby = '', $sellby = '', $batch = '', $id_product_batch = 0, $inventorycode = '') { global $conf; @@ -762,7 +762,7 @@ class MouvementStock extends CommonObject * @param string $inventorycode Inventory code * @return int <0 if KO, >0 if OK */ - public function reception($user, $fk_product, $entrepot_id, $qty, $price = 0, $label = '', $eatby = '', $sellby = '', $batch = '', $datem = '', $id_product_batch = 0, $inventorycode='') + public function reception($user, $fk_product, $entrepot_id, $qty, $price = 0, $label = '', $eatby = '', $sellby = '', $batch = '', $datem = '', $id_product_batch = 0, $inventorycode = '') { global $conf; @@ -803,19 +803,19 @@ class MouvementStock extends CommonObject */ public function calculateBalanceForProductBefore($productidselected, $datebefore) { - $nb=0; + $nb = 0; $sql = 'SELECT SUM(value) as nb from '.MAIN_DB_PREFIX.'stock_mouvement'; - $sql.= ' WHERE fk_product = '.$productidselected; - $sql.= " AND datem < '".$this->db->idate($datebefore)."'"; + $sql .= ' WHERE fk_product = '.$productidselected; + $sql .= " AND datem < '".$this->db->idate($datebefore)."'"; dol_syslog(get_class($this).__METHOD__.'', LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { - $obj=$this->db->fetch_object($resql); + $obj = $this->db->fetch_object($resql); if ($obj) $nb = $obj->nb; - return (empty($nb)?0:$nb); + return (empty($nb) ? 0 : $nb); } else { @@ -837,14 +837,14 @@ class MouvementStock extends CommonObject { global $user; - $pdluo=new Productbatch($this->db); + $pdluo = new Productbatch($this->db); - $result=0; + $result = 0; // Try to find an existing record with same batch number or id if (is_numeric($dluo)) { - $result=$pdluo->fetch($dluo); + $result = $pdluo->fetch($dluo); if (empty($pdluo->id)) { // We didn't find the line. May be it was deleted before by a previous move in same transaction. @@ -857,10 +857,10 @@ class MouvementStock extends CommonObject { if (isset($dluo['fk_product_stock'])) { - $vfk_product_stock=$dluo['fk_product_stock']; + $vfk_product_stock = $dluo['fk_product_stock']; $vbatchnumber = $dluo['batchnumber']; - $result = $pdluo->find($vfk_product_stock, '', '', $vbatchnumber); // Search on batch number only (eatby and sellby are deprecated here) + $result = $pdluo->find($vfk_product_stock, '', '', $vbatchnumber); // Search on batch number only (eatby and sellby are deprecated here) } else { @@ -883,24 +883,24 @@ class MouvementStock extends CommonObject $pdluo->qty += $qty; if ($pdluo->qty == 0) { - $result=$pdluo->delete($user, 1); + $result = $pdluo->delete($user, 1); } else { - $result=$pdluo->update($user, 1); + $result = $pdluo->update($user, 1); } } else // product_batch record not found { - $pdluo->fk_product_stock=$vfk_product_stock; + $pdluo->fk_product_stock = $vfk_product_stock; $pdluo->qty = $qty; $pdluo->eatby = $veatby; $pdluo->sellby = $vsellby; $pdluo->batch = $vbatchnumber; - $result=$pdluo->create($user, 1); + $result = $pdluo->create($user, 1); if ($result < 0) { - $this->error=$pdluo->error; - $this->errors=$pdluo->errors; + $this->error = $pdluo->error; + $this->errors = $pdluo->errors; } } } @@ -919,7 +919,7 @@ class MouvementStock extends CommonObject public function get_origin($fk_origin, $origintype) { // phpcs:enable - $origin=''; + $origin = ''; switch ($origintype) { case 'commande': @@ -954,7 +954,7 @@ class MouvementStock extends CommonObject default: if ($origintype) { - $result=dol_include_once('/'.$origintype.'/class/'.$origintype.'.class.php'); + $result = dol_include_once('/'.$origintype.'/class/'.$origintype.'.class.php'); if ($result) { $classname = ucfirst($origintype); @@ -964,7 +964,7 @@ class MouvementStock extends CommonObject break; } - if (empty($origin) || ! is_object($origin)) return ''; + if (empty($origin) || !is_object($origin)) return ''; if ($origin->fetch($fk_origin) > 0) { return $origin->getNomUrl(1); @@ -985,7 +985,7 @@ class MouvementStock extends CommonObject { if (!empty($origin_element) && $origin_id > 0) { - $origin=''; + $origin = ''; if ($origin_element == 'project') { if (!class_exists('Project')) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; @@ -1010,10 +1010,10 @@ class MouvementStock extends CommonObject */ public function initAsSpecimen() { - global $user,$langs,$conf,$mysoc; + global $user, $langs, $conf, $mysoc; // Initialize parameters - $this->id=0; + $this->id = 0; // There is no specific properties. All data into insert are provided as method parameter. } @@ -1036,23 +1036,23 @@ class MouvementStock extends CommonObject $result = ''; $companylink = ''; - $label = '' . $langs->trans("Movement") . ' '.$this->id.''; - $label.= '
'; - $label.= '' . $langs->trans('Label') . ': ' . $this->label; - $label.= '
' . $langs->trans('Qty') . ': ' .$this->qty; - $label.= '
'; + $label = ''.$langs->trans("Movement").' '.$this->id.''; + $label .= '
'; + $label .= ''.$langs->trans('Label').': '.$this->label; + $label .= '
'.$langs->trans('Qty').': '.$this->qty; + $label .= '
'; $link = 'id . $linkend; + $result .= $link.$this->id.$linkend; return $result; } @@ -1113,16 +1113,16 @@ class MouvementStock extends CommonObject */ public function generateDocument($modele, $outputlangs = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { - global $conf,$user,$langs; + global $conf, $user, $langs; $langs->load("stocks"); - if (! dol_strlen($modele)) { + if (!dol_strlen($modele)) { $modele = 'stdmovement'; if ($this->modelpdf) { $modele = $this->modelpdf; - } elseif (! empty($conf->global->MOUVEMENT_ADDON_PDF)) { + } elseif (!empty($conf->global->MOUVEMENT_ADDON_PDF)) { $modele = $conf->global->MOUVEMENT_ADDON_PDF; } } From 0aa156db78f86442314ff004b36141f8c4a6deaa Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Thu, 16 Jan 2020 01:54:00 +0000 Subject: [PATCH 123/784] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- htdocs/admin/company.php | 8 +- htdocs/core/class/dolgraph.class.php | 70 ++-- htdocs/core/class/translate.class.php | 378 ++++++++++----------- htdocs/core/modules/modAgenda.class.php | 94 ++--- htdocs/loan/list.php | 24 +- htdocs/website/class/websitepage.class.php | 6 +- 6 files changed, 290 insertions(+), 290 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index f8b9556cf89..4a0d2f8e6bc 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -415,17 +415,17 @@ print ''.$langs->trans( // Name print ''; -print 'global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'>'."\n"; +print 'global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'>'."\n"; // Address print ''; -print ''."\n"; +print ''."\n"; print ''; -print ''."\n"; +print ''."\n"; print ''; -print ''."\n"; +print ''."\n"; // Country print ''; diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 694b785e63c..601368f6632 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -898,90 +898,90 @@ class DolGraph return; } - $legends=array(); - $nblot=0; + $legends = array(); + $nblot = 0; if (is_array($this->data) && is_array($this->data[0])) { - $nblot=count($this->data[0])-1; // -1 to remove legend + $nblot = count($this->data[0]) - 1; // -1 to remove legend } if ($nblot < 0) dol_syslog('Bad value for property ->data. Must be set by mydolgraph->SetData before calling mydolgrapgh->draw', LOG_WARNING); - $firstlot=0; + $firstlot = 0; // Works with line but not with bars //if ($nblot > 2) $firstlot = ($nblot - 2); // We limit nblot to 2 because jflot can't manage more than 2 bars on same x - $i=$firstlot; - $serie=array(); + $i = $firstlot; + $serie = array(); while ($i < $nblot) // Loop on each serie { - $values=array(); // Array with horizontal y values (specific values of a serie) for each abscisse x - $serie[$i]="var d".$i." = [];\n"; + $values = array(); // Array with horizontal y values (specific values of a serie) for each abscisse x + $serie[$i] = "var d".$i." = [];\n"; // Fill array $values - $x=0; - foreach($this->data as $valarray) // Loop on each x + $x = 0; + foreach ($this->data as $valarray) // Loop on each x { $legends[$x] = $valarray[0]; - $values[$x] = (is_numeric($valarray[$i+1]) ? $valarray[$i+1] : null); + $values[$x] = (is_numeric($valarray[$i + 1]) ? $valarray[$i + 1] : null); $x++; } // TODO Avoid push by adding generated long array... if (isset($this->type[$firstlot]) && $this->type[$firstlot] == 'pie') { - foreach($values as $x => $y) { - if (isset($y)) $serie[$i].='d'.$i.'.push({"label":"'.dol_escape_js($legends[$x]).'", "data":'.$y.'});'."\n"; + foreach ($values as $x => $y) { + if (isset($y)) $serie[$i] .= 'd'.$i.'.push({"label":"'.dol_escape_js($legends[$x]).'", "data":'.$y.'});'."\n"; } } else { - foreach($values as $x => $y) { - if (isset($y)) $serie[$i].='d'.$i.'.push(['.$x.', '.$y.']);'."\n"; + foreach ($values as $x => $y) { + if (isset($y)) $serie[$i] .= 'd'.$i.'.push(['.$x.', '.$y.']);'."\n"; } } unset($values); $i++; } - $tag=dol_escape_htmltag(dol_string_unaccent(dol_string_nospecial(basename($file), '_', array('-','.')))); + $tag = dol_escape_htmltag(dol_string_unaccent(dol_string_nospecial(basename($file), '_', array('-', '.')))); - $this->stringtoshow =''."\n"; - if (! empty($this->title)) $this->stringtoshow.='
'.$this->title.'
'; - if (! empty($this->shownographyet)) + $this->stringtoshow = ''."\n"; + if (!empty($this->title)) $this->stringtoshow .= '
'.$this->title.'
'; + if (!empty($this->shownographyet)) { - $this->stringtoshow.='
'; - $this->stringtoshow.='
'.$langs->trans("NotEnoughDataYet").'
'; + $this->stringtoshow .= '
'; + $this->stringtoshow .= '
'.$langs->trans("NotEnoughDataYet").'
'; return; } - $this->stringtoshow.='
'."\n"; + $this->stringtoshow .= '
'."\n"; - $this->stringtoshow.=' '; } diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index c44ba9b522b..a56ff9e4564 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -67,7 +67,7 @@ else } } -$arrayofcss = array('/takepos/css/pos.css'); +$arrayofcss = array('/takepos/css/pos.css.php'); $arrayofjs=array(); top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); @@ -92,7 +92,7 @@ if ($resql) { } } ?> - + diff --git a/htdocs/takepos/send.php b/htdocs/takepos/send.php index 268fa6f6670..0b16f555e2f 100644 --- a/htdocs/takepos/send.php +++ b/htdocs/takepos/send.php @@ -68,7 +68,7 @@ else $langs->loadLangs(array("main", "bills", "cashdesk")); ?> - + diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index 4693ff8b4bf..2e94885109a 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -96,7 +96,7 @@ $head = ' top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); ?> - + '."\n"; } From 2ccfdce1786824aa509d0ad547c4b5356034513b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Jan 2020 14:41:06 +0100 Subject: [PATCH 265/784] var not defined --- htdocs/admin/notification.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index 1eddaef9903..e4169f1aa3a 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -53,6 +53,7 @@ if ($action == 'setvalue' && $user->admin) if (!$error && is_array($_POST)) { //var_dump($_POST); + $reg = array(); foreach ($_POST as $key => $val) { if (!preg_match('/^NOTIF_(.*)_key$/', $key, $reg)) continue; From 300abfd5e20c312c683d42dc175b4b4dcf3ea599 Mon Sep 17 00:00:00 2001 From: Michael Jeanmotte Date: Wed, 29 Jan 2020 14:44:50 +0100 Subject: [PATCH 266/784] Fetch thirdparty to be sure thirdparty is accessible through an API call when we use ODT template --- .../modules/facture/doc/doc_generic_invoice_odt.modules.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index ef05b9b2df9..aac525ffb55 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -303,6 +303,9 @@ class doc_generic_invoice_odt extends ModelePDFFactures $result = $object->fetch_contact($arrayidcontact[0]); } + // Fetch thirdparty to be sure thirdparty is accessible through an API call when we use ODT template + $object->fetch_thirdparty(); + // Recipient name $contactobject = null; if (!empty($usecontact)) { From a300cb9067dbb5a0e285bf8ae76e0c18721bd418 Mon Sep 17 00:00:00 2001 From: Michael Jeanmotte Date: Wed, 29 Jan 2020 15:12:14 +0100 Subject: [PATCH 267/784] Revert "Fetch thirdparty to be sure thirdparty is accessible through an API call when we use ODT template" This reverts commit 300abfd5 --- .../modules/facture/doc/doc_generic_invoice_odt.modules.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index aac525ffb55..ef05b9b2df9 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -303,9 +303,6 @@ class doc_generic_invoice_odt extends ModelePDFFactures $result = $object->fetch_contact($arrayidcontact[0]); } - // Fetch thirdparty to be sure thirdparty is accessible through an API call when we use ODT template - $object->fetch_thirdparty(); - // Recipient name $contactobject = null; if (!empty($usecontact)) { From 481e7126bf7bb58137f934919f78682e7ba578a2 Mon Sep 17 00:00:00 2001 From: Michael Jeanmotte Date: Wed, 29 Jan 2020 15:13:40 +0100 Subject: [PATCH 268/784] Revert "Fetch thirdparty to be sure thirdparty is accessible through an API call when we use ODT template" This reverts commit 300abfd5 --- .../modules/facture/doc/doc_generic_invoice_odt.modules.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index aac525ffb55..ef05b9b2df9 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -303,9 +303,6 @@ class doc_generic_invoice_odt extends ModelePDFFactures $result = $object->fetch_contact($arrayidcontact[0]); } - // Fetch thirdparty to be sure thirdparty is accessible through an API call when we use ODT template - $object->fetch_thirdparty(); - // Recipient name $contactobject = null; if (!empty($usecontact)) { From 9c160d5181a77f751f645bfe903e9f613fd8784c Mon Sep 17 00:00:00 2001 From: Michael Jeanmotte Date: Wed, 29 Jan 2020 15:17:12 +0100 Subject: [PATCH 269/784] Feature Request: Dolibarr API - [GET] /bankaccounts/{id}/lines : add sqlfilters #11259 --- .../compta/bank/class/api_bankaccounts.class.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 57aa50f1568..2ecb59861d9 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -411,8 +411,9 @@ class BankAccounts extends DolibarrApi * @throws RestException * * @url GET {id}/lines + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.import_key:<:'20160101')" */ - public function getLines($id) + public function getLines($id, $sqlfilters = '') { $list = array(); @@ -428,6 +429,18 @@ class BankAccounts extends DolibarrApi $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."bank "; $sql .= " WHERE fk_account = ".$id; + + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + $sql .= " ORDER BY rowid"; $result = $this->db->query($sql); From dcc8b4b65ea0a6ef30f366123ed62bb0d8c77462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 29 Jan 2020 15:35:46 +0100 Subject: [PATCH 270/784] Update extrafields.class.php --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index ef5f5d4e74c..10b3ca071cc 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1465,7 +1465,7 @@ class ExtraFields } // We have to join on extrafield table - if (strpos($InfoFieldList[4], 'extra') !== false) { + if (strpos($InfoFieldList[4], 'extra.') !== false) { $sql .= ' as main, '.MAIN_DB_PREFIX.$InfoFieldList[0].'_extrafields as extra'; $sqlwhere .= ' WHERE extra.fk_object=main.'.$InfoFieldList[2].' AND '.$InfoFieldList[4]; } else { From 9874169311720b36b5093c3a465f0c67df491238 Mon Sep 17 00:00:00 2001 From: kadogo Date: Wed, 29 Jan 2020 17:05:39 +0100 Subject: [PATCH 271/784] NEW enable put for agendaevents api --- htdocs/comm/action/class/api_agendaevents.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index 0d3c5de514d..6299b72b28b 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -229,7 +229,6 @@ class AgendaEvents extends DolibarrApi * * @return int */ - /* public function put($id, $request_data = null) { if (! DolibarrApiAccess::$user->rights->agenda->myactions->create) { @@ -257,12 +256,11 @@ class AgendaEvents extends DolibarrApi $this->actioncomm->$field = $value; } - if ($this->actioncomm->update($id, DolibarrApiAccess::$user,1,'','','update')) + if ($this->actioncomm->update(DolibarrApiAccess::$user, 1) > 0) return $this->get($id); return false; } - */ /** * Delete Agenda Event From 1e77ddbf111853c92de8ba1e95ee3b7cb81761e9 Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Wed, 29 Jan 2020 17:52:22 +0100 Subject: [PATCH 272/784] FIX: '0' is a valid search value in object list filters --- htdocs/modulebuilder/template/myobject_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 13f359f43cc..46f347618f4 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -122,7 +122,7 @@ $search_all=trim(GETPOST("search_all", 'alpha')); $search=array(); foreach($object->fields as $key => $val) { - if (GETPOST('search_'.$key, 'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha'); + if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key]=GETPOST('search_'.$key, 'alpha'); } // List of fields to search into when doing a "search in all" From 60f772d28562f73d55d4ccba6f38d65fa0d9ccd6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Jan 2020 17:27:31 +0100 Subject: [PATCH 273/784] FIX Pending amount to pay must be zero if invoice close for anticipated payment. --- htdocs/compta/facture/list.php | 16 ++++++++++++---- htdocs/core/class/commoninvoice.class.php | 7 ++++++- htdocs/core/modules/modFacture.class.php | 21 +++++++++++++-------- htdocs/exports/class/export.class.php | 1 + htdocs/exports/export.php | 2 +- htdocs/langs/en_US/bills.lang | 2 ++ 6 files changed, 35 insertions(+), 14 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 00aa9deb4df..db1ba28c14e 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -387,7 +387,7 @@ if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; $sql .= ' f.rowid as id, f.ref, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,'; $sql .= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,'; $sql .= ' f.datef as df, f.date_lim_reglement as datelimite, f.module_source, f.pos_source,'; -$sql .= ' f.paye as paye, f.fk_statut,'; +$sql .= ' f.paye as paye, f.fk_statut, f.close_code,'; $sql .= ' f.datec as date_creation, f.tms as date_update, f.date_closing as date_closing,'; $sql .= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,'; $sql .= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,'; @@ -502,7 +502,7 @@ if (!$sall) $sql .= ' GROUP BY f.rowid, f.ref, ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total, f.tva, f.total_ttc,'; $sql .= ' f.localtax1, f.localtax2,'; $sql .= ' f.datef, f.date_lim_reglement, f.module_source, f.pos_source,'; - $sql .= ' f.paye, f.fk_statut,'; + $sql .= ' f.paye, f.fk_statut, f.close_code,'; $sql .= ' f.datec, f.tms, f.date_closing,'; $sql .= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,'; $sql .= ' s.rowid, s.nom, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,'; @@ -987,6 +987,7 @@ if ($resql) $facturestatic->total_tva = $obj->total_vat; $facturestatic->total_ttc = $obj->total_ttc; $facturestatic->statut = $obj->fk_statut; + $facturestatic->close_code = $obj->close_code; $facturestatic->total_ttc = $obj->total_ttc; $facturestatic->paye = $obj->paye; $facturestatic->fk_soc = $obj->fk_soc; @@ -1022,7 +1023,11 @@ if ($resql) $totaldeposits = $facturestatic->getSumDepositsUsed(); $totalpay = $paiement + $totalcreditnotes + $totaldeposits; $remaintopay = price2num($facturestatic->total_ttc - $totalpay); - if ($facturestatic->type == Facture::TYPE_CREDIT_NOTE && $obj->paye == 1) { + + if ($facturestatic->statut == Facture::STATUS_CLOSED && $facturestatic->close_code == 'discount_vat') { // If invoice closed with discount for anticipated payment + $remaintopay = 0; + } + if ($facturestatic->type == Facture::TYPE_CREDIT_NOTE && $obj->paye == 1) { // If credit note closed, we take into account the amount not yet consummed $remaincreditnote = $discount->getAvailableDiscounts($obj->fk_soc, '', 'rc.fk_facture_source='.$facturestatic->id); $remaintopay = -$remaincreditnote; $totalpay = price2num($facturestatic->total_ttc - $remaintopay); @@ -1281,9 +1286,12 @@ if ($resql) $totalarray['val']['totalam'] += $totalpay; } + // Pending amount if (!empty($arrayfields['rtp']['checked'])) { - print ''.(!empty($remaintopay) ?price($remaintopay, 0, $langs) : ' ').''; // TODO Use a denormalized field + print ''; + print (!empty($remaintopay) ? price($remaintopay, 0, $langs) : ' '); + print ''; // TODO Use a denormalized field if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'rtp'; $totalarray['val']['rtp'] += $remaintopay; diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index eb2e55d6279..80afcfacecc 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -103,7 +103,12 @@ abstract class CommonInvoice extends CommonObject $alreadypaid+=$this->getSommePaiement($multicurrency); $alreadypaid+=$this->getSumDepositsUsed($multicurrency); $alreadypaid+=$this->getSumCreditNotesUsed($multicurrency); - return $this->total_ttc - $alreadypaid; + + $remaintopay = ($this->total_ttc - $alreadypaid); + if ($this->statut == self::STATUS_CLOSED && $this->close_code == 'discount_vat') { // If invoice closed with discount for anticipated payment + $remaintopay = 0; + } + return $remaintopay; } /** diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index b0f7dd94ae8..984e28f4e31 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -216,7 +216,8 @@ class modFacture extends DolibarrModules 's.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.tva_intra'=>'VATIntra', 'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer', 'f.type'=>"Type", 'f.datec'=>"InvoiceDateCreation", 'f.datef'=>"DateInvoice", 'f.date_lim_reglement'=>"DateDue", 'f.total'=>"TotalHT", - 'f.total_ttc'=>"TotalTTC", 'f.tva'=>"TotalVAT", 'f.localtax1'=>'LocalTax1', 'f.localtax2'=>'LocalTax2', 'none.rest'=>'Rest', 'f.paye'=>"InvoicePaidCompletely", 'f.fk_statut'=>'InvoiceStatus', + 'f.total_ttc'=>"TotalTTC", 'f.tva'=>"TotalVAT", 'f.localtax1'=>'LocalTax1', 'f.localtax2'=>'LocalTax2', 'f.paye'=>"InvoicePaidCompletely", 'f.fk_statut'=>'InvoiceStatus', 'f.close_code'=>'EarlyClosingReason', 'f.close_note'=>'EarlyClosingComment', + 'none.rest'=>'Rest', 'f.note_private'=>"NotePrivate", 'f.note_public'=>"NotePublic", 'f.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin', 'f.fk_user_valid'=>'ValidatedById', 'uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'pj.title'=>'ProjectLabel', 'fd.rowid'=>'LineId', 'fd.description'=>"LineDescription", 'fd.subprice'=>"LineUnitPrice", 'fd.tva_tx'=>"LineVATRate", 'fd.qty'=>"LineQty", 'fd.total_ht'=>"LineTotalHT", 'fd.total_tva'=>"LineTotalVAT", @@ -241,7 +242,8 @@ class modFacture extends DolibarrModules 's.rowid'=>'Numeric', 's.nom'=>'Text', 's.code_client'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 'cd.nom'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text', 'f.rowid'=>'Numeric', 'f.ref'=>"Text", 'f.ref_client'=>'Text', 'f.type'=>"Numeric", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>"Date", - 'f.total'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.tva'=>"Numeric", 'f.localtax1'=>'Numeric', 'f.localtax2'=>'Numeric', 'none.rest'=>"NumericCompute", 'f.paye'=>"Boolean", 'f.fk_statut'=>'Numeric', + 'f.total'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.tva'=>"Numeric", 'f.localtax1'=>'Numeric', 'f.localtax2'=>'Numeric', 'f.paye'=>"Boolean", 'f.fk_statut'=>'Numeric', 'f.close_code'=>'Text', 'f.close_note'=>'Text', + 'none.rest'=>"NumericCompute", 'f.note_private'=>"Text", 'f.note_public'=>"Text", 'f.fk_user_author'=>'Numeric', 'uc.login'=>'Text', 'f.fk_user_valid'=>'Numeric', 'uv.login'=>'Text', 'pj.ref'=>'Text', 'pj.title'=>'Text', 'fd.rowid'=>'Numeric', 'fd.label'=>'Text', 'fd.description'=>"Text", 'fd.subprice'=>"Numeric", 'fd.tva_tx'=>"Numeric", 'fd.qty'=>"Numeric", 'fd.total_ht'=>"Numeric", 'fd.total_tva'=>"Numeric", 'fd.total_ttc'=>"Numeric", 'fd.date_start'=>"Date", 'fd.date_end'=>"Date", @@ -263,7 +265,7 @@ class modFacture extends DolibarrModules 'f.fk_user_author'=>'user', 'uc.login'=>'user', 'f.fk_user_valid'=>'user', 'uv.login'=>'user' ); $this->export_special_array[$r] = array('none.rest'=>'getRemainToPay'); - $this->export_dependencies_array[$r] = array('invoice_line'=>'fd.rowid', 'product'=>'fd.rowid', 'none.rest'=>array('f.rowid', 'f.total_ttc')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them + $this->export_dependencies_array[$r] = array('invoice_line'=>'fd.rowid', 'product'=>'fd.rowid', 'none.rest'=>array('f.rowid', 'f.total_ttc', 'f.close_code')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $keyforselect = 'facture'; $keyforelement = 'invoice'; $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $keyforselect = 'facturedet'; $keyforelement = 'invoice_line'; $keyforaliasextra = 'extra2'; @@ -289,6 +291,7 @@ class modFacture extends DolibarrModules if (isset($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id; $r++; + $this->export_code[$r] = $this->rights_class.'_'.$r; $this->export_label[$r] = 'CustomersInvoicesAndPayments'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_icon[$r] = 'invoice'; @@ -300,7 +303,8 @@ class modFacture extends DolibarrModules 's.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.tva_intra'=>'VATIntra', 'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer', 'f.type'=>"Type", 'f.datec'=>"InvoiceDateCreation", 'f.datef'=>"DateInvoice", 'f.date_lim_reglement'=>"DateDue", 'f.total'=>"TotalHT", - 'f.total_ttc'=>"TotalTTC", 'f.tva'=>"TotalVAT", 'f.localtax1'=>'LocalTax1', 'f.localtax2'=>'LocalTax2', 'none.rest'=>'Rest', 'f.paye'=>"InvoicePaidCompletely", 'f.fk_statut'=>'InvoiceStatus', + 'f.total_ttc'=>"TotalTTC", 'f.tva'=>"TotalVAT", 'f.localtax1'=>'LocalTax1', 'f.localtax2'=>'LocalTax2', 'f.paye'=>"InvoicePaidCompletely", 'f.fk_statut'=>'InvoiceStatus', 'f.close_code'=>'EarlyClosingReason', 'f.close_note'=>'EarlyClosingComment', + 'none.rest'=>'Rest', 'f.note_private'=>"NotePrivate", 'f.note_public'=>"NotePublic", 'f.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin', 'f.fk_user_valid'=>'ValidatedById', 'uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'pj.title'=>'ProjectLabel', 'p.rowid'=>'PaymentId', 'p.ref'=>'PaymentRef', 'p.amount'=>'AmountPayment', 'pf.amount'=>'AmountPaymentDistributedOnInvoice', 'p.datep'=>'DatePayment', 'p.num_paiement'=>'PaymentNumber', @@ -325,9 +329,10 @@ class modFacture extends DolibarrModules 's.rowid'=>'Numeric', 's.nom'=>'Text', 's.code_client'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 'cd.nom'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text', 'f.rowid'=>"Numeric", 'f.ref'=>"Text", 'f.ref_client'=>'Text', 'f.type'=>"Numeric", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>"Date", - 'f.total'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.tva'=>"Numeric", 'f.localtax1'=>'Numeric', 'f.localtax2'=>'Numeric', 'none.rest'=>'NumericCompute', 'f.paye'=>"Boolean", 'f.fk_statut'=>'Status', + 'f.total'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.tva'=>"Numeric", 'f.localtax1'=>'Numeric', 'f.localtax2'=>'Numeric', 'f.paye'=>"Boolean", 'f.fk_statut'=>'Status', 'f.close_code'=>'Text', 'f.close_note'=>'Text', + 'none.rest'=>'NumericCompute', 'f.note_private'=>"Text", 'f.note_public'=>"Text", 'f.fk_user_author'=>'Numeric', 'uc.login'=>'Text', 'f.fk_user_valid'=>'Numeric', 'uv.login'=>'Text', - 'pj.ref'=>'Text', 'p.amount'=>'Numeric', 'pf.amount'=>'Numeric', 'p.rowid'=>'Numeric', 'p.ref'=>'Text', 'p.title'=>'Text', 'p.datep'=>'Date', 'p.num_paiement'=>'Numeric', + 'pj.ref'=>'Text', 'pj.title'=>'Text', 'p.amount'=>'Numeric', 'pf.amount'=>'Numeric', 'p.rowid'=>'Numeric', 'p.ref'=>'Text', 'p.title'=>'Text', 'p.datep'=>'Date', 'p.num_paiement'=>'Numeric', 'p.fk_bank'=>'Numeric', 'p.note'=>'Text', 'pt.code'=>'Text', 'pt.libelle'=>'text', 'ba.ref'=>'Text' ); if (! empty($conf->cashdesk->enabled) || ! empty($conf->takepos->enabled) || ! empty($conf->global->INVOICE_SHOW_POS)) @@ -338,12 +343,12 @@ class modFacture extends DolibarrModules $this->export_entities_array[$r] = array( 's.rowid'=>"company", 's.nom'=>'company', 's.code_client'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'c.code'=>'company', 'cd.nom'=>'company', 's.phone'=>'company', 's.siren'=>'company', 's.siret'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.code_compta'=>'company', 's.code_compta_fournisseur'=>'company', - 's.tva_intra'=>'company', 'pj.ref'=>'project', 'p.title'=>'project', 'p.rowid'=>'payment', 'p.ref'=>'payment', 'p.amount'=>'payment', 'pf.amount'=>'payment', 'p.datep'=>'payment', + 's.tva_intra'=>'company', 'pj.ref'=>'project', 'pj.title'=>'project', 'p.rowid'=>'payment', 'p.ref'=>'payment', 'p.amount'=>'payment', 'pf.amount'=>'payment', 'p.datep'=>'payment', 'p.num_paiement'=>'payment', 'pt.code'=>'payment', 'pt.libelle'=>'payment', 'p.note'=>'payment', 'f.fk_user_author'=>'user', 'uc.login'=>'user', 'f.fk_user_valid'=>'user', 'uv.login'=>'user', 'p.fk_bank'=>'account', 'ba.ref'=>'account' ); $this->export_special_array[$r] = array('none.rest'=>'getRemainToPay'); - $this->export_dependencies_array[$r] = array('payment'=>'p.rowid', 'none.rest'=>array('f.rowid', 'f.total_ttc')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them + $this->export_dependencies_array[$r] = array('payment'=>'p.rowid', 'none.rest'=>array('f.rowid', 'f.total_ttc', 'f.close_code')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them, or just to have field we need $keyforselect = 'facture'; $keyforelement = 'invoice'; $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r]='SELECT DISTINCT '; diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index 06813b03ae5..b43fddad60d 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -660,6 +660,7 @@ class Export } $tmpobjforcomputecall->id = $obj->f_rowid; $tmpobjforcomputecall->total_ttc = $obj->f_total_ttc; + $tmpobjforcomputecall->close_code = $obj->f_close_code; $remaintopay=$tmpobjforcomputecall->getRemainToPay(); } $obj->$alias=$remaintopay; diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index ffbed97a75c..525a5b17c9e 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -1186,7 +1186,7 @@ if ($step == 5 && $datatoexport) print $objexport->array_export_module[0]->getName(); print ''; - // Lot de donnees a exporter + // Dataset to export print ''.$langs->trans("DatasetToExport").''; print ''; $icon = preg_replace('/:.*$/', '', $objexport->array_export_icon[0]); diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 83ebdece24b..6e26ecb6835 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -519,6 +519,8 @@ TerreNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoice MarsNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices, %syymm-nnnn for replacement invoices, %syymm-nnnn for down payment invoices and %syymm-nnnn for credit notes where yy is year, mm is month and nnnn is a sequence with no break and no return to 0 TerreNumRefModelError=A bill starting with $syymm already exists and is not compatible with this model of sequence. Remove it or rename it to activate this module. CactusNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices, %syymm-nnnn for credit notes and %syymm-nnnn for down payment invoices where yy is year, mm is month and nnnn is a sequence with no break and no return to 0 +EarlyClosingReason=Early closing reason +EarlyClosingComment=Early closing note ##### Types de contacts ##### TypeContact_facture_internal_SALESREPFOLL=Representative following-up customer invoice TypeContact_facture_external_BILLING=Customer invoice contact From 633ba666aa5e1f9dbde4868bffc4f7c0820624ad Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Jan 2020 19:26:04 +0100 Subject: [PATCH 274/784] Add info of email reference syntax to help debug. --- htdocs/admin/mails.php | 7 +++++++ htdocs/langs/en_US/admin.lang | 1 + 2 files changed, 8 insertions(+) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 82da31bdeca..165f5f9c7f1 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -858,6 +858,13 @@ else print $formmail->get_form('addfile', 'removefile'); dol_fiche_end(); + + // References + print ''.$langs->trans("EMailsWillHaveMessageID").': '; + print dol_escape_htmltag(''); + print ''; + + } } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 7bea668e091..5cac95078c0 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1971,3 +1971,4 @@ NotAPublicIp=Not a public IP MakeAnonymousPing=Make an anonymous Ping '+1' to the Dolibarr foundation server (done 1 time only after installation) to allow the foundation to count the number of Dolibarr installation. FeatureNotAvailableWithReceptionModule=Feature not available when module Reception is enabled EmailTemplate=Template for email +EMailsWillHaveMessageID=Emails will have a tag 'References' matching this syntax \ No newline at end of file From 3823070d337620dd10c315695161a89a076bf84f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Jan 2020 20:11:18 +0100 Subject: [PATCH 275/784] Fix package rpm --- build/rpm/dolibarr_fedora.spec | 2 ++ build/rpm/dolibarr_generic.spec | 2 ++ build/rpm/dolibarr_mandriva.spec | 2 ++ build/rpm/dolibarr_opensuse.spec | 2 ++ 4 files changed, 8 insertions(+) diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index 9f360c3ef19..110eae0a3a2 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -213,6 +213,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/public %_datadir/dolibarr/htdocs/reception %_datadir/dolibarr/htdocs/resource +%_datadir/dolibarr/htdocs/salaries %_datadir/dolibarr/htdocs/societe %_datadir/dolibarr/htdocs/stripe %_datadir/dolibarr/htdocs/supplier_proposal @@ -224,6 +225,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/variants %_datadir/dolibarr/htdocs/webservices %_datadir/dolibarr/htdocs/website +%_datadir/dolibarr/htdocs/zapier %_datadir/dolibarr/htdocs/*.ico %_datadir/dolibarr/htdocs/*.patch %_datadir/dolibarr/htdocs/*.php diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index 9c51feba990..ba5c426ea3f 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -293,6 +293,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/public %_datadir/dolibarr/htdocs/reception %_datadir/dolibarr/htdocs/resource +%_datadir/dolibarr/htdocs/salaries %_datadir/dolibarr/htdocs/societe %_datadir/dolibarr/htdocs/stripe %_datadir/dolibarr/htdocs/supplier_proposal @@ -304,6 +305,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/variants %_datadir/dolibarr/htdocs/webservices %_datadir/dolibarr/htdocs/website +%_datadir/dolibarr/htdocs/zapier %_datadir/dolibarr/htdocs/*.ico %_datadir/dolibarr/htdocs/*.patch %_datadir/dolibarr/htdocs/*.php diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index 9f87638e8ba..073ef0389ce 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -210,6 +210,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/public %_datadir/dolibarr/htdocs/reception %_datadir/dolibarr/htdocs/resource +%_datadir/dolibarr/htdocs/salaries %_datadir/dolibarr/htdocs/societe %_datadir/dolibarr/htdocs/stripe %_datadir/dolibarr/htdocs/supplier_proposal @@ -221,6 +222,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/variants %_datadir/dolibarr/htdocs/webservices %_datadir/dolibarr/htdocs/website +%_datadir/dolibarr/htdocs/zapier %_datadir/dolibarr/htdocs/*.ico %_datadir/dolibarr/htdocs/*.patch %_datadir/dolibarr/htdocs/*.php diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index f55ca13906d..be61853e165 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -221,6 +221,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/public %_datadir/dolibarr/htdocs/reception %_datadir/dolibarr/htdocs/resource +%_datadir/dolibarr/htdocs/salaries %_datadir/dolibarr/htdocs/societe %_datadir/dolibarr/htdocs/stripe %_datadir/dolibarr/htdocs/supplier_proposal @@ -232,6 +233,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/variants %_datadir/dolibarr/htdocs/webservices %_datadir/dolibarr/htdocs/website +%_datadir/dolibarr/htdocs/zapier %_datadir/dolibarr/htdocs/*.ico %_datadir/dolibarr/htdocs/*.patch %_datadir/dolibarr/htdocs/*.php From 0a221f66ea35d3a63bc2a8b3dfeb2ff491c4181f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Jan 2020 20:38:46 +0100 Subject: [PATCH 276/784] Update template --- .../websites/website_template-corporate.zip | Bin 1722083 -> 1722096 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/htdocs/install/doctemplates/websites/website_template-corporate.zip b/htdocs/install/doctemplates/websites/website_template-corporate.zip index f83fecc2c2e1e0618d1731d96ae3f6def65d1543..9ef5f4aee5a7558bbe704865347e9aff81f81718 100644 GIT binary patch delta 61918 zcmbrlWmFu`^F55a>$14JyL%wP-GaMIuwVL-I*f`3OvbWoP~@3T077~)uv5D@ZEVC9eKB;Z#jAWDOb7!=Wa zs!$7Ys5gUtGnhAneKWWQ3vu|up!eJuJ@5nnKmsc|MS(i z;rPF22M2cIyce@U`47(H`<@R~?8a$O?8ZGAexEIxh>>(1EEP^ zyoMw&etgzDlYtL__TMfS`~;}reWxA=0N&TufcFi6`Cbh$LnL7TosSm<2>kEBNKXVn z!@eIFXYo%Xl5h|ZrRZStC;)!L-(-L$+&h~%6YvW29+NZ=aQzPO^8p9%v(TrG!rNMvPv|+iz^st~e6Ugr;J?z4wgM3TD=b4B0P(+sJly~u*muE>0|1f# zP~|9q;C&I`p=rR@`(Vuspy@v~PICa2cQt?K{wJ$^{=Wi&Qx^bf??Zfx|0@~Q5&-7E zjEu{G(f^`9ZvepWxxwHA!1g;IbO_i%{U`d`$%-KC76O7F>~aL)0r_tNgy!v<$3k_0UdPb*#6x0 zdffo>yez+Mf2k0@i(GwqK7GBIEbAm6|V+^piy9%4R)ZT&8!om&g8b>|qX=bf&d8 zr$K~d1@ze~_CDanP2>m-y|tqK_&LJk;%3Xy@ zRZt(i?Qq@J(5?x7`F-~t-0bE@zk;Ez;XRSCHs3Ck8S%K1@7d(jT*C0soe7dgczIjT z?RNq%(B*SQADQ3f>WiLZH{sRFj`_S`d|QbJ2qydWtaRJ?SttvHh!tPFyt^B^yxzw9 zG`1M0`K-{k`eXFAmG{+^BJkPqKHKZEO)DPspy9k?-$(QsYDhpZdoXK-4+$&RyT%4@9MGUnSC-J!rl5{7QX{{-l4p`cD`beNhnRJ)wQ=5jFmzdF)5w{{dM-=fTd6Db~!&(4L1dYrSbI!1fD_ zkJq@sS0;D##X(<34xCJfx1-rI`{ydiF*cJbdf)%?@LQjm-+X*=hgBng#_c#CDqyO5 z?sKhT*pLv$-4*?UnKaCw4tcJP(Qyk)0hL7vCY@!a?+M}z{6@KH`vz~SE^Wo)=}w?bg#umpU<(4U)|0@uB*+2 z)vMtpSq!0c!Z|6Vh~_MdPhyWoso!K}+aB(mL=4am+cL8~UsboIve_g$?P6pgq4z+1 zL3~g+;w;Y!Fq327n!A#$S_k3frmlL`BM`5DJ58|?;r3=%cuW@$5tz+5>5yoVir(b~ zxA0?MGw$&dMfGaLmRx^hy7kQgNoTbkVeZ`CM~r-X{H*5oZQwOrhoIZW`v~`Oa{Iol zmi=M%^h-6xM8(SWOTq2VQ>Bj}HS!!?E{HkgbmgkA`g}SKa%>G+Cmlkn!4zNXK|bq| z)Ni{a6IuoD>%P{r1hO0V!gjd{^ovdXfUqf5X1H-rX&cdJTQZhW&|F3&Xn1zDmHbm) z3(@M+UX-Gr7={U{Q&y~Agt^;*mK~G61T1F>|f+*G)U9$=ayO1Man~o4G)ff?>O#ZuTnkM zDm;1R#l@Azvu$tjC5!LYKL#W>b$e7alK4?4JG%*MsUIlz5?Al}X<))CQ0*uSX|{H* z7o}joXc&q0+=$6uQ1R~+8`@u9pP#qQ7Ge*)0L`~5=po))@)#JiGTR3n#_CP51ERY&;eKSTY;s$$&xdyz%F<xBJ=~m}I4iWD|v~!{xFnjY`GjAVgZ^_T&()RG3(`$0g_LrRom?!(lK5dfpc(# zZfFizTn{B&mHm=AMAV{pR48 zkC}#jBCf${QDKPS!ck-u*$Pbr6Z+s$W{)*Uh zW{f4rDU1q)89Vb%_fHYa14I~`ADMfQ$3TCs6nR%Rx(^eq?ejlN2TO+fBk=rxwG=`2 zJ%r!yw@@N)Tn?toz_qNQlr422>riE}8iGt52{<8)W$~oqE9?hU#YxdGVFc*-FuxbI zyIFVQs&G9>bzjGtRXi%sr8-m(Rl_{lieW;JiNGmlM^NaYhMt>_xmJ95fmtH(N2tB` zD6=*={$x2+%Ke=9hZRK@rREGBQh=5AN=ayC2#$^HjB^R*7kwB)`n)AX59Lj}XA~#} z*I3M`IY$Ai2S*B~=ZF(xvpeeLV^^c$On?g3NK+OF>wL$bq6(iB+EiO%Kl6^gvTl(* z{fN?gBz?mlOnjX1+DDS&q>&W-p|>dv0C+{4VCQ_Gb(Vi#=d$SqvngOX9BJFdPCUR(FpXcOP*? zod$HugC~cXjM>s`Rc1=}DH ze{Q$B^tSpn8S`JQTTn#IS@&dmgHk`fRE`?9$|jf>@zoGYx#X}8LdtAj63C}-07 z^H~-z&mStK$v@XmB$^R9MHv~AwwtNw-LYponM^)8F<;i4t{{v>WFQ&biscp;s?-T3 z*=7w7O@{C|v%r2H>Ft7susVTsl@@5fBp;#_e4t>MjJZYNO*dkO??NOx*RtYTB@R>9 zlopljxI#>4f*L`9W+RG}-; z)!^f0XL!a6apw^*5$rCeje?A3D5B5r%H@kG1Rvf3C_#dff8;e7bE6U3M$O`aaZ56| zBZ1QeQn8bboRa)YhfXLTojuP)uEZ5oUp)f*PNPzygMs(luS|HRPg^)qh-*7JEDa-s zygtb*8qaOCXJa9CBBV+|k9+ZtU6KR=j7GoL8dq-S28o`dW80yQ#G|TwbgCymzJf*j zSbsi#Oatkwl$T08{`tvDKJ?@++kU4`#PY)(^F$Uu_3hs@_xz1)W((|NpGmNHwEcTM zOboAAkdI*NUP+ecuZOrb&wB9IWDxM)Esu-P@HPJr`F*HB;B`3T$ zNN0kz!$!pXmkwTtp~&bZ05N9FYGW`2ILtTTPzD;O;u6bUPL=~6%DPiNrE8H)_P%gv z!WY9;9Za5(t8y+p=kdr*{?e>z=VHbzQ#{lOuRkF|qD}c~s8DV0&I_radQW3Ow80%~ zGoc7e&$fJ!13Y5=NFTmzpM2v&NW|E(@n{uo_9u3l$$~Y!3~M@m{GeupL-BX5|W(2=W17 z^Dt{9$SBm6bV^b+P1YWB-r_8XDc2o2z z;XplPE@eNDF;BuFz=a@thwsNw*cHYp&=3TlkMWH-fvzYtk0)Lgp*Gxn(;tDNfu87| zQwGQk+Qa?kVCN54TsndON;4akb4UFPH|mto1{V5*jBaPpygXx2J=X`)XQlhEU{aQ6 z6{@NOIO{(e4RUG#MbJl^j{Q30Lz;uX4$u6!ksm@W7(NgV8S)aTJS7zc9VF=&-g?DQ&HS2R>vmB zne~CncVF3K)3PhmQ&E8tg@}2S#kKxC*dN^N@%Mv5nc>aH@0j{pdS=BxzSYVM>43ag zArAm$FOVRyB~nNEZAUhjdQ3`40Rj|i5%if-Ga^oC^D*R`WyhZEiF|Scrr-`4!X5WU zi@dX6HO{McgdtNmX%gT9cULyT*`HdV?ZpOKQXX?Z%62p8aN-`Wzijm|qM(nAER%r| z=?Cnpg&OZPX7q*m=r4Ko%W*2`FF-`$c%XNQGDnw^Wq{|JUtNQYgxYJ#oHodpY7-wA zF4a%ezm$0Sotu&LC|=%5jEgIwA30ho$1I9UjdI*M-}oc*#ZdT()kqb5ap^&yMTUW= zu}3M^C-b%^%c$R)kV$Vg7chqx2`&? zB%7;PI+u%TF%ibgWlHelGp2y-;i;I%z8&yaA|_eK?5haPzRY3!kN#k=%R14Nc?9ZY`dm57VC!8{iO7gx&pj&W%#j{3 zKIcPsIM6{(z&~G~3}Npr-H!CiykvBAtz_G~CUXt9$DbIAyRML}B3pr&;Jq_3oD8k6 zowz*Ri_;Cz?J2}w_I35$->$gu;NZM-Qa)YrwrQT@BBRg%rhfUW=f`uCcFg~(0U|r& zQZuFl@sf0j9-QmTu{5%c&!A8iw1=W@Wl`a9Rl2wJIkOjR}sUmpSAmyFMC zg)&smcX}o1q3o`Q)CNEiToN(QiKTcz5yu;1y6Zg9l3kcFWBZpw9V-bp0bKr+tsiI~ z^b`aBCP;>IO8m}H&<%?CNzWCv{$QNiZjDctu;|GW4V&h-!Xd3fN2AW*e6OX@M;vV~ zqdHpRj(e}pGCM9rY+A>**Q1|4m%VmdXyB7G)Q4q7?iv5=Qw;!hd47p_2njf`(Ag(8 z4zC`-9*iuu&>+z*WHu7*gdO}QeKiM2>fZ50<6!c{Y@aO+BY7?YO9ob~*p>nVYeY%* ze|r3RyX1-gyh0c#$0lQqq4Q+8#zZ9u*4TBEyhr3`w< z)uH2;{T$p z0pnBA=<1@b*`l-CmYL9&RGE7{cf3*|@cN$P{*UPy5`9nyECLuB2B-6+!qXjXyUJp1vgc#$ew z>#Lv!u6T9xu)o7P7Egw5TD9I69?s?(lszVB!Asm5^`8Mj8oQN9I8N!s87V)#N<2R` z`#HK>jGDj=nZS*h;AM2%tkO1#|Acg#x11m#jY*II*?cA)bI{-syq0CP))eJdCVW&x z=7zbk4Fs6#dG`9B#fYyHhX#AJ!_jt}a6&%}b%@mHEFxAayC6cwLD9g;$Alq5bUWBZ z65~j-!F7*l32C`9>>j#DK1cP(;QM+Fo6QkNQUHGS(kwD>^t76yWy;*t3+wus;=24F9b`DWop_-7X z?8-a+`a3QnO5vnX8%37=>Xz+my%F!m8UCmOkJ4TcLZ8ZAj<(UFF_` zygpr+yD?SZE9^RtB$1OyxDGe%Q7B8as6nNqTrza=jV06a&h1yI$Tx(WaC9*p&hbr- z8p||S88tYh=(DZQI#Id9A3X~Tet7|kIMq}5RuVJME!X$Ws`~s=R2r8=IR4#yJ!iQ+UDDmB|QEd4l2Dd?8=hZ2<#C1t(O2UO6H zMgvBNLk>6Af4=0Sm?tYnE5kjk^fuLaOpMuZ%dV405j`RR1RsAhnZOyw5=V3Ol)BPh zM)tECzy~4=l$u5z`j-57NrleuY@Ep{PlT!Ec4!H~sM&22%^D25S(v@RZ%$?d@pT*9 zL+uQP`yAQgbdlHvg_!FZqKbV+!AJ}~>i0jVVE#JmN&tMstW&7G#bQ@sRq?c?$v}UU zzZ#7H4k?^EVI+!0*yOoL>$rORkk>6p>}Jk?@X3^~q~XIx%EAoa`QIk_z_b$2F2Tza zLcz2Twvu~#cxw@x+4Mn27M^mcAV?&PNLsWj8wYgg=NLB=o^ZW|^Set*Pt z8OQHU;u`gyE4R!xQ&E9DpK-}b*##eBH!D)ap)vx}MGV2YC+J&Z6Hol=cW-cb?*$x>@v-)!^c)!yl_4roQ1XeMzpO(F5KabGco<{ly>z>#gQjg@l(;Ef6TB_Wy7P| zN^}MdbK6?5QAc+x`+NF{bT>X57Zse80}(zCVA-)$ME2YEU-vLHDM#*6`ZxS)^KA(3^~tdn7V29adG?FxW>C_cZMS6@A3g9d)nK*?d9x- zg_8ld)5a&YswQ>e9Ma?gO@+(hkQTZ=Wxv8AO;d{+k}>PH zpYhst5MnM`G=F>wS+qt3mqu9uKp)AV07v+bvnEyZb0h2>cOd2S6jg~ObD}w#_IsHe z#l7;zTki?;>w*`FkjZcCQcGk-YLw=684;}(NLVoEj*yy>`62S#St|z***9PNVHaxB zCT|KlvGdV9t~OUJZk?#*vrrUIkgtTs{g0f7r0F@dT3YUH>-l2_ zTQa4>HloXd<^ZI66JyZ_AC%|N})Ow%_#hNA~-X@u@%Z>tVGVJw6 zmP0!sq_fnQeRt=}_|;95n{rSL%{0E$?^D8|(pxvVhtd~ztw?#~m|1mnw9p`p>2`(h z8+q#`Dh-??+P|Kwfqijs9gUJIz>MB_jI#4o1pQ{`th=jO*hO(vc*y`c6MR{&=n-J5 zofoacNCC)x#dSiL`Oe)o%xLWj<@&evX=#030`U&-MgGCB&YvT_!{tmulUT9@d$6!F z{FarZOp8&xMhQ{LELWz`Ro_Y#zPXq$naH7%=2eQUuBWyR1E%TGNF?oppcis?^=^(+ zv^8B+RJ%lQ(B-KI@kbh%F>a5VDSLdF%fw&1`3gaXeHy|1C1kumJZC~8D_*=w>QQ2^ z%UT#6OzG`=I>H>jemCalKGq5S-d*FReGO*rz4EPC%9q`p6EOhX?2wDvVxSwiN!w#U zq(-r&M%krCDK9z+WWs8dBK#a{soKcq+rRA3G=$P)p3{%Yp+LZYPG|mcrj5{`Khm7P z6a@j=bT+D81obd??_9_<$dcxSG%>Nn21oQ%_Ao5m!Iwy$kpvfhO5~@ipA78NA-x{4 zyu3>EEAu7RvtKq+-W_na(Y&T$fHNYZ4uUYa_krdnfTyDy6FZLPP#1=#?u%qi{{K+Vm^ivvG1Hq+w$7-U`x5wPc3MXgn^w1z+q@C0m+S0G~S- zui2Du1sS&VRtx>{h_%V;taXku)#-mBK)L3qZ6 zKy?hItC*ylG-%F7g0ZY}k4$%UC!X1AGcLFjxKEb;b?rdd$FEEJ_1|ZYZOy^U(z@_o zGTI3g5LwVDR1S9(!IkP^1q(#piyw1A{2WG=@dLE4?!pHC&N1KcQ&HmZ_&oEh$=Y|A z)b;l^L%*nKKzK059rLjJHHm3Cn94hfT4NOPd_AgBCMYOjVeCssqcs2KQ>R<@x6~`# zM5SyaL;kc>Xf(Kyt_IxQrRWLcgb?m;jwl@@Fv(&>K|sl7!C&!cR>e4f4tZh;s!IED zUri@Y%Rt5Z?_t>QcC8UE4!Ts`SQmI?lc_BFuE8ibPUy9zY(}~mf*}KTnA%6mScbQ& zbT&oNQ!Q`aQABT*rbW0)e9G6)Hnh_uh!PUcajbFf+z}aC55&1)PvowFa!i*?1fZWw zN(Qdu&<%yx8y9)o8i_I!QrzsIf&NBm*PZ~hPUHw(DjfV{W9Eg!Z!hC3y1(^Wa5-}l z#yh7pG=#*^%=FQITxYyMgWVhN(vB#n|* z<_LE0q(T8Yoi&o8=J|!+P345JE7^F7TloKmt6srXOM{89aLA?q4x^%Q}&Qk|&{JWmdubICDE1?R=TBmZ{$ggq%Zv)Qs60suWJ%Yg1?@ z-jM5~#Tv*inq0>Nkj2Sz#Pm^qtrZfPu==-t!+%niVFQ+&x8hzg&;Q|7OEq`mGgz@{ zPkcTJKN*X-79{9bebS2r&*=W>F$vJsu)wE~lL>U(!q?r-l47nNBAHaDk zn`!5@CLm>i1d;DK9@FjVX?+5We4XD6j`nMOdklQKqCUIr=TQ~0>k|!&oC*r2B_7>Tn^8yqE~{T1Vs^UlG@q2c}II1c4?Ik6G+NGK*&7Jrkez z@DCXvLhOUKBTv^gh~lF!gfBc!Sc7yel1kA-l}&+^t3cx?n9~In3anThZYcMYvU>{@fs*)Q$No+PQ}NT{#IjKSi?Y8y{~acCko1kks06BPv?YSw^U1!@Oer zL^hfDd9*}+1o{z00R4L+&k{VQ1Sq?uFPHKT`<4zZ90mot6HX7P$j>pDH zE%6MjHfX7rk~HoabDG*byw2P7m>8X>{GEV@J=yby4`6~6`Ft(i5p#6qN>UiP^@$=A zi5e6MBkP$Bg1)w3lFr2`3SogZNsA+5IjW)&nw>1>tH|pj4~HighgY2>KQyDfiToDT zq;D^YTCItvxu=j7i@!w3Hz*HhU$untLoA78>^CBipTULu2h>k{f~)kPNsaPtq^MyU z1pM;yFZ*z60Z5YLF#`h^b}7uhwd0Y=dR`#d-|MDzS5@H-`hCfBM(0kQ5*LDVe&Sck zI1Ud};f>N=5XX`#PO{RT1oz8@*bQi*3~BKbf$UqXumJ;>7Reqw>IHQOcv=ZiG?al& zj;i2E>9`r&Q0H{=yiIPOlo<1EXKO5Do_?v~2L}$R`bm?oYKyk#SCGVMFvyL{frlU# z)QcC{RN@w1{K|>|N|u)LaAc};6Y&MIGs<%O=#=XXD}9pGViQOwUp>h${WWZxKLz9_ z%JuR-8U8gpj4ajIWJALPxR&m$eA0s`OeIdSnPSku4*d9;t)e~qHEU@V?}i5Up^K?G zteovs>T|4ut~dH-D=IYn)w<$y=#2`Z(x?L+>}k6^m)80}m{U%<%HKU$)Hn_Pz~i!_*c*6Tj0&JTD}Hr18B>_5Kyex8eo4 z6jMjPPn-2#)k2_BI87{p5duyQcR`etboiK_*9z%uCTB+WHD%?P2Wj_QVcAIcNR%&2 z+=9A81aGv*ipJx_=-^5-NzegC0EjrH#DUlS&BmdpYA0bRFu|@a^5tB)r-`7h-mV6v z&b&f2Z?)-i4OR@E)!b_=(4iM3=`4t=v@r)JbQLUK!PtSPd_V(v{MEya~=VL4Kw{dgni8Tey8+?*3G=i;yB)D?g}!>cX?-cT^Eq z5UJ@Zrfd(PX5|DqZWi zwNF{Wv6ap1e_d@(_I$et6tcTrY<^j4;*8MG2{CC-+cln}sow?cqKRSmd zZm`7Qd@{~qz}89?pCf=0yzCgEFs4ipz6iUaQ>~W?D~b}T=7_+-%m1u$9loG7@RDEx4c(Zvr@?C=~tYDM+!y?hDDNc41+T+ME7&))S}UL5oI zeqz5T$bHLuMHC0}CVUwA^N+XUH*%ig^qA%~TK%lhS~&AkuySb)Qaktm7$cAeQb9>{oFPae5CGnKk`!+}qklcPw;nVZ3VF+zOb0^wE+*Tz zL3fy_wF4qZ%0`3+K}`E%c$gqOFEI(La(Ecf|Dk_C%qkn6Dro0F@J_lgBNQext{sQQ z`tX0?i!g?p#jGki0s`}uf6&041Fa4I$Qy2?i z*b~Ed%|a0vgCi~qM7t7)N6Lnd9t-%iCq?U;gCj7G^s^{fsueU>ENB2@9e}SlqE4#z^omZT z2qHRDpONf3BdJUjm~m?x=d>OsEMCd|sVmV3HNlp^)wjI_8&$2#y3m-5uZ&9`weV-i z_*(4*8+W=pupneovCGOy*E$)fDEL2;pF^=Rmn<`P6kKtB$T(Tu6dMSbrwODvNYDBI z8RtFB2}~X~?msyuZ*tWC$%%NAqssm!hvA=`?l(Eb|K$9S^d<*n@}@`QpPq;}J?iYh zJa-0~6T5su;>nbRefdGx0tlfR^6# zV7#|Wlk^5~KX*2T-Rq`(<^fJwQ{5@FAY-wrj742t*?Z}S(o{fhc# zm*L)Q)#VG2-PUu{R%V7YZV!DFR@nlUWI0BivPoxc#GgSW=5uMaZvmdc<0UuFOWY{V zvl!duE_7)2=I^ z8)3tG+O0lu0p6$?19Umjl2U}ZQiNSngfi=R6ILK|!ko@zX|fNxp={WhjYYl;Bj9BQ zR`Un%3uD=BQ;a-xGQPJWg&Zg$58+y5f zd`KX9a<6YO5o4+(!of*cuV0`Be4tcCJPJE_5yNN#-3W;4y3gmncdKQB6Y6LT67+6- zx3Vg4apJB!+a?SJAdW(?$Rw>>1ut7id{2G0=x^wSj))gNgnle#S-IU?r4c&hzbo_a zQrF2Gb2KEt^~7ar;A35o@_(AFYdYc?_0<4j<3f24Xpu(qdNNw(5UO8hbxVbv)a#uU zj@?Fa>L3{F_%J+m&uO?tvcrUH$sRenSND{3Dv?p{C)%|kUd$Y58{EQwZ>^neOTze~ z4*ue-V=sO(wn`q|;;K@b%g#hG7AtkH8`ZV5rbce4Z78tp#KUl;k%heAF}%kc_bC)a z^u%er{d9DrgS#DqUS~)&V^N6Hc%;)NrAvNcrWlgFa9ENPB27thDChX1&f5CrZ}VqX zY0XUS3fcCvPn5`qH(&Mj(Fls_54pB98a?gHBAh;qi^g&5{{WR_PBwkGf`!;RT;Xj! z?koQwm5F9{Pi{o}1JIKv0GUzh@GE8q6fFq^Uh!nCB|$)g-@ajhKODFWfM&De1AjFkjUr?{?_2i81f-rxH`n4tDH%u1S5&qExocLJ$EUUBYq z0n{SGf!o__Jb=eqEJa%EEJPQqF$8FnbddZ8lO{i(;W%;U4npmf^6w=L7fMJJ5o9i^ z!|67cMTP1eshV}&rvzAQnbcEj9mPU*yJv$WVUPJP!L=?KgVh!5ofLu@8<`#WBQ!hs zp@Pk^{&4b|z({If*_U>u&Q(v4{>_YovBqwq|0+dJ?4wVvd*{G{&zD!YrMekC=hkFu z2U*}U>P-IDO`Q&VYlVg}wEI!BTf0|zm_9vsy(XKx(2&ZYBUe+iq`W9Zk)H1qd;L@o zfNLumIV2(9PwV^kiTW|alI-V~V(pLAYw``}^{fQwwa~COFKBakNV+PZ_?W-D-%pZJ$xpX$da{@&3S?VCUBVk5yt4DH(R*LIu3f4$HCtCQfAd2I_rqLu zl?;_09Gl03;a>Tcgk{_QVLk7)3-{rN@2Qfyuz0tzwBzmd!5l5W)RhM*36e znqQ^U3L7kX4FK1+M&u|%^th^4MkXzxi!HKuedKX3G=Wi)hD%xkxo3ZxYGaSbnVz`+ z9FJCF`dja|4OmufvXp1U&OszOC1Ws;RjBVeyd#%YXJG5kac9T30>a6qweyiL<0cAe zL@mUH`0c=>vJ*bDT*+?g{W!3bIv(4g4#`^Z&}xfqz;YLhpQDu%I%9Uj%M04(gKoyG#P|#QGsYb0{1=<9k~mQ;%TSN&tZ>a`m#~U8C2Q=9_I`n1H#p zRS9|HHo6me87eUPlX<~tJPN}!Jh)PN(P&J*35Pgue-Q~5#9eXi{BZBt&)U7%yx!#L zIct*SJoa2)Ny}$PAtYeeM>R+6f@jj)q=%mpD`@q8b=O4~&&N$fB(!9a6qP|N-%Mdfr=twX_0KB&4L&zp} zOTLW+3y~3!f-cQffSTV`&jQcCf0|Ezp{8*9eQ_c>z`R&Fv-fOst0q4EaF~_kuAg&1 z5Qx~20f$Wh9fdCTR6T-@&VH~~`rrG!iy!L*)w}a~&CvQ(;5^A{==X}Dl#7+NTf(9u zo2M;ia4GDv?;8%!DgJ_48{a-A_?34Bw9F^EZME$^{@8H(2+#NF!ub_c)Ry{9m2Miw_UAG-bbIx5Ly zw{%~-3B+n3V|OX)M>;UMA)$uX!S+KX~^fXpKua*y7lWe;`&zN@9Lz_vqF!**I8b8+xG1pyVPQg8M3x&6sc$^GvuQ?bZh z@A84qub8w!v1>#9i_2}^?}ep<_szUgzj%*8jw_Rc#68F_q8A$=?C96~dvzaPs0Mcf zzbMW;-y`dkiH|a;e!j-P;8Q*e+RMBe2|O#4*5?s>(_Wpn?pbw=Pye(A>qXAbIf?Tv z3>5_ub`t-nv`=~ zp}3;wf#(bv4b$+Dx-axEs$os<;$+s70+!flnAm-&Qh0kWDGl;K+MvHzy z9QT?OJ+^4;jk;zE8 zqzWO2oFQ|Ixo}j4=K2FA_kL(AJzpi#tA>&7sNo>}8AgCKBr*{g{Ya6vDqLjWG!w^^ z?XeN^asJ3o(H)}BG%E=<6*-if_m6#uRzBSGK+GIGth^r$^+EUa>{K|Ps_nLcUGQ&Y z10m5xQ^HlVl>DeaJMcG3oNVx5?-3^5K>PmPSr?Ehf-*Yo27&WSUHzzT|4=L3rz&5p z=EypduP3_#RY@a{Q@#01g+#un72N8SdnCie9*UnZ*wL_Rzo^Z;V6!3h{_|qzu8Ab` zn&bZQu1J@+lYmf**Q_8>_z55GeeedQ3~2d~cpu4!9J$j7s1!^EhIfoIa~%_zS3GAd z%ovo9Y8AS_tSv$z@uQ5vCXS0T!P&U+TzQr{WyMx|_R2ytiXiEgYmN#$Iwfa2XrlK1 zZ8*pXeqdwwrbMamfmkQ!;e{S&{GiSG3QW#V2t45A zyFxxT>e9FS?3g`AY%!?{_vX(GI7Y6}YTEdbVRt~@EENxMBgzI7p4+wLSs&lQL z`YI((cu0@;fgPo@F3TzfX$W@qgu@7cxRQ+U9QCo?E9ffgoAw`p;O9J#0zAvpZ{02{ z5ZQ~Y2L_XI>yw8}*E{%~Vzs^c;4>NmT*zuL94&zsEv7PPJvJ#!5sRJKFIE%cEk+k-`3>&k4ii}Qn1Mvu0^Py~T!1VS>>eb$#>+_e6(S}5 za$hPJs%3GM8CfFJIA+8p`|+Txjdqocc4)<&Vv^OHN`O1c<1gUXtnA8;{cmrj8zV-% zGu4E;xQ7=%hLK(m(yMh06;XWenK;ysqEk77t&Y858#)4Z$Q*Dw9RUGUav->Yj({3u zaU(%i@T(ld+~5olT{G+T5|#IZ{u7;iMPbE?DZ*0yNH3JMZGqTSkb+_R+(iOvLB)M6 za`ipUtM^ZowhXV>nyFouV4{L`g(47Pgrk(Cp315P&SDG&q3R8LWNSTnsV>rWv)EwR zaylaA3&{uWBie z|0x5OIeHa7J}sm3WjXhkmgSGLKv!ABwl6*l7hM88lPw-N7H271Yqo4|$rY$0gvwD& z&={XhtMd|ez$lc)S8`1c5|TF?d?C3Rt;AdsH%|TiJ9|qNH^0@Khr@%fLE8idM*V4T zC;izjNqW%uk6{H#$(IQR_zR%U;KqeEj;0jK>Tnp|k%rV^ZO6G$_=)EX1axnjSa<}X z%w&wMe@e9(y0U%vUvQ`Lgu_!O8%C%K7K+_^CK+-&8f=uJUE@rsHEL6L2eqJ-Gu5L= z?ObIN(`*u47@d5F>P7rA=o?0AqwBzVH3yy-sH%-Bik6EZn+33b28eYt%;>c>0qsHO z2=bI^X_w50WoNx$1$5i-B*(uF2TE3nUO|qBn6zC`poBx57(-_D5fZdTlWa)(d$>2a zG64XKU7CyN6>T#WgHqrpm$Zi&qFW9X;W{-hXNXyW9=p3ijb?J8WNTcCvjuDe`IqV| zgSmyPg|x=*dxG>`|Fb=TM_3DOWOVe9B=5jMN(QM%Td7=)9OA2H0kN?|97@j zO|EZ@dC)h~Fh!%jmnx=m<{ta(rD|+Oy0+cJ=&i~;W(RZGyKg5UmaS}+zP=OOiw<9n z^VX;QzFR(=V-|Ki*KG9R6qYlLe4THkd8Ek8UUT2i_xaHWE66W7>*q=;Ph3xIiPCV^ zA>Bbj&@<)iZFQ~u%7pTkqzs?Z|39A2DLj*CS;MjIKela~6Wf{Cw*T0+ZD(R96Wg35 z6WjKj?ERc`Zu+Kr)mq(G)z#nom4o}m-Y^xjmY9o^?y^deVsvvDu}2KvIvlt0&N7TI zA7Wv6aQ|r&@71X~2GZ;{dS|{ebntaMYX6eu1bW?2{-3Ckp6RPyxDqI?pZk33Tq?$b zcOKHykntNXY&fAF9%v6cIx_1q(qrRD6=!z9(o6)JlsU!*Tbh{mItweqr5QS!D?^wO zd~!FqFuW4c2sjR5BwNP@5-wqOYFO%|@&IQ&Pt6}mTZ^@c^s@JbSV&}}VNr_C;ueGj zsoT|!s+WRg6~Qn0x=oDx}hDs_f+h@i90M{IR%+iLamEPAq zk3_FDNU`!o)v{h*AAbp0ugqX)cCC(NQ5CwcEUpbTa&miI?^v+X;;f>}$7p5Ib=+XY zvN}3Y93!(gu&r%#+?Z{-w=623_|Dz~F(-hrAYjBI+*wvwCDs<>=DD><5WrnGhy@?R ztY?}ljlh*3<1Nz@MzVjQHQsslI=!1CqaXSwP$c{(Q;K6_eWJH$*GfK0b}IRf3>9f7 zVi6IfG0zCHs6MG;EYMhkG|%upct=?v<|tA|BF_^+t;Ct#lC<`q;HU17!QFtscH8&I zz1OGqH28|=5+ug`lqK|OVw^=xGZ~3@!Lw1K&$xJlJ@R(Z{kCV@- zwcyJsM6k(FYG>;C`|Dv+eJelur1`U2P3%_s6UpC7S&L%O!TYKeE4|O;!+p14waC!djH<`}RW#cWC;yW&2pUd~t0M(0v*Eu8 zGG4mc)pGq7-K!r@;lL!?$Qv0+^C?+ zgi$-?6iIBjqD6_^Ii1?Mg++Fays|%(@?x94dn{&d?cNP0ZXL9%=h^oI|+=dXK5!9GS?5e4e8B8Whvphk1R~nh7lh-?^ z(p5U;G;2G(qm|XlzqpBj^&=5aEEp? zLz2eX^Q?yG-n!U!8~0Qhdwwd2;t$ZC8@utt%SO!K{i3LzALImk|J*3tagE6hkOWyg zT*%RAa7F+D$z0({k6{InLpH%u)8D7Juzr7m6FXCY8|*r(CyMRd;|jqgP)TYGRgN)d zicHaqNvpIBop}p3xfHdlSG92Lpz`8nwwp=I@uL>7FbW}A=5E*cZShX$?=uIi)mr6n zK2vA}NUW+==5=~fi=8%$!FNfCEsmSf_F-Xynv4iOr#h0Y_$ec$A%FTxJgYuXDYJ(I z%hZqEzYduVt8;EPK5eht<=Q~{`9~j9bz?4|9kWMW>}9o=!vvSe)z>@#0(7}X+cF z2tS7OkLGHzjtqh~FBqW28&Aj$iQ74V2L#as%-6m$S}ut6zp>&jnnET5q(rBz-58_9 z^08t0D-%wUzz+917Zrg(p5Yz;NSdyi_r?6y_9OXB-f#xL#hMfaVktp{U|ubn#+0bzR_gw1Mq!RB+bUBiT1-j)hxaP7%m6flzt69JJ97TnG8} z$KE_9E;oq%KatpTLBUQr*L&%)0%0$8#6IfKt-6U(zMRg=h5{48m0!tD?4^W4`!rDQ z;Z-|{mY*aT?4Z~^)p)V}8kU(rw%T0`+X(gHT0C>Zc&#d!+Fcym2m&Q5L@GnEi>mk) zM>x)*s2)p13&TO}_Fa5iZe%XKfW<}_MQCk#Bcz+*AA4tEVs%eYvZ8XZnh+d1@d-zQ zZbl**q$vEaH*zq5pkSuM1X!aO;hR@dIT&<^p!$qRSfeQ68~qtJk|`7;m?ldY7lh>J*gDU z@XFF_v)Our<}yyd6Q=Ke$ANy+$_yFXs)(r`3rXjEhVMu(z2GC)0rz}{pGcm4;78X1 z?|g>;OuxblnEz&9iq6}^duFdIU>w)gl%HbQpKZ0@m$i~nDEW&zSa+#RJs576wXz-3 zi{bs2xATbN500_4=2H__?UM@SYSE{)0I;FiTl1-#uEa)+J8jZNQ2}+{)Da{hwU_&l zIeD=5*Qs&h#p>3t91C}JPaFXyc zO3XUaK_ey%qJXRNgIBIFV#kL3 z&XUge9RuEK;VDPlt~Mu!DufiGTb+pG^CpHXKop@zo`{q4CPpfR6a}hfIG(YC{XOYp zRuUF4>-u!(M>);hU$k#RXi#c$+~jniy%!$vP)D_xaz|LT7vq=wxCcFD#^Ts8bQBcq zL_{G%w%KLavQoedjdcr@n_VpmtRVk&Rex`-3j%aQW)4p{aq;TWyXoB1+OOK2&)Pb) zpI(>!=hrYXJ8Gkz;zx)MH$}F`U`!LA8O|C5aChLThe7I{`YSzH-@=%vXO$`H^Zi3m zm@<8Pr+r;%mm+^s0xE(q-YVBCgRSgy$u2+S6GphteOpolLlAETtdT z3`!2Afw;lVxLk$HI3>&Nu(g!L8o*>qEqUP@O8JJYAT9Z9Lk@6}>8yaPVDKC+zz#vg zvOd`WfK+r1MhgmjGRVjOQ<{7Uz>?Ud6b&Zl(?Si>q8SaQgl(-HbSBL3gV(J9i=qN) zsR(2_R41i?_xmQb|BFFg3Nyed=~qaAR>8MW3%eC!r6RZ&Vo?AaMy!>Eh~V8c1YL`; zATyq^k19ehd|C3pX;C~m2d~X3+@qaOdjX)iYf^Qb&zxxE7i89av zE<_oA7{)FaIcedZT~=O*Gr=)mJ{Ey288E>K>z_!#R)P0WpDqO&e4lUbdmRwl`#*A`bMMd z<65czg^GxKB}tcBqW;+!W2$Mo&M#Sx_1Zk!TIySv3+t{wOJ8y@zCetcubA)_$$&Pr zU+f@ETS&w&Kqr)LDhw8|uc36sBVXUB)Us2y`lGOA@mam5uGkKB4p zSeG5UtO6A)0(IG~;gL-EuVS@4k2=D4( zgV6Csep;wPh+I$t92Ox4XyOX$n*c!tRQ!?MHbFZGK&gf+`qMH%=#P~8Cfh%1P=l{( zCVuogmLJoP3kA$uewQpuWICLkj|c#sj|xf}!q=LH1&aS-tDHFkm6i|v?C z9)btg)?tKVRhtCj)Ml??v3iyOoz?II zj-gMD-}V6My?g*3;Bn2KUgMFAr6Qpkx00Ikk`1}JcItMqp+)V_c~A{w{a_NhSd-)u zby6u;*og&%TyvM%EbD#LCQ_z&Pf3YC56`0++9-TRL=6IN+!s%z+P(TqYZ)EmL(~qH z>UAO2f0hU$PF1%m!oFPqYQ4|oRYQ`^qWYlkf+syJ@dzk~fveOHHN?FC>9GA|oaKf{ zqrzF;e$fF$4mSbD%rDZwxQoN+;ORt$HjQdtPvt;z@?%p!T}*u?m2rvT`8PnCU~Zu7 zf1TG~r9CL(7RlkFcS5RYEB=R?hjpd1&V2Dk%NI`&^@p7o#)60zhQgV$Fwc*Oj5to2 z%|#~YhuHxVDzeB$z{rRC%LEPU`Z}4aW`G{(*6$iOP$ztq(+A=loV&s;NdBZp zrEvx!Xxyvk$cehhLOKsfsEQ}8&;Y`pG*UNKkofX^*CkK6rXHtw?Jwj(;&-wE!pW$g z=;2f8Qh7M?=6<+}jPaDRq}htszJYgl@EB>~E?>Y+rpo0DJkL*ch}7nIP}W-bH!55@ z(*dMr3qf?ExQpP3#+&N^qmYhxF1w-j$s}7}U&}^h(z)Zm9L5^k&46M?4|Uf1Bu>l+?)D5_`XLY|TY=siAo%%qbscOUFMaA zFUNreIO?{@6*Sd(0Kz*2Cn@bMuSae#qT;Jli&zG-jhFkg*J@SM7iw#}UnSVfhaL1O z|MbnI68%-KPy>;pR!grqM0)3|w}p5|@dAo#i#Sdu^{?^X()UwEdJ-_{+|R6dGCi}- z2=NC2Tj`q?ykg7y?6Y=Ti_dUU-Q=aI-rB$i%i{;wxT=3@BH-Br;KBOloZYSu7R+y` zTk1-n9_4XOLqxK1wjy#w0cXstcum{8{)kARyA1Sj<3VeNFfhnod27rh z;UlnV@9-FY8GDkXXqUtw70(Z0s~$!|+%C+q7n39FhAmkp_@N{sIrTr1>@=<#9739| zv#J}**;Iazs_TWMX#`x~PnWi?4UqsBv;W;shu@q!15*&m;gV*ftXPEpE^~2!fU-yk@@LtrgwHp8KT7?LD{a336vEm)x*Ddw=yOTdl{20x2+-!gs@08Kw zTjZ-DF!?w-27D5-o)HX{Y^{~ap7Mfg)g$qgP@J;Ac}?|kHKad`wYl`V2pKQUTzm%p zP*9IVlr8=l@ILv9?c3UM-JVxh)PkPye}XcFumeX14U7j1i8-U1&p0(&@duVV!F;+XW0t6Qz_SC5kFuT$m_Tq6E!`5pfv>HbJ=e9-%l7$;Z|poKmHAQk zw_DHz;af&-j88R%(8#}D{Fl;Hl2@olwL&9(%^S`@BJ0@Hc-qQK+N9|IsVNTiVGZu4 z)WgVKI^2EMk$*f|t3Gi-NMJ>ZBM!(4`8*CVO&-S?7>CC@MG^Sp+ zay>3tO9xMXwN{YiiNq2rk;~x}Cy+3Vkxt*q*?&6MS1GEFS`uv*S`{$C#e`BV1cf<< zAfrV8V_2!A)#MCz)2{%=vaDIAl4^_G>GrVnyS;U7R}WM}Rp|}3w5-`Q=#2G9-a-Wd z$BFhfWAyCXv3)#9ym4SxI1M|UK%byJZMz@0EaI4*ZeFL#CnyD(7rTMzT3O4dm~7jm zosruoU`j}tMhwo9Eew z7d{P&7xXCB2%EMy^+8HL4`;uHUvR_D$k=JV~FxN+@8&U{82lXh9a|m?mQ&~Agvq7PP)S33A+zw6~sMQQjMxXKbRt6 zIQ^8>hbOQ9CWKXLgC_{izDr(ZNk#+nuzU`=q3PP~>c5G9fuCAxqkgv&eV;y{Wz6n< z*{FX%DW^1QEAau$*9#4+Jp-OGo1u4ZJA@q^hjl(Lq{2HsaYMVm4%53u0XRS({%ijt zNUI-xKFESTx%W+)&(t1Q+PVe3m-L|gf8==+s27$fh>{pPeco!hp4+$k-S2S3O{vF6 z$>wkHh;k!L_)edsJVOc1e3=#DmO4Nj3kpS>SzltrhW))i@Jt8x(Umxit^gyOf^@3q zXa}b+t;#j{u#E2iY~EsH$QqG4ZjOEt%fuT0SKIj1tGkWHa{-fF)X%o8 z+ajtb%UDH^M}3v1OD*KXn^_5q{AR@z$U{^KmBtAW{G&mIw|Uo=@}$} z+Ioc1dxoON>7x?xPqalXKz6IJ->hJ1i(>$(nXeur1x6Hx!HA}+^U1#JwV{wRnA4w` zEQx?ead1^HG|Numl*E{K;UxAkuJ(yV%%z4?B-j9(yH$F}X4v}-89IiYAIi~a6EhKJ zLD+@#Ze>uWV#4Xi@?O5(*LL47hv*hW->{+SJS*Wsy%$q&1YZwidYd?a6#3PbFt85^ zCsV-j%N7b3IsHT&APr1ECZ&odeh;^7M+0qI7tosxRmgp_o=r_t4SOX{jdv3iF8gy` zpTLr9UdELR5EKAws>m1-ihQ#@?=Y341Ub^^gEV{Rcg?q{e?~`sj!ID_TGUwpXDQ+d z8+d4uVK`Tn7@V5DW661E$~vYtkNL}e`ZDGEQaO=K&HW?~;F@8=PdDLoKN`o z)o8!5_Pr%U;OA;)gWF9p%u8OvRs@py{XlaviQKABd$hl%NxzRHw9#)Z!SquJfG3bm z`&ZYFkDuuBq*q%_Y#1|wp&M)2db`T%{29cpa!~N#`Cf#xGyD7r%0imWU{~xu4NHn3 z7gLc4Zi78YzMyXe*!}-Yng~=ZA`Kn?eyq6*ok9yT=SRKXJXJQEuC#L58{f_Zl*+I9 zC)}+B+|&mbq>@;brYWMqrSC`raDn^d=Ody|hcRhpuCXE(tjpmx`f?k78{dtaBb_wc zo9@OWO*%<$7%JE82{Lvk$BMKYac*qU(yu5>=81*y57m4@VX>^WCvAOF&Ui+VaugT? zE!r7W@(-sUL-_o-Pw4vUp?})>kKQ!Yi9i}->W`!H(sJVXTE1{;+(%8whJp61NEcL9 zqY|ttMhVgO5^z&tDYb#;7D+5@!_NI@%q>rnEj8k7m|@wDiaIuQ{(^amYHv~AYk~@U zLif=Dw||oh=f@0n$#LRH&UcK;TDk$jv*$w{z>aB?mmC@R!Beh{9Sza zc5nq-GkG-7B^bvk-pR#hi;N>w&5X5h_(-v;LtQ*M5?7|o=i|D3ZYgCB|>iF|<)^KWY+b&E&Gkm^Gm9l!n}MUX6?K|_LSAbRrH^6FwkA5ym$H z0hu0DWKOipSjifsw`P{N!0VvI1F~moJfkxxT^w{}*^o;i@XevvRRn6K)Q-~Fk{NXV z{)Sj)_rG3#WRu4wvQXdvguaIT!x^kRMfwz z->h9g-#cstr^ozP+=+Z>bK7+E?BtQP5LK`n|NL-G-ms=PAGrce5znGg!)7J{mi@Tj zwiV~nOdsqs)nA`F2IYfxSOuE69C=er|Pr7R-bCUo9J1_EGQC+%1*WR0d#PiJ9=tVZ>{yCx@W~2dSScW9yXR!f&)K4u+#!=A@B>mBuzPgp#%MHb4gX%f&%Edq<< z%90^qZq$U%NY)j>tbN!14Nim|yi*qBE6u$18nVC~UxjI>Dpgf&u_r@+SSl>8K9o_w zSyDa|r)eYi>9sFIa@n2>K3QVuVW$Uw#~Sq43KIw4@}ZudhOVpiLtAgymKEOq!Y78J z9V**%oOi5rW+K$;ylHIw@m^=-U)%Rxk}jJmlxu$&T9l4IfdM|p%2Bt<9?z>k@-%OT#!(qjk``K*S|CVRMq;K`LtPz zDMAGx1o7gs{qz#}Hv0zl*4!xT@#n76pjxx}M3frsq47(Z6qv~|e^cA$aY@YabaUflUIumQ<`u+AeeXEpS?>3_IT@zd~kix7WWcO4Z3r6IZ2cuUbJTy$uSC(6g zh?rgGsTzR&?ue>yl@)WDPiNbP1usnplG;i7bYoneEF1Y(WL-^&%f+ zsIC)DL;pNFSfg3?3hvcxB#$PG8>lTCzx2Aqx#Z$pl6j`GP8%vwwkq_J4zr3KN#2@B z=g=uoTp7>dFGu)UhLd089xM=oe7sojtcY-$MrY)h?wXhKTSIs34z;w z((aiV%}ZnMqqKr@nUKd$X?k~Nr)wcjyIR#B;^WrL<&I@j6b^A%<`CLFppHU`cfsUq zXi^k2Agxyv?gxv3oLcV*8t8z_%ze1H%9CNA*E~awgXX0B!zus3-?IVND=!{$8>Bmc zzg|0baig*b{QG=H$e92m=x>9$ec)>E1;)=15?A$zuDHH2qm@H*J%76&V3x?=wy)&O z=%X_=Kc0V1et0Ec&-C;i&z$0r5y9<(*N-np&&r{I;nNb~6~I|!zfy)*1W+{&vxWFX z7D;JWauTV0{DZU9HV_zU0L zpFC+O^P^rQKe89xcl5DYsxvr>Mw3kkWjqWMZ34<6MV*=?Vtzj~N1TyKMtbY4onf#X zbK_LpXhe0^fDS2uY=9KUZWBj+SO#Yh7DdE!zL1{4;3qxC#^MD9DcjMQTUc{~Yevkb z-a`$fVySX#=M2n%#AkmUz5>;{83ZwZZSs~xA1rKOd^q(y2|p_Xz+$Ic6}O(e<~6~^ z8Y&z-=ky$sXH9YcX&xMZ(Un7qNVMvAVYYeHTx^}${-otVWrO!{)7BMOFCr2A;~uUw z02f12A|AzZ&g6%t2W+&Ta`HVx2nal-Hy<_*)^EKReXvw=D7G`vs{)=|tE(A~T))-E z4{cC!$F62iJN87BL8Y{x9_4lgX*2BC9=jGFihqP)YOs&qdlYP=5>6KP~ipvoeGvXork%eU%q zfB|Gp$}ts=P&jS8^?-=mTxv{y;&pvDbL|-i+BG8wAY$Z&Cq41FvvGe7WF= zCz?#vlP=mflVYwY2V!R|wHn7J+KetMR( zKn{o8&9){kn{A!a70=CuPw>fZv(5S+nds$Hu5wq6DAX2tZpiWzYXW@33c^|V^8#b` z4eVa!J_$B$+o2n&kX7m&#$miNa+=+9pyJV(ondRRaad%oh)#$l*DT5G%?H8Wf9l*) zs*sC`-Gvip9Dzf`8|>~_8lzROi*Aa7yo-0CI%8c<4~|qw#?9#2w-|zvd%H01;#iFV zaLkSiryo9954Q!o#GQD%TcvqAgW#N<*`ADQ-pZVXF)_jUB|eI%(h7Vc&bZV~+c8j{Mj63u)w^3kmu{5*@osJ$ftliXp&B2s$A>cdw2~I#l?LzeK<@qH3z+ z!SAl4UafNpMn=&v)tMvxn-sn8*L#)#XgN>92w`?z)ITd0UrX)4;m{*i$%23;l%Y)_5Z^YZFC{01L(Uf(6f~ zM?w{Vx>H92VwBW%teADM{zQV40B9p1+!Y2ID+p~fG^LlIpSwiNQh{6XJ^_hj@-@m< zHj?%p1okwZ_OIuW8~$eKfglS2S|08fmP5Qn{1t9EhLpdST@MCKWlZ>8`$Hme1(4QK zP2O$2)_00v0XzNDt?%N!b!b1Ks=(gP{P^|e`|X+Svc-*%P$=uy*~BLS!j~Y-s5%n| zMC3%Rg92f!CS|0B)Lu)eJq%Dt4jTln{HDbwc7NS-BGZH)-kvlnQj)X?XD`O~K#NOr z_&zXjB`25{3_eRgl9ynOK^XXX1I^G>;KTQasbrE9bjF^=J5Ub~vWF5hl=v8tV-j?z z?~nH`@T8?FP_#F`5x(AWgi6R?4?Y@^GSYNIR{&{{7QJb`I&>_CUYXp74(-0iH!yWfnc{FFf=fI z?=H9t$fg|v$t^SCBGO_B`Ze(cqHsn0{&!>F+3;HV7hs`Lo;2QcpmS3XZ}*bN6MkqB z=JVHz;ga;}-7TlVfg_n>HDmCbkI9-FsPW=>U=3b zKkSPZ_oZcEmA_Hk?|Fv?k{UnvymcWzuwC1fCokW6E2Zyv{fh6}O~}pmm;Luc=4rR* zEb0(s=QCN-?6*G8`Wacy@(!7}Vji{v`;v2A=pyO@=Msek)`Yx21Jf@)ffgBYx=ZC@ z7b_Rxu`Rc5&ouule)f9Frajy{Z9SPQYVkg*gZK4*xLIu+P{n*s;NR)D+okOG=x(fa z$|($3fM;^=uy|uNqnj_3Y$ccfv1}ztbpBWf8msh@0^}V1xhTSfeREtEpBpY>XrgD} zvCkWsV@#g2jFwqCq>1WOf5HKPFOe`_SYs}6zOubG=QOE^W&KgSzouvb4VI(-P9E{^ z^UyzNbnexZ*p4Stpa(Ihr#eIl1#SHg9VXu4hk4V*(|3bUO@XrJCA4|(IVIcTN~%SN zoH0Ts2M!WXY+4XYiuyFL8VW&tR`}RHWVCwR)rkvM1 z9!^hf%<);DkQvGg~o z?njSGmOkFqpZZj{N?V)X8aCr?-zvk(QP8C4gYirQ+2Vlvz|ziTQpNyuspQ|4rsTa!K< zXeiFv+4zKlJ&>R*_F+wQts2_{{`r$Ykt-=`otBV6A?91-=H2ZttC96A@QQ7j+aawA zmltm~4CFh=e?cyHxgC#WiM9759x-=5e^j>T`)=~wb#f>CD-imFw#``*!rL%*r<(++ z6)*DH-g6;)L9tA;Rt@I`F7TL?{wXTPf53~otr;|}PU|bX#R)RHju?Oi9H2Tjc44ey z_-A&!q7_RLxrHMeQ=>1P(zvu&*H;CeTtdD)DtA2x!%A8rJalJaf!!*zU;8FrsC)2+ zHh0h`kaJ&3Q~h3?!T%~uDl5cc5CLsuoWo>2USo5l-=BhHs2lAa6m0sc4n4BF_D}Ut zzp)rX{yZ((@oSNdx-WqSNG@22`ue*yAeQ){i}tL^WJ+^Dk#y|Fs*N$O=4*?lfpVow z+6Z#^rKJJs)RpCL^XeyMmmY#VblTgNoST(x-gI+XRb6`Gf?rXW$r?j6q2B{T=wF|E zzPp>%cnP;nYzKtbIZXk&RE{Cmiy{b$>~y1q`l^WdxLpS@qLNuWpnF0CfP@9yC}N}3 zzdy=YtB(M20;_=aF5+h&7SWZ_s?D`^er~kt zz~XHL5n|f1;DG`HZ}sbyQd9N6=;D7peYZbj%FN!q>htUx3&pBi_c(O7qG}6CJA2VO zEwiP525NNk)7^cV01Mcw>zU~msK;p~7jEe7g4!A<`mjmZ* zhSE!H_VDjVqYCx-J>zh6q5wAROB8|09DW6)zMiZ(6frkxNQNWrV0yTa0wA3 z@H6^IE5*_o;j9Mx#k0XM{uHil{!IG`(?x}SpesPEI0R2-X*mWSiCIrkOB^g_&#lk& zOO4I?x6E!Fxl^b}yAjN^5@0EQY$m8vbSSXV9fXICliKB%$T-@*QMWTE($W_UsR3sB zhuk$3dn{=paGB|F*AyPZc%SF3d9$(A@1h#r^PL~7aoyiv*E1D=w=bsv}aEk24N4G{O zELFLEJYi}4^E(AS3QQg@T$CYrQxeFo-LKylBzQ{|jd__py!9MzVdh zrq}po;o?@-@P`hkE^WSd5*Wqh!BGS6e!hzDbHYwmLj@hu;`Qn!DTE zX7x^=_&B{rS~Mr!O=bOkjpSevy!V-05Ebng((@IHuzUe~*$&6&Sx@aPAV(RTucU$S z{M0y$zDdcR(|<=!FA)C!Sm+Mx9H4=6OSqncT>KXCmB_2n5AH zj*#iSlL3avJ#2n`I1sE^Vp(S+iWLUuZJGdk^8{odr_Iw8$3^r@9h;O_UAiP(mFZ~B zhGz|^n(H6c2#j^Wg&zqf-CK3FZ6F-y68Vpj9(1m?2p+!n?G@RY4oDqA0L*cWH~}eO z5*|sV91G(!4p^Jx!as*}IWsqmdXjlDw9aHM6H!S@1=`L-hB6K^F92$HtUIaKIHy2; zXn)n?>9UenIK~U|7<)9P&kK1MTsk`L+=Wg~B;}pf7A?G3d}R`oz9JYU)#sH$1F(EZ zbKci5{+5*C{ty0EAyNqMRRm3aB{_+8&zHC+G(e={zj>|W`@+OGJo#?Ac*Gv~M`+{h zs!v;DmI-9r{gd9eq~Il6c+IBecvqlRPu^r(Jx*-3L!``|l5h3614G0&2_X?+z0lLgAr->#8Y?#!|XU4Wm@y++l0SsfZXcN}aSGgH?FA49`qKh*N%TxCstcI z2zT+vmo!2cr49vpEe$R^Tf44qx!X5wYF*c)f=IO5S==)IzKm5iUQVYVMIf|L(?(HS zncx+(i7_5KcvIHbAo#%dzYjKJ3`1>ch34M0H1jS$ol}r4q=D!M%aC*VrBfV{!(AHu$J~US#C^vhpcCo zmJ8y74ns=3ReLc|hAV1w3n8lq{ZIEO#RCpRFNV0TfzRaZIHf=dXkP6EeUMrSR!nSMrX1kfMoW0 zE_e}O^T{Djp*zm zV#MxWT(fpIONsk;aCH?S^va(I!Rlir<}(5!QFQm#T8?0qSdE%iT22SM33F+95p_<1sUy4MO{azaoPb=|1-AQv+c0F^BngEu7t2fSzxd14mR_o<8#K&0q zZ>7G=)^d!Sh-0vMZ%UY${PD9{Ls(*}AN5rm-Xq!;#`D!_JH>R@U@P}EWJ3ReY z7NmnTdUReASSPt+^fXs?(iaIni$ySvFOw3Xp?-g$9v1B5sQ_a`{#Bfo}#X^Upaap z>BZyBhGz5YBA>c`05%=WHm!YIc!cWvn6fr=?M+`-?hKQ2*Ue$(22I%=)8>pF&Y;b2 zC20Lit!giBrmz_%2j`8l$a`9MwUaJzJ$8j;B#!g15{TwDuH5hZc*Lw{f z@r_$zI$yUcxh2}IA$uHO;a;;2rkNEk=RPclZP@RI(^$Nm$ILbMb;M4Tm>NRkv*sK^ zdI>)h{yr=oo`c}8Z)^EeUQUSFtz`vV9AX8g4f`^Vk++$#fmY7+&L#tn*hI^oEZ*YQ zG)Z*Dqj?MQq@(@;|CgL@6R&AqC?U&Bffb1h^PWCzz zN({Cx5g&}I6_*1GbK^RDbhw5@MS*62@cdzg(LJR#hf z%dXo*$d~5o_qkfXhl##Sc1Po!9bIg@pJV*Ko2h0%V9PWz@~|JltXadVxu$`oLYSGC zKpX5;(BQtxdjDTgjExm5_1K}TqST%^N=l~x#Xzy35Q2^|7Mc^Nc#M_+BlK- zJYK1JMf3G?Df0!5ld~9QnnnoxD8GzJU>2W(AaO0>P>}6dx%4=9i$001vk<^-$OCIG zJ$~T?T0`8DZ`H+T)27V8rtSH4S#k9#eHIBsNc-t5f?B8N*}+Q;c#r(*=ahgCT7FafkY1k9A2~_PHb)Io2*iEBRBk|&drn8Um+kqEayAhW(`6MvQqoG z#&SIiAMi4nXp1Q+?Yw}ZyES&c1D2=SGxQ@Dc)72}RjO-z2h>0M=&04_H!)V%gUJ5* zFa+BIJ}EaeAK4N+KAJxrX2=}Q3k#-V3Vm->`LQuT{LhIQS~fs%)AywlGm{%ep_X#Q z3nHozW(WsAQK^5YPzI(4l%e2M6*cf_d+}(eU$iHjWQ~NZ;COyEG(SH~sKGetC-B)C znB4cqvKKcfJBRt3hO@DHi54qzkx5bXaGEsiv8itV=$FfoVYIsHZIq&JAQp?PN8bif z{0M1`ZtjdgO~5ih3pDg{ZmtUYQ^J7I3Ti>w{|oGyu*>5=<`A$LPO>a{)7GAh^gd7A zAkRZZ=tJwtcrk@gc)i$b>5U;4)y@GxYM#BjYB$a9zK8C&Ns@nd4~)WVhG)X+7SfJzX~0M zKG0XEds_pzNy_X0cA%wY-GPb@dzX0){2{*wg{~ElGdG!ot-deUaT`frwEpHLEu2@C zMm1-Ih+W_?yrg{3<8{4zHBk{qe!MCXRtwb)V3>9Asdr6WC_zCm#w)JC15PCjvK*Gs zKa;<_Js35Ny|@ManS&4m|0|;99E zf)S9EA&;YBv!*7cT1Bv!K7fdeJW3emM-oMNKg5J9Hkf4=U50tnHa3(MEYj+KbcLD` zNK(e*(PX9=FpRq+;D~|81)Y}3IH}4 z>`4K->Mxjst9;?o#SXiEBq|`1vm|x4bM~Q-p)9S*NAS!!;Brou!UKOJtll1HOLI`bH4>IQp%Qr(AW3Hry;^aLY+d>IrC z__X<*oF2Oh&V5ckb^h#Z`M0KG$1QIAs!14+Jkn~4;#fv$>@lN$XsW01F-AceyiqsM z6p28aNfnc?Mh>RgKmydW_AmGFuISwrinX0)%ap&9+0noaN`XOw*P}#iLHyYgNHU~v zhS*}a>7y4|WVk=_IjRqX#0kYn6Bs>j0e1@T6yKXGj~IZ^FoGytZPf>Qagw2AS*L2z zpA1gpE@7N^BuK*1Sk^t+yk8W43ZS;8)!n-dXs<|cM1>kujJO1~=Y%S)9oKq?}98Ei6? zIM-!vi1E+soKOQWJYkyHZ!sZ|Y4x914hy`nL0q=D%@rb>qj;7a$N-c_lv#*FdV$}g zk5&90#yBe|7Tc8qz_dh3BIIqqId#qJP_e+jKv#{noZ5Y^4h%%TyJ|yo{rf~IY1v#8 ziRJy4xVb~->{pIG+hxX>CD-D$o^V-C=CicA-m}LhSJkRlb$_lp*;009{${8!GAl6n z!fbhl_y_U&9by#_xd9B2utJV;kWtC~ArN6KWQGjYo%qdjhi??KdFbUVN_WQi&z6uj zaBX`x5nr*V_A0tCYrF2p@A>7zsg?T_l`S27%MJ!4snkV0 zG(T)vbe{!{htCo`Hw(bsafUE*9@-@hG?(ph65k49MzHg`{mYT1?E>D}MB>m|_J9cN zPC--7gPm}qmA+^{IUF@_P_nI=n^axlx4i`80Ql0(sMaDh-g!aepP9qsfc=`QBdc6u zFRYfYu})1N{+@Y}=S?5+xTAsNY}{X=yrk{XaA+ys$8j|?_a-Qta2QR_SYqS;8AoXq&}nZV9U;UHP;NmCLi-YRQ3`;ahg4gmEPcKwio zdrc8aKXd?CfqJAXIsyoR$I&ok56GX!~9`GG_gyF>&ic+*#Xq9 z@O)5Ez%9f-$~r&KdKU0DAuji-tg)Lc?JII^$}WN&|D)1`cd9YeSH@&mtBzPPZ^Xm8 zDRM8(LIl@32sAm)0JUjTd#n;4EHL3u%>Qijiyp)!E%~0PvxGJr>{WQZV!SGZZTgC> zOCkOd;}FEmo09u;kHg`RGKucTMIP-CW)9I3u#+9)O$D=QN=;xF!8rqV|$kkOMP@kg@~w$dY!>W@uR4v7RWtZ)-79=Z-QKHZH9QA`&NJ@NV-Ow18)< zRD;~zMk$qlSL8h-L9Dr8H%66FUH9wp(}4s9m)rw@eL5jBXGvVjgp*Kq%`8!neDD~g zED*7zT7xl4e*Nba;nONK?xRX~I+zQ9LVQLlnLc4+^kU=K5Y+h3O*7wF8mLO>T2H8O zi6=W;dmvikCE|(M{MTbcms;=S-mb1$C4sJo2G418ZsYv>kjaYTaZ|dD3xJAlLeGw6 zX0+NV$rzC=7<&1AAFZIq?5GEvoDIwCa|W<+)xa>rmzb}FCitG-hKWL9)Km-^}v}k5}==d<)+TJS8g)xO8xczxXuwpmd+I?xI_* z`y}3S9x;^e8hzjXodsJqaH53us1(EWbHyRMQ@~20pLO(eq4DcZtPBGVv0QLr}6@qKSha^z3sIQRLiEE0Y%q8H~? zY0nl3jq4I7^LRPeSfPKTsbHo9Dx{qi!*qks!y)fuW@t2~YWh-(zv=~(XvQr0ip#nj zEpXt|&Tm+y+`L*ZVz3PmyP>JipUM$RE!tRmaBoCo?}O*L*05@S1=L8vY`AQg^kLhL z4>+su&%s4FtGd&6POnYlb#2ciAM*_0$Gs7i!^I_+B`=xAveQ~8MW$49A|!b8&_Oa| zMNKR5Q2TIvN>j#jHn3tgn*V=-RUDuP}r`u9!2wVJrZHzD*kTeRv+fO1%b|q0h&6F0 zE{IX6LqX@h6{LCBRn@?BZ-H{zQu&)l_ro=rMyg+Eg?MNS(E-Fdg z-ZyFb{Hy;`eR~b(LNMRLx(G@c%zd2;?L5Ms-fIm^iG$vG9W#tUo!@~$R-&>6H&{jL%0eS|=ZraTouwQo_5?I%wn-*OAZ&B#FLiwZAl{%KpERNmjlC7mF z8^knxb;r}F$=k-kX%I&cUiT_15|FJm@2}@@egmCdfMi$pZV*J#+(0g%U0Gy0;K(#9 zg91Hr@F?_!bg)_WtApx*rC%h%PP-!;JBpp7bt}^knO86-Ef#DG)9$msI+;tb2qhOI zS1OaQ%-+0Ap}paRiyCV=(>7;cp6#*nVJ06Pn;F*(-j~lYD}TRWI1rGei8gn~&cY^^ z;9%_%1M1-1V0(Nb^|F?@J{~;>yT8xT6s&lx_`=WjPV}VO}jA~(=S9^5cHzauIkGt<@0&sb6qkI!=OkxvUas@74ih7*o)Wu+P z$x@et5}4q5Thnx$-C|r*d>G2eZUipwl}u#%ekvns)b+Txhia+WCc?gxFJ+zwO17e) z0Jz$kq-4y9fGDMR2EM`TVKdqQiS(!0SDu_0i;W%12jg}U>xc?C6IK<3JO}ygwM}&i?D-pP0^Py&Q*phFXMcQ1TjpVtc|y; zB_xRF-|H^TZWu0A zYX(4(Q*?3cij?oKv5X0QO@caip!+}ItcylZpMB9&MSx?P9+g&fdB z6V0*Gyws*$tcQip9FeJZE*jp+F&;llkTbsTg;K*Ewz3aC@m{Ms zlC-QKTm(j1pLWdH0Bp5~_BQV1U#ok%kPd3}0rp#QdP~b9&G`Cua?MXLUR(eRyV})n zcAk@_iHoC1y^LuwMoX^x8PsL;<^gfOyxvXGBdlxnx5a~18}jKGU9eTHu_4-MfB`oi zoNgHjV;*|4aeCx=VcY&^$4bR+8Z+-sE`faOu#y9VP;Xlrb}C2Jq{t16BXFB9Qyu^@ zTtfmyu%Hb%%vGg}CgSnZ;y&==Osu_nvWjw9CD+G+xihBVa6y(2d_Gwt7<}COQ~xN~ zaR9;ygLK7yC=l+xKaDS0>dKo9a7_+5+X-7K(z&wi|C+TkP2Ti6FQt!GPm$8)^_}XO zR0aCn(-6@zi75M4bnoS~{(DxilYevA-4IL5FWzn6x7(NaC68i{@@WW$By^RZo72EW zjU&YkqFq~OZe|DT7RZ=$9VU!|J^>d?RM^YUOw86RX7vngDh_rl?w4Z5B3Nm?P|dpe6C zlNND~NOdw^w#)$kxBwbP#o((bI;HcY`v;e1X=onD8pFTj#NKoJN7=lZl%;Nc z*s1Wkw|BoD;;?Bm^@=}wVD^Z+-utNiWiC2kwZwuTqCIQT2xl{0o|dwqbNH+&QQ)hd z=%M2Cxk-(u0G&lhT@1zWP#A`yTSvkrxs%3;Z0(myo#|Ru^(3bD(;8-g;BWq{*j2}n zH$xaEsYQ8v|KIQw&6G;PWDaXVGTMEn4-b&hNgL6(b|JBviz=yH*5+65Y!2$~ z7GUFYl+$Sx0mGRqj6$Z4G06Ud8Qhgui!?A3Hc+33{gT_h|0Eh6Zbx=F^;o^@wrnc7G%zls$Iiq&$03PZ15ON}>!tuI^0hYJe0ny=C7j6F9aSUUt81v3j|H@fMsv z0Drf~vT;CbOGOhoKM~&>SH~>LKO&H}UnBKG=62qd6Fy~a{C?XA+87UVsC+$8SKA*} zwdzxS7H!_6Engu?k>lbXg=*AeluP_J5h)$b=tk>HgEDkofj&(8ppH>~dREPKlVvj7 zb5^^*3)8{EF2;LP3tBZ+O8Fj=T>Hd|^t8K$KIH(pwM(;5PH{tY@H2OkEAKa;>p-2m zl8=)y=pzO`f2zy14koRMgBT6Fmq$#1KR?u54_k!Hi~_ST`y~! zJlfLv0I^ zu;EPM#B)UowO*}rWdI#DLMI@rxyVmsw{ac(kk=JWaVYje-n{NF`!*gUwUn2!#&7^D zVXrkTpdqyG&*|zf_IzH{Gsw83atB`BsCefW-fj*DeqFwDzDZqiiid=6-Yqk#sZtHe za^7FWQ`HLbfhrPPXjbnN(CjQZlvTZmUE>D>`mZNM->J+N;T zKVre4Zwt!{u!@Bdna0C4rtclWfhI@+>Q?FTGZtFXA=>m(z%x(3uvRe&RHXsS^i6mp z;fcve<3EyhJ!jzj&)J5w4!VKjTCp1&$F=;paCw2))as>&5dq<2OA^eN6I^gvL>gmw zw3A5L)s?vf3?NXGs-o>}?cQ zr`0*!tK_dnkg}xmP7mqeRYHLCv#eDMRFhkj`Khgro^x+#4`R&@(jfMa&N=XTAigL8 zM;j2SESlY%ahdS=i(nkmk3(??@IWjrKXy`1GZB_DZ9StEHRL7ELF+k}5W3cCTFG$8 z-X2#&uM}E&rpu*aA%(_kT0jms>wRP0d(Q)(t0G5w*Y)UkaG(PC5FT)u}*FO&_`L2B8E74!4?%cPke5rz|Op{wPf5rc2&9UEqbF6fY1B#@!h zV|RTD+y5lTnDzYros)$XH{Ukn@#J0eGt!v_*MGNx@nnM;JbHss6xg`Y9dp60rr!5Q zl9I%5bOJq2UCDQv?+}o@K_?4Z05K@I3yT*T(hMfrLVMS!bm2HrN5+5_hMxtta|N$r z5b~!+X#BQ@?so#TvlF*2uCW+070`{9kIbAJno)ajWR2%W<_fJX$&S|F{UwO4-xxAo zpKZ_Wn@ZO$r=Qms2d&M&-O6K(NqpQ-d_HLj3zu#^F{NIEf5vAddfdjTo<+yM=VAxxPR4g zBIc-R1xWK*X?p3&(}6!t(oF*?>yna3T^=ISPg|iR3(4UVc~%<=6j{E&1TMkk%lW)+ zGPVIZR27Z#$hza7QN1UpUasPg831|<|Fq9cV(GsBXHd`6>Ij5}F(Ww>{wAI$5>f&Fn83sZz~@leu?Ixmk6Mnc z6XZ-dAL6-9SYE_!dO;)U$e~j`X2x2@wpmg+dw~a#|+VY??_7>(6 zq2N}+%S98->tL57;F-*C5#4CDP!`TNFB}#dsv(RRhXG^51Q=2sY?!{4vH2(D?8^?Y zy}SBSPaR}-B)E+To`y1Q$j}j;4x^?sjsWY9I;E%Ur&P{;viDysMBw7&sJ~duKTYo5 zzduSz)TiqqI_TTJoA2AB$N=vO&xoySfK;&H`62W-uL zQ!Y?efbp}$L5RahUsnXF*9Oc@)6VXX^P8(1dz$^X~{B`YF{Hs|+dI=kh`{U?}Lf!U}*sRFtC0a|#Epuk|QZJ@(?T{z(=uJ8(6|H=aB^G1M_+=!3db?n|ah{ z@viWx*&Tc`zN0c+psQ^<(}(M7EI6k; z0IwUH$J5>PVxL!o#>r_Fhu165)d!4gy%>OyZpTz`w(H>jHeR-F%=g!1?1$tx$z9*K zuh18f3<8=@d#AQ+^>DXu=4bTB_wB924F^8%G}yqkIQ86)8(7xT&a&LYQd#%z$<rw_)DRvE7_Z>|tmeNw*?R%==uaRaQQ~B;y8@rWjaM(t)my7;?Yi@qjkABcLK67C zjE_{1*1E-XA5eAXO*Do=eh2d^{@QvA$;8A;;3n+dY zbG}Ad8=Ma8F8FghxDTUgP(dmNx!f+sRjOF>UM1}!!Ju*O&BeCkBT$Pw@X!iMix;mQN>$;# z@(D^xd4SvQ*}8idLlq@pX|Dd*;Rrj58%k~lYl%J#`w!2GVgOx6tXJHX0&~=N-1Aec+DvZV{^ik!Z6h4D0zc`hbuajX!(m(CJsDb z&x^+}+f*fwx2EJ-y_MW{0qF<>3%wjE|F^)JI?MNkezN=pUpUzNIH|F*Tos$ z?f|C302SvU7>+&9vkc@qu+%q)qmn6Isyg&>2zNmT!jmivZp~T6)HnayqA8~4z3BYr z2X6WYs#Wpn8>UPEa;B5mH@2L4bTT8p+biEzoeOZoIqEH*kW^+u5q0~`7g_+F&^=M(+%FOSr&_u-qIf^MM^r0O&~GpDkv2j zaYMiDm8(j=4|kJbqT;(b`m9%`FUQ_AViQNGI^|(52a0V0vd8=VttICClN#+gplC>l z-DX=bNFYYKOI_dr%Q0ez3<{9do-HN>i@hvKq7r{F{N{W|J=#83FuNU^1*9{eJ)fo7 z#Vf-dj`SJSBAalddIvV^lv8U(P3~0XbINdpx}g*%G>_&I@35uaj{^s%ad17JS&7b! zDd-L?i_ri8&MWm=`aDe`4i2|qq${g52;S5lQ$n>ziA35($EzN;Va%;#qaLMJt%0ox z|Im!wsX3p^a7P^DG)J_2F@3hp0Hhi|gdewXXu(o_8dygP{83wieT~0}GRbrWWQ4}U zi45#vfB0c?*#}BZId4=E+dBfcq}g}I)3SGRTsArZr5A?$oC}C(^CL^K*s*ujyZRh( z`97T2p@clcIiGoM`-ZV#khhE1=-ut_o7=yL=pydF+NRzSj=3!_^d{LNWbjpwcw1;^ zOwNkS?kJUE45MXwEq4_dv~oP?mVD|ExVcfC-*NrVOd0WG)GBubPwJdKcSkh|mJt?& z6m%m1l-3mU-XPock-yeKRzvn%!-bsc>5k$V6a@Te5q|{3Kk@ntHaoG2Tw^D2A!CP0)E97o)G~XXE2Z%VUtKrswK5$JD|Rmk8V1*nS(xwp2+PL zRHYnXx#wWPG||3Qh>pCyxcj-iIWsm1 z2AHN3#UJ=;`KhVvQ@`sm#badY8mg=q0HuetjXvBpdJycg=zKG;-(Ag_?rwjM3Ze2< z@03xg!#2j!t{Tu21FVLz9=F%^L0u5yz1?*K{yhG(mL`--{1pc)ml5vxZ%g4H9dZ++LtTC8I+i*l6l_VJh2l$Z!?p%w#s;T`ph~9`yF|&O z)ia zpm8p7FUAXvV~R|FK<|y(_~E`wimh${<{(iy3X|XuU+bWgIFp)!P`d~9Ht=3ZaJs17 zNa2+mV>vU)tgDL1#vbvNDFk~^%EXTKMHEMZBmIzjCI|x<=yBYIS3q!I^Su5YVS86; zXAzk+f8XYSXElSAwX}B*I=qWwD)Mmo<3`r!S)W4>hs0-X4!`&`*zk#=`4HCu7wu}t zQmi6XW z;;DKre>g#q2q6Vk`SD5>R}{v$__AYS_RM%JbPib5g{ocBGI1ley9|beA8ES*`K`=W z-3P5J@-YX^uh}E`68r?*7i`sltyH98e=b2-9FBtc&a!+1M1-!8gVaQ)oT)zJ^&7uT zgi2=4O6x$+Cs}ro$=@>K8zKV1@m8sNf4gg<8OUIkQoSn=S4zYH$Jrb-x!Rw=TF*T9 z=YM;6Z`6OzgcWBw#+b9-7mQL*>96avToLc$eiYC}>P1g^biOg|+TAX|4!CMDi!Bd- z*-eh~2%hqB@S$6Q91BM_uK)pl+{cSv)RP+9Vw}Wdekjb8 z`hXVV&te6*l^IdAw{+u@o#7n}uCVZ^>V9j|1KkuAp z`kWUkwnS^hJy?#L#|+x0tnEo8BRN*NKV{62i%o&&YAuEWt`7``8x)G%+wf$t%IlB} z;vqK=Qha!YCAEImWx=KRj+Kt+Vh!*;*(Zur&bwC;9hM$Syg(u##<2utpA0dlaB#dI z*@JI{i9|DWMaFtcmrbowa00qXEM;86&Du=ZwPNaY&&N&_F~elxCc{!RCmgFOFjyeW z%AXVW_I~ILraB6!*tfeLQ;jEfgGIrM94*btWKb-iy_4Ln8(tSljh(wIp=UV@8$xCz zlMZ zDsU&01Sm}A<>ok zyGeIZQZSVkZm3S`P#`I@)=w_#k;_-u(Xi$G(rls44q5>TR=WF`{J1@4#$|J%$34|8uxj<8}4Rz6^nGfI9L*ub|n8!H-ku_0Ih5MfnFin|& z&%XF?wRK29>}axWh2#9xfKq6@JSI6TdjpKIt2k&V7V26^w$cE-`BLYMf2fwR6~A7wqm4Dtb{98y{4hVgLcQK z_1kbvZM(@`R#NMDgA}%m$R)6qcst_jz*VZ_rxOeSVlmgm!Z)Zo#s#%aYe=-BdbX6> z`eC$$m-e3>sgDCVdP3Lu5~$`F+e3ta(@cuXtnv*Kb#ze=e3f%GAs~ z`R5#h5WjB&H3<)oBJd15PO6Tj1Pxlt|J91OTV86j4Kegy7EH_J+R9rAu@(C9ezTk& z%+TKe&YMq9{|S8O183_UdcgA+oICi^Ilh!=azr=Om8`d@cgYUb?OFGO|}~>U+s4zOU6pe06R1 z-@22q!8I`p8BiZdIGz>zpWJg{X0V`~O15#(4#7f98atIx2`!|@nbN4Wz4~jZc5WHi z+&M6qfFy!>P82=^o{T!WoZEb zVQUitM^@7;Gr@wgP!bjr@Zs+R4=H|zNb=F{#8OGb`jg-i*hJa9U6ub z)~`w9-YfOpbk@PnRNn75>kGS%IdQAp|T z2NgNh?J{pAv%4n}RR(L2c1i-T?WMYT$MQSnvBUNb#N<4+dJ7cAFU36bv;0ka3vV zo1|0bsVgb#Qk4WT26%V5e#YsGZcv_i^SQ1o>^A~OXbko=&UfL^HST0n zt(`Y=stqz{+NFfJZ=r=>{Cfj!;@VeM@T+ay4|E6)2;RuUSz_qWXU^|Su_l3 zXvV@E5yB**U`OPVJm<{5YWySgDO+yHqj4Nd5)3Yr^`npJ2~lUX9+bNlwo=>Q{|9j( z_qx`(81>bcrE<#(uf>kD|XiPt2vQngt?i2FVfN7aOuf3cT0f z$T_;{d+#+?kZfqErj>5?DbxjtVeg;e9`XKsdlYP zG$U)~vZa6EOFZ4mgNJ(nMNDr5IEwx^13a}~yRt#@&2Q~hXH=+0Vy=o&N9E0VwIrU5 zk#;bDTVBt_Li}x(E!mq)k&FcgumR`Bk$M@vw~#srpj2h_%p;19Idf}<;NyVP8G`e* zhR}ux2tihlH|g@dnar=Sgk&*sGGr^H%9)T;>Af(@hM^e5hOYoBFB;)#e)1~$SIW-?-hcZe88V@q^TEH+F~<;u-_)h&+^XO5 z)%fzB%|E7wX$koaPnBK&VWHzI)p(sRQ0rT+E3Qq&hus^Wai_LA$a-E4ab{T(POyrh zTgLasLA-^d7b}|naU1_AvB|VQ2Lo(sp%e_jp}J(ZQp&Yuo<@L@xKhi+f(%7P6)1$$ z8q+bf*txABfBk*gQC}Nq;gnkt-zQcuKT9?=$s>s{Gz9X zeM1|M)p_eC6YViMH-f}Q$;*(yH~6*W$y6v!b*KqTcP-LdBnGLyb1rX12%HS4L@Y>$ zBeu}sMrDem*&_s}3I=|HvrcvHFZB&KCzvS+vLbDJ!jMCSUT4p`{F`#x@6t^(C9OZe z!favSBKjUG5zt6l9dZJh*W+QRLe*Z#4)u{FVeDmx=W+fr%(fv)FJyKWNsB)o>MU#A@c__Y(#70kRwZ z8z_79rP2(f*#_LEsjPL{`fAUm&5kR({X0$z9z2a$=6;gZsk@Idl3Gr@i!o-e5JL_m zanFcDn)D7PWTw2&|!SJbdQ8B*v63cIZ-aENTeSc(lCY;ht* zgG+XbxBI!*_4l8~mm)al>Z%xLa>lUBA}*RN`*@l-%}UK`+w9OlwXC%C0nL z@X$)eFyKyCr>m6TPIu0L#?8cYH~E7<$Q@+!w5nca*d`NNguo3@2u~qK$0*u=CLtgl zS!;Ot1R|ks5;l%sxchdl`@?GCUzKS}o7Ayj+cp#*E#VN>l zzJx#0zSVKZ_TRVo@DX0aKi<>#{l(pNJFh$6CT~5rkQBd?_ihsbrw>7~bqBGVdO&-1 zS2TH6ixWT=WcRhJ(#|{wPJ0KP*F?&}D^I~Zp7!iIhGcbtNvO$yf6sDF>XFyl%*rT9wTMB_YTANAh_I& z!BF7M7ckr=mg#f=o#q4TXqn1aA7-axAv?99i}3I+;jx#ZMq(~k^AGC zkEBKA?1-!j>kDNKsVQmr5ZnmM-2)ND??Bs=eTM}+$>%(=9tNgxEOW|wzjd9LWW1+_ z#iS}!4v{KTLZ}XJFPBZtd~l$)Z~(AkSOn3ZA=I>j3Ib1n(V1W1W4YjmUXm)yl&oDZ z1|q7RKL)wFaX$mR!yu-A?4$nZ!;g2h%M{3MeiHbc*l@Bqi@n$mOtw**vp;~OQP(&5KNM6VAWkHPTwr>^g(&fw=U3?9HrKdIl+ z5RghKT>`_=^6uB_%XPq#yLZ63KS?)1-5yl(|Ig>(5sMgn0;BPA?N0}y#=t56W;6VH z4?10;ke=iP7^FQxDK*KZboultU!fGaWHSuD2c2zED1Y)AV5fBSV(*|1Nkqh0_m6eIM_`i;BJfMI8}C?Cv8)!(j-{Q+ zp8%YCQu1pRrV0gXyX{JmzSS{x8&I+oiM1ZU3(z?}d71My=Kg(z@BoJjIzq$b2N8mq6;d+0Ii533^0>;`XAR{`G^MFBEk_u;ehJR&PdR7v3$}&uD ziJeyZ7tS(xa)E|L$&Ia~l}pLVyGT?h@q)+=zC$n- zg>d{50<$kv148|MGxdTENYkHX{p(n~x@eU$(V&@F}dyJPCNR z16!p52lNt=j7n454_!Cv_nM5qtL`J^+N7T=Q>Z8^?U8&0BsQI&tF8{k+9vQN;v+eQ z2jrw97?K#GmwGt$tetps`JBQLHkqFW2tj7@Y|hU_?Sytp(P6+E9dC&dMj4AC5c3d( z#hxJ3CDuaTtw3g*yv#f}tF5=Z8J)7lA&_e{!W^z&klZ7SV-*J70v7Lb{YYz|3WOF-1$u;j1XuZ>jyrhB6KY=a!#Uej zgP46d&n=1f(U18G_V101{8;{eq!osOlCvkQ72cMw1)w29py>c5_DnySKr1OYeP|F! zIucetEXbaE+Xb0p`+4^dHso7iroFiy^WazE^&Xd1 zzm82ZsLv z_74P}lU#}g7XAl%Mweo9C8?h!_a-Rs3deJzPx(^~VL#9rbs?6SinAKSX-BaZ!x_(B zN8plWXUum-9Ba;pT{ko0%R-tT_IVNkQjiPYTu&f^*?)ND1TJAQKVT941Eo>_g^~Y-5&wnZ|Ak@yg+Fz0RWS`e0vgdj;2YIQAdzqSLm*k^ zhkz6g;D^CH`459@h9OSUD3l@B<|e7|^@Yj=#XK%C08-yot>W|4$O-zhu~d zNlSiYdl^`99SXnzR&3kA@DH&32Ma?#Ap9RR4E})fe=zW03Cjsl!`(i2Z?rd}lVQHiVmsi~%BX$%ddcZ^}4vtWMy+~VTh6@Vp-mp+NiL-MTV z`8(Zc(Nvt`giE~7{roabP&PxSRZxbnpq&&L+T!qc5Jb*I`<{`Q-` zJ9hDDH+}9G$vF{r^8l($s6^b}GWxRgquFL*s&n$*W}wT2fwJBSv!}R94FA41J@d#) zT*kAGm5mQ_K08no#6r#Tja6T3T=D%9}@x<$mm__0@f`V`8m%#5UX{%BdIZU8p+6H)z>Hq>zyjbZ>sVTQ< zIe6h2`Ogl`J2luqv1H8K|0luM-aj;nqSSqdq~7&>5|x*NUR#i}15z-VeD1<16M`Y7 zRu3h+fQTRS`pTbVQXqA^B&KnZV4F*41y9H;k^K9OcRx<%8@FxQeiPj zQH&pcJ12Gkc!NQRDlT{b>;VoI=hlQz);|hE98iZ|kKzV{-{}jVA=asL``CSw6UKHX3!7{n?6_b?K-^XDPOa0R3Eeiho);N*rZJ! zU-6jR8FZ@H8mLeCb(15q%KHbaE-IO~Z%HqwK&E~Q5GCMvqJ#a-@uJ?h9wk3VK_vQ> zyUsLKf?U*k88wkkyB%47YZxilaS>aN+dll$QQ*il%0zb)R%Vwk&Ye8dO#Cg5m5z|2 zcQE@K&BkR}9QzX!thyLz;z!=nra678X#Ph!tGXvk^PJ7Y>+-2!MI-aZl0y6bw`0$E zJ0Hd(;MBb&l+fbU*3bB~>REOi?aMf0rmRh|jEQobWJ;T-;;Y~Tz64(~TS0yuZyd`! zDHVb{p@)!PwT3$M11o>on=PhL&8PbvL%RC24X^X+O0@Q&?3(#A;8caTA%EH2*$qRg zhVyL?L%OE8j;!|x3hez^pqBLCtN(2hk_d_bKyVzVhUCZ)Zg+)g#nrYzei{m45vcMD}63RG0oj_9(US=2wPadPzlt>7tjgdC-i?kms$c0 z<#?7h^(iztx78WcmcxS;9907RSi2Nrdznkx2OXJ#%YDFx`g|}LNd&uKV_+;GV`QHT zUwH8IEuOmA+i*IsC(!};$q+2QQRjccJMFZK{4MfWE6u>nZ6sYE9w75(Jd4co&Ye-e zDQ;Y4US1uY^PLG9SljT$x8gfZQRT4b+DcT9H^VG*mICMW8`I&=AOvqrtA#@_`&^tL zweSSFW@YvYzYW`~??J6>*xwD)S2tL@2rI z6(#rC_I`pqle>859D}ijO`SeB{7@NWt|h`Cap#?n@DZZQ!Ew_ApvwpV`>m_egYo> z0i@F@A9To__lNo*!VW25^eQ98zo%h9wU>~v=R@uJW^T=Y1{kVV2qro+1MrebuW+#Ns zT5Gayx{g9s`JSTDIF5KXyAI>@=N^i|`Ir=~OXWIXgLY>bCAj|;8UBT7%bXPQA@V-| z!w}JCPIExyRbF5VWj$cGdqd?>pF}|jlx<%-sUgt)zgZw`j z%N`&A!`k`2A0bnjPnn>HfLAbLh7_~=LqiY)2Cd2BdzThIZH`6uTSpG;c(@yL!OY@$ z1JcINIYkoegyhgw$eFy>fq@^3FsvvhxI)p%&T+JQ4MvEUx<%>mAcWc#lL&9#RKXQ2 zJHvt@8CWD2GW%Lg`kXJZ!4Ay8M43T}m3P`ZPf5?oW zy3h@=@syAXip0O?>+qG-bWja~1-UOK@EJ2>Fi_M( zqQ$Ra7)S!opfOii>EcErZOBmKy;0LBT7exikMPj5BYz|LJ{ zqAqbn=%(&gl7cL;*%f+poeng|9lr)O&zy zr3!}_pJb)G9BPqI5$qrOgFnhZIhX-cCknt-Ac9rqPzuZA5;&(X60LCC+TID`p0ets-;*D z$h2BA#48+F(CJyk8VXMmsqN4ITbLhsQi{w-JDGZc|22I*>SiyA+F3*aY1?hE+kSZ( zzAlvjX;@4PXUh6d{&KKpJRif)8cu}q)4V4BG&tJO*$xnrcfvjk@28YzUBLWC=R9J z7p`;$4_>&2NVy^?)B(T=*jQ6WDeoGRTdriYa2;6_+8>-|o|IrSg-S1v0PAPut&^c@w zVS*BfF9rASx`!GpzB~+Hu+i8wb3rkCh5lnZF|Oz(6-6xStN^&UNSnruQdm^}IRdXg z&&oIrVa1b7|1J;{qi`^=@@z47#;UK_+zXoY!*9*|LtzVNN+%shr&=!?y)BK*sy#Y4 z?TsV%TR>Gj!2!d8xG!J1`+m`Vwl7e+-Jg^!o%Tq{w<1($I|A7{P_p*rg_sRK>1F3; zGWBMY$tV*%fE56*>G)^P>yxv!z49a}+BhHs+UC`>T#sg*&)BM!76g zWwb-V%B9x1Azf1AHs}rxL|Uo>f`sibO7T22-*#tN)%fSt-Ptg9tPI`f`H#!jECGFW z^7w5IVA25=)-Jvp=6tWTCB9;F1Fd@CQil`AKJgcHQf2pfk^(KFVbZ1YSZ)8=3a*X?Bd##oLIhfa~BM$VnE6KxIrj7W@_`r`BF#bq8Q$T)8taT zy%O70T7Eg398PMtMG;kp+ltqmUQ~^XfhuJt};2}nYhimWbHUBs*iX=8` z$!@3{zb}>0zmEj@JJ{PpFyg3tJI5A2!tjIh;&Mr5g~P*}u*v&zNdyhbsm)IT@g7k= z$~t$zFs#@>wyCx>cLHoPbPN~#^h3N7Y~{4x|y@-!yLQOWnpq2emkg~F%T;TfcBarYQgXWKB!wdS@8;&zNcw`mV>>+YXO za9T%=l0)R4O?!h3YwuJ~7|rafew?g5!=ELfTJ4)qZz?g92YAI^*ToKh1EmSAa(wx;GN{+d6YnZ{)h5DR<~iO=oJ*r12N-=oWq^>Z|y5 zu$WL=nrLHr>D2@4(QL#ZsKX*aUymdj`@(4?kQH7ZLje<2Q?An)UYf$Ts^=H$Clyza zrxYT%f4g>H{4sxufdicZL>r!=5vhC(&F^U3!T)RPE1;r`x^^jPkP?^~hVCxup@)zT zX=$XpK^Q_>N|d2XLQteb5a~u5q(M@;JG>(w-f#W?y{t8hXZG1=@8|5ZXD{aEL`(5x zfvCTmAXs(dv^XSPlCsaoUH3Eg?fO?&@*393q#DAN;wQXagUsM)da_r0AH%C+dUzp| z%(X#Puqh3O2+%aX1GmYF0Ht`FKNo3{vOCA&2n}(D;_!<^BLUUiPZ}L5!b9aRELa49tH&% z$k>@yzQ(^KHP-kcd(CK9h(|AWhd-V&CX4i`nCKM|98BoFt!h7#UdE=~36OGoiEOK%u zzK}Z(TUbCJ*X#n~+SJ7+-^|!3>gLVTX8+^(s#XsHz(A1|Oe|&Lv@3L)d7F4%+<3UT z=#TGII&P&t7ijJWQpfGTY zjgq9Eq@&wwOryKP5}%`UfJCHde!VxJI$ge!rs+-OKI(^k>RZb)R{~$3@k(S=9hIyO zX@3V>;iUEMawc$3NuEaBKhLo`{NQ`6n7NQQ{S<}XCZS5e;RE*6`E9@iSC;B!E9Xa0 z@(aJ}lPbD|l~(iB===s>10|CHHjR1PPbPL*^_SyywFETGZv}ExJe3A)8^e>n?~Xgi zsBSem_`&wKM%@SKC-j6GrOx`)XVoj;(EP-1aT-pl1n;&sJ~flbI!zB*!kf3PymQXm zo85O1NY}CMs=or#Y_Yj9?)Bds9MlSZL*?|Dta}ctf>5#12&VPVQik`)nICY@i zjIt`k>*cz{*z?>Oi0BMA?~EaS1k@@M&u-CPK=gNpq;P;`DPxK&p;>X~wDAnVjXAA^ z9St*zEUfM=2E6t2Gs}3ZY`@?~?F6T+|@t4zF09NAsw?Lb@ysx`6mV@fvZs=_t7wIf}(v@>$s zWlgoYEl&B4h$qDw(*4dVokT;qrvc|P>wBCr&>Mzoyv;%-IPrJHxwd@3`FW_~u2!l* z)a3d6r*sVgiZ1gzqO0}d9qmQErG^PX^1ZxcGAQ@Kqh$p z+2Vl3smc-ig7FHw`O`tA;*2kzgO2Y9aqKdO^1K?>rV67sI-jc5l@zhfuWZVS!jTyG zc)UxoM3*s%uC%kSlVRQRC=DOTO=}X67#d#7Tck7)AxYy_ptVpQU@W#~_;*=h-|iLx ziH>@H(L4{Q9zjPFtt6Jo3H^mmiW^U!F6|J-jSeSceuO^=J&6E2`eJk$EVtZPyQ-ts zY0KbHAO%8$+NAQ$a#&FLLE#u8&XL3v*H$uAOwx6zkwjhWAu!9dr#c_vU^*Vfoe_+I}AdLFJ4g8x}pKiRH{RPV{WC*zlqNYXW zl~V5amJhAP-5k%Sk0h9^rkq<_Xze}6r$V!>?xWm%tMzSC&%MC$@3-s4s=Xa?XFolX1c z^4k+1YuTyFpgYK=$7ChzN0I4Q&V@YI$TJgBnXJDX;+yRC2V$U!GBU-g^_hHkL!)Df|xqVFx6B)d_>hum4E4JG|Q}&tBTlUWKw<*pQ z2E|U=4f1@ppKewK(I=~#!;dT#VO`-OhQku#nwh1fAJ#th$bIY>oQydIf6RXQsk5)W z>oZffTZ17dobs8gKhgWCUKbIPqr1Al*K`Okl0Dz|5EsvgdbX`a_ik#tQHy5$aQ&6G z#<3}|QsYH8{AC;B$j-l)uq{}CrZz>7R<_R@khjHC@J+6f(2R#1UCu(i1*AG+Nf+m# zp|qF5Z*FN7+h7)Rm`ArCiTG(rw-DPPTZ^1u5tFnd-G!>67pYNAMCjg}y*p-Ulqj-l zY3k&Fs1-Sg-M)HmZC^cBhxSax2RE>u%yQ$+E8LwlN7+23SC6>_yg}-UbOE7O-{hzH z8{q=&09`bevI$anVmp8i*{!ao9k7TD6CN*30YOMqz%F`8K}F=NCPdL35__DtDYO)b z?@6Rp2k6Z#YG*b=^4pQAVK`GAj(;!8rfRxsclG^7VbZjJE29y}YJ=T!-ei*P?R)uM zH!=9+)AF}j8wYAF>#TF%%_C$@^sMKkpEo2kIyLrdkITO^#HzttrPsCO0t}X5I{t{0 z-wd7wy%e@`FQoaSz*y8QMs_KG&U4X}%Jm$waY-sn;dzZ$GBHSf>>s>yEFNHbL|q?4 z^sQxO87A-@V@>~PkXjm$L7RJ365xb8bSx)506IZ^z;LSL{HUw~Rf0+-`MJrB zLOds8uj?zhqTdlk;()V~sU+h+uz193r{v0ajYNBZ36(<#4obDOWH#5nViegUVGMAN zxoVNVh!^ceyCOl~M%g+oRFONwM$9CZ%yf<or(1Z%sM9C&>NB@lcUU4d46?bK}TscNQBV@rC;LrtSp0>qfb`Y9fIHFkoBWTE5{_ zHT)nq!{as+Q`Lrlqxw8N^n;3Fl+dGLr`ku@S4Q>`*HJ>%8TP1T?uD^Iq2X=#gJLoA zQCZ&REtL74U)G4t6uTmTclw4c2yw{t^BZ&%cDs$n6= zC-s7C{W1*+YXL&?8V2r^*`i3}O_=<#$;~#^4md;Ja!RF`w${l}7ax&HgcwpS@%@?X zX3kMeY$T=`Yx5nj-n74kSD}mJ%Ap6X9O&BtJCnKs+7e z^0-rYYtf8BNBCaoF-#6KCV3#zhub_y-=^A(5d%jzr71=_kGmNOxyJU9ivUFAN9Sc& zVGtf_l6Al6d)DEtC;ib;18yggk4oCp*8Z>?KchXj^kVOF@x+!s>|?PNaV39f=?c9(LQ_~1W6V!~-b7or)hGorNIf6>GQ;7` zfD=2c$(s@F?#Zf0{UlWE_2buXewjWhjg3bfUD*3#Vn9uGqwR}bjE=PvvX~{c?1>cw zMc1Lue>*XG$ME-JsbBksFjc%fg7y_2AFcKgMt33M*%h7rv)iP;1^8;3zG3`wlXNQBEQ@fO|e*^R3Pt& zSpy;|ZD;r-BMw~Ta#8mz5TxocJG;|&)F@b1#bX8+d|5jOb z{{i3?23(nR{n?I!T`ym%X#gB#h%drMsOcto3y=X+FfdFFBzUbao_#W%EeqVi-=1e} zrWks!8(`wQBOHxXky^;@ym0| z3z8ronlte1prgec(zf_1KXSwhvd3h=ULsOcSEA!r!S)qz{I+1Ej+$@7`JFmSckCrr zCSgRWrPIekn4j|4r3iMQnCPE49BRG#@mAhpq-{GpFe`R8PTty;xxR;&weYUu1`Qe` zqr-5JN2ckc$6SKA^XUnI8<)OZNO>alXuucQbGvIcbl^YARgue0x&4!KCixXwwHK5Z~s)^OPT{9?ed@`Tmk&wU(oe zjks2$N4X41$&bO@#VDgsl8AyFQ{M&I^ykBfWHFRWBt2X6(ey+aOE*68F@h^*Z!zKG z?>WAn6z>EnJxTad{|?EazW`0vkn=sY$dcxx5*$v3mKj%Dh{?R`W?Of`?sPRsd^by@ zacP`WuSUsuH(7ty-QLiv203f6vHj6pYsjo~>+a_#1B>`AnBtO$DBkC#1WHdbknHAR zT3=$789kEnLMVVF*9@l@PbLtnb+kXqy-MX0wd?4M2Dk^b$hG431&e70K7PkXzkwC= z(vudD=_RU@%zFd&C%D_GztO62vuMfO7vG)inn!J?pS|V zJI;KEK?&i z9rn0=P;}C~bBnHxx}y=3IiHW0n%2dW)C2=`D#fo8m@p|wsBWvtfJZu1(LpK4FHX_A zzU*qb-x6uZP8(tV$nmHljUtD5NS|y$8O?xVQas_r6DUc@iPuiTHAc-D({G^xqaa9N zM}}W9;<*i~3VsXfWa2?K)BdG<#ZFV8K^#;(?J5;!Er*dmgzYj-i~JT~X4CQvo9o@U z2pN2W6p3-MqXmV&!zWQWKwgB}rGgK!EA0`N8L4D(c}qdhYpmyROahw_vGJeEPm6ch!FaOn_fFma$U@LVUbH1GdJLo zRELCI1clwDa5ehSMuqrF#t3#Tx1?8+I==5zrD*{K9uJ_Vfbji)Jj0o`C2T?BJO()sa)a-V^qmL~ zs0Z6r>M?`LX%D8|G~S^x($89qKgHHG1nN*SSxE)E3)KFzOY>mQ4vqU@*Q$$ zW8KbD)K*(%DC4Ils|aO1!~VhdbqGT8lMU57+=DjO(;DwYt6)2(oc7k!Qa2M_l`=w~ zzFI}Fh6p5s1*U(niw=2W%5@Y~(v9sE?~GTk_{_IdYxyj6Rnskra_>$(3Q|=T4IbK6 z79DNHQxQeEl`90Vg@RJOPTsc1s)&wuB3k^PHS+8Z6z{ZEyBC%>*~%B~p%;Qb*qj%F z#WY@|cnw?Dzyx;_uG+*OAT zcU8ADHs;z!EYhqh!Mtl<{Op?F{oH7n?hT&y1_OQS>JFS7mgk4N8VeH7iF6hme|!T? z`wDWOIGJtE_l-BcFZGtO*q57JC>>}rob|7JdI58?JoL0bn(tWOp8LJMu+B3= z`N*q}jSGD=CK9nUPZ252cayTXYAdiOFr+3(72|o@Ga_lo$B4nLj^r?bvxc1a!V9ot zajxA%^CvZw*VFG-nAql2WKuJzuE%mm=re9EDGm2%E0^=QsDTiw*6SC$RhwaKn%(5j;S8OX5(>Sz5c0YMluj>mz&hJL4L`KVD z0<9fS+@`W=)YV8o_N3uoTj3g4On_l$R=9Sq?jrk)g6SLMo=stHe5@={F)GgeDJGg6yF z#ih;$Hm6aZI1Xn}hpwMkhQ`#{s3t&Hmf@zO8PrK#P@b7W;a-NXFh+m+#m4Pxgl@9w zLpNS<Y{Wt9!^B5Lu_qw%kxOol0Nix3G@yN9L~&hyLXA zK9o7oYrepJxrfWBVj50F9m>RQdnfr@4YB4fU?=sv&rSfWtJ3;x86(JW@M1M~x7U4F zVrV>eq%}UbI3_GW&P+n8Tw`{I&+#y2CA`*pbUCs6v(u|S#=&<5y|ZZGE3}MieqYpF z38`U-*H`Q1<%)B_W>#?w6_QiMN|Im=(@>2lL`x8gArV%{NqPndyG3i2bMzak?zD&l zU1TZ7$Wy|q&ZL%@+FM#P(p2aT zPJhePo_6RDg^WGYe^z9T=~cqxD;?WAMvN&johFt$NzWVN;ePZwEvbiEbGJ9iY|>}G zBuoD_d*K)#n#f3=ST5<>CKg(@oo1GL5>czfbfFk5SAc={wd{u@%PAqs=Fir5)GM1O zxX7x!Y-%6%ef>~^i>BW*jen7KQR8P<`)C%GlWnP=g^Sv~J#{)jVJVuKMKc^#yM|T6 zp{7QCp}lhS8VJX{>zzbMI1_2;)8I_)GlxFmkYkKg4Fq48x52*BcmoK&Vn5mtY#2je z{&`Wp(kjYmxAdSSN1T&><9hq)Dn0^yov9A5T#LAuLw88qzpyruJw^S!u!=vlWDaLF zNpDGV!#zHv%lP{l78RSM354~opr{-vSp;QMx7Y@5(q|Cgjw;#|T@)xDdj;BJBY{2r zoB7f2uuv8|xH4bE=$bu72}W;6(G=LwoB18%iE`k^GXP#JMgoJ&0$YEN-|*&H0PnME zr=|R>0>UapK&1X!Pso<+L0ISijIeGSiLmZzUzlnFtazt7M6iP%Xp4JCjM*GzBI1Y^ zdoyYqs&KBf{ZfUlnctiT4w?l3F+fGZCP1DnxY#U!9A+Ts0=z6BoJAN9Ry|j;Sjv_> zz(aJq5Ij^W!lRkyDm4^EypIHU`h_DET@~;wsZk$THhTc~HW3s~5EOJOK6*4)BL$^R z?cR=NQD!AjzP%mAlS|x#J8>r<=!pFo%PQ2d+kzLWm>tziCf$sZFEL@dq?w3dZOC#q zdl1dA1lo>%%QQ(tk(8fb;ED}~g|r~NGyPiZ;mYKH?a|DSJle;lGW!9|27ZkQ2n_4B zPN3}!CD_j%5zSkykcAdRGy{kc(L_SHMw7!q1Tz-@dw~fs6p`twXG%S`+m=NPX&FIeKFxL=F2`Pg$kawem_q-cwK*@tRY6jS z$(o@?Ojd(FY^;YXR!X4YV4jNuDTmR^zqz_7f+;@&F(siI`PT&?-27mZ znWQ9`+VPU0r?SNRl%$`J(pFQtkR+sn#wf-Vg_uMNlZI7Ym6O(YDaO)+qnYPX395Gc+u#0YSjJvTR}P}OfP@N@%AH}$DXKupN{h4>n_nq` ztUTvma0DlKVp{`4OqoOrlepEqm6>R=f2SbQShz6z*+9*nW=3JR&1Jnc+Us76x@M(}W8Nl@Phx>a>*7wImUIkSCO6!}lPM7C(OvB{$?v92 zM+!Gx0DxewK%qjy|CAL^Ws8<<$)(=7P5!wt@R;pyL{L0YixMq>6`2TkzdaD{?y%4n zTM&+5#N8e<1aHA(4K-seJh3VF1q4A1^$rb1%}crHSJqyNs*J=4&#iW?2Vy*wa869f z1kdg!qFm5S^URx)Y{qS(quL_E)`jzNPrrAxE6X-My{^=GW@XKBKU1|`bV4FC-0y8f zLsQJm%E~TcbE)g0*IJ<}NQO_|bA}sOUt)M&0@+(o{Wd}A>@0t`RZYl$q*sJTJ8wNd zYP)-Q>$OySRv#$pYE)#l*y5Qf5Tw1~X}@37jXW3iXJ+NkZck{YKnP4ue5YC}-@n4J zp#rk7gikR|Y3;)FWru$UBvdtqp0G9Ov^I2BA8zPh4axe2|7s>GrO2;_I8p7$-g{~4 z>>^Cm&C!3ZEmOFTSbk)nDN`r`9e?kP(kVWs9z<2wEi?BXF6xRKdovf+u5j*A=jrKx z)A>TE5wf@JG&di0AqaEvVZx`GSeswi*mVVZubiG;ylFi0XNt>B+z@po-~7H`JLnvb z@fGL1t~+=x7FCS!4?5>T2Ti_6>#Tq4E&i(0%~IeWSKX`wMmpOi9B1B?1i?AP^Ykpv z+y7izHh^5g~~;KAu?jVeGfP6_GwRR%4?2eC7FubV#ic2QaFJ$-Ub| zHM8zhe?o=xY$;HG%*0=Lp!yd#a$hiY0vsttktk)Y!U$Dz-BogGN!Q?d>&WPBfxcLL z4!7ZmaL`1BSk}J3iK9SzN^;S0T#C%l%h_Kp-*KM~#h$^=(^s|(n$BTW1!s}-W9)`d zyb4yG?)IxcCUFxd^;oDQ{()gNThF52IZ)FF(>vA~cuwqDHNs1}drXPdBc)zd&&d3_ zj{6~xBGeU85~1@o2;zLR&V%^l;=|TwaD%?RhNBpBZ&oS2$Iq;$$|%zLwqu**nqN2= zv;FTWr-{m7g$C0Kk!jM444F&Je>Q`1p&vGq z0%P8M4L;awgV&Q0XN+#ua(Vj&VL7kp4SXc`tne1gcWuqFNnV)~Vn|@`Nzk|iyvzkX zm+ep@54+q(EGgVlkoKC8nhwEV;t9pcB_#Z!bWSckLMPXr@dzPRT+6Y|$) zBtKMnV8NjA*yEfPNdb@y8~ao`Ypo&a#!4d^mCbXryX7z6g7*8K!HkDK8X?y4^rSU5 z41o*#E|#iD#U$(`nXuo_pH83(t$yJQ(D8D8;lc9=2knx@ZlbC{h%n<~oS*SGzOnW0 z&|IXE)oM{%TjKXC7V#0>%amcJv!*Nej`~vjWfw3=da}G5-Gj&B9s{T7YCl zqlEPEtH%&Yd_h}*tep!2E6aT-3E!RS@^AUx1H(insQCIYOT%I1&dW+r@Xzjzp*g08 zKSF+}>Po0+*hol7m`GngK@HvpA0bhH+Mh+Wh=znzf&-^{ zLrzu)-vb<>-K)Gg25jB~pA*2Fzn~7|6mW}y`L~xz{*euwD~6m5-Xjadg>&5kTJKel zZvp%FVC@dDao=a?58&f}eEVSn5AQ`zSil_Qdqju> znvd=+ePagl-h)GCpwK;FX93FG12-0+#y#j_0jk^sQq~8F9V<}lUedw})V&8lHlX%B zaAkYY>0|>wzn6g7AC%qMftvS{9(JJGe|m8M_3nWu$AeBk2hiwV!paGJb`QKcfd=y4A7~i;17CQ7X7@To zd=K7D_#Vby#s^ftZ$jaJux!NtFyt!!|0pLv1*+bwX#4|tPak?8{R7eh4+BjRc%XA8 z@IYBh@F8+Vg21Qub`}MJlJ|gC=)n$RBaGs`>k_-0R`@XfG`kx4+4dO()XbK zp9Dwbp-Jl>NdE^`L>@Tvi#|-dpXh^f+dqIU283e$&C7<&#|E`?!@b{WF`)cCpo2V^vWGlSDu+A-m_+=c$><-*{|9#d0e%S}2jdj(E(>J7 zca$Xy1fgKu!W(5D2I}xsI5#H)H%4^ob20sougIHB;uD4xtXX5^37PMa^gKY+|4uo-EU=vWJ@hyb_&&FKoUcHP_iBLYqk#MG@i@`Ip#Lt6 zpGiO{nD-0gEa7QX3>E^S7!6Do4a5b<^Wh`ZkE8${7129YJ@s#3|9|PuOMyE7)n1_zDE(d< za7q<$_nr7_^?#t=wg#94cxRd^q!_)2fq;2aM!eJ2j=|5C42E==x8F+Xaxb=RpdItFCKS_>r zK$Uk%-E;rbRyO}%>A*4G2PjB_A^i96Nat>aH=#jh%$%jk)2?;SJOc!OV$0u0~S>KY4YkSrt3Q((=^Q zl=}3)x7W$lpYHi9^{Y28C-tw3r>}CSZ7*G*=jqprl=7mDM9^?Xo1VFbfB((>qR`9v zDd;r}^wuti8DcN4EWXYyZY^%aJFK+cpS~W~gI<+h?{7i3heA*5ZO=Doud}N!>myAo zuMcfEYb^ecw{5SxAacXz!{;Ub-B)*}(R-4(Ft?QtYj6&&%a+qrLTHg)-omUtmsz)# zk;|Y@7HJ0lcT*HCB(Y!v&0m+cmrD!-m%gA&1}L2Uqqw(hZEtDs7GE#MKu=vl&yzwQ z3Jy1UU+Wk(S0gJ?`o{?U&GhCK*RP8=58|e&_zhR+Q;*g}j;oiQN5ce> zr=7Ov`ju4fy_S)|Di3l$jZ=70(CfNZ@#c<~@GB-IxmwfMC|b{YEBDj*Vxs1=T^-Bd z?&C@th%cezrT$2{#cQ>=U+9@$2v?82?`<4x__DOfzF{m4tjyCNJ_F`HK_BNqE&|cy z#}zA2?+2r<{*(H?>soIIK?8l6M<~$j5<)fh zai#sVtbb!ZCd%KmN+bl5!Jh=&a`Pq(9I3_^wp%p_{<@vuK><#&uNu@Sh7Sv%-(Ary zm?=Paw###Fj7?Zr^4Zj5`yhYJ{!5*D5;YP^i#d~wzO7nPty;HxN(zCMq2~Yl_3U@c zifLuzQNbRvp{f2&VcFVhM(h?_&Mhws!nV+MG=o3+QQJVqiH`?J?1o7E6*g<@lV|2;vzn3|%UKyg#ok!U$it zg6AlFrpdQLTmdAXm!h13B=y{>;zaoHyFk&rm$W*x_@d$Eu7ieYYvf0Pp~%>}5qqJx zdg-oNc(O2$WCpJqW_C+)hq;W6*!zE{n1UUUc(>@BY&) zHOg8!`qm{FETZN%dHF@yYe4XOg~S|skg4GTWYqF*e3<^v-{jKmxeu>%8_Z^hFoLR? zN52#b-rFn-S*C61F5g-hoiuAa&317G4$0#bb97qpWtY~f8HshC*V!;ew zEM*|a`0ta0TvyZ3Ir_|0uRDIkEkAeeZ+g?-salSG1c_zbQP1bwZOl@H1b>bRrlaZW zK<2AoM(ds$Y4hp1K4a*JK0Iv9R`uY+>Cb-DkigLkuR}PxBZIHNM z*q_4rdLb7)ZyYoH(r2qZNMOi(tb#4JZn^8`lrD@^5FRMSu%D5m)vWH-i09X~PyFlN z&iBruXdXO~2g7F` zzWj{`*}9^U@P-6>rG*G1@2#qbVdG|ViwICxlpF{b5J_noniSf_5i%4(V4m^fW>j6f zWW-Vt1FHCL@GwQ6yvC-U_^&f$aYxlV?iU5;V=P=zhX;pINrDy0JX2A=0xx(p4HwD!eoU?FjtfXNX>$Z$GwMbLVz^BxoQ)b-&E* zSzsMBd|sDcAvSC|eHJtDA1oyHT7A53?3e9QTMs`o;dw$gkao{mxfRT=`Z>~NAKj8- z#PWMC3h%}wwi%ddg`(UHOKSp!RSk$-5MIa8#cPkj6tWM_DmVp9@#f(+@2iPdaV5^!6t+#)2lS$%XE8PdvU9{&vF9s5;P#YzB+IRl8TV2W4_a>}Wy4?F&nNav=3#b6 z5f*~Xz1dP`)LFbxI1g-Vh`&(6>N;^P$mVbbR_0A&kv))6T%#+tgI~tX6{sZJSsTIb z8Uj~Ra`G<%b|*_*9>2I)tK;I+MV51gQkzP5j2N`Xn~4@(gQZ%2Tk0c!ukJ&R#AX`?!g;(7 zotSr`woL$;@_TNh#q=EuZc5MvU(z2wR9{M2x@)0zUyy$bF)%xPz!D)H6u{h^Kk_So z`NEUZf^>~E$6aN4_kC}17THM_bXZ!cBtNw_Db_-B1vQQF(8I?vM6t);J1WMwWrQRy zhWac_*4K)@at7wq7|wFc6Mx~id`>)Ls=WU(zC+;aYHde6I?r(!HD`{ZM_sq5)=}m@ zf0H;DUm!kXZNkBp7vaZ-)4eF}l$V;Ap_I*Z0TYcB%OVoxT|`t zy|2`%Gl#p&@jSgP+}ePS6xz7FT^VzNGgHVvKz%4v#^UV!dy1gob@E((C!G{AVA%4W zylrwTrN%!0(iiZLfXCPe@WGn*pK#V$pWd~ zg#aRqabC!Tcc;I-MD(T2L%>4&ho%L5guw{pctmdZ?0&(GW2+_yA;a5h)hM*5d<}0; z@q;yL{y8aR4ZI!VW0mck-?~yFUm;YcyxA}{LO#TM{vZTf=guFRiRbr=BTnt6TnaS;w>#sNngk{bd2Y-*dr`vcs(1;C5Ge zoa*%_u!*?5bea@F7=b*msF)|d>_5eik%IF;jB@xBn)-XCkWf=5 zf3%tXld5{gjeCyRqfY}nhBd2?1&mo2zZig*Zh=4$-m+aN*`lMCEmtFvVLpV#1P@9Q2~0#=G#3mWqW#C%(;} zj+EiS=~t9^aD)_dvwbW&Q#k(ev_I!Kg+31*9W`-7)@0{@ofRCn+ObwIjopT|;<&BJ zQurwc0)Q{i&mbUlJt6cHMo)d=FZ*L#!v||N1v^plwTC(!5v2t1N1~t-2I)`ZFj)N{ zE#Lmg2LphplF~j0?9V?kJQ^p~O20OBTkog~Mb;>tmQ+h{y!bHYvj#LySe<#pxoC|dkVvi*w)zPJMtgM6Zce-vp-5@7fWC5zx_7CbcQ zOciiZdH?K9#~WNX2s4$A>kVe;mKaTAq3*lf)v{I&Ic22+zA{jv2kjn+><`9j7^l#KHbMNRy{ zLZ%I(`2Jg^g$~gFo^i;8l1DTrf`!0_bCb5I79^Q84iV#S%4}UiF&}g0qUj}1@;IbT zl#Ab8q|_89Jz{m6w7{rPtvmAaw?@2%uhf!i;g1XLPqQ7rk3{9Y9%|#1-yJr3$P6wE zsE^g-Aty_ji#lEsza`Eshg!4LcT{#Vw8qUyQ$J~sn7nfHF`1zm=oklmXxOS?{A1`C|EyKA|2eY*uH+ zvbCZf$iur!---xQ)<#Sv3llI9GG;7|P{(lUEpwHG4WCPXA^Y&mSuIV17wa+g6r8ts z*P3NZz{;0s`@w>uF_sLBVH2x15G{>%UUm+0Q${44Ba8UzEp79GE<`v@n+r9Z)H$s) zLC7U{;v&p|Y_AvAD*g|>-?@YH2yLWcr*6j^ohGZ1Yc95Y%1Di11~ z?Xyxi_v%$to^++=Y}wk7BJ=OPl+gmm#So#7C`wgws{-+P0huGN$ZZuL@+?Z;W`~RP zSVI)tITq!$gdDOxWjn4cpg>9_lLu4tgSF^OlQfNhEiY|UucgS&$5vEXa%g@^HDxpz zJMtcMtH}f`^4mfp3{EM0raNP9WP zu6g8TQr=yk>XQlGOGS5lIggZTG!)~+`Lz}S&?HjY@-qR=XYeSuwEeSz7N-O(;9gxv zrGW9yUBE?+XoA-8W_VD%7O2o?q)3rPqiU*zEo*VNFMy7=RDN?KZFOLXO#mv6GrJI_ zNTB^eq2uZNtIA?KNHCEOB|KD;-7hOa`df5D^t80=XKQWMC;^vj{#2JEk%J<>svr5d z1`EqY!K$W)FC4v}^Ca{JN!=>E#BJ(N?ptakW#Y5X^{bP`r&LcwT|!l){TNy7txDI$ zd55bCs(EHJ7?NZ9^OUlFUe!1>GtVFH}=b(o;`>tqzeF1GCwC~D(uf~t2zUSC% z9A^Uxgpai_k7p=zVZEZHM}5zsOR0($HdBteo@kYvp&{{Ov@-eft9!TK64IxQ$>lM~ zFR#rNVh)8$_#v~6Zd4#})bG^Sck2{E;D~5JGE8RjiD3T)TYMMgq9p*->s)b*0J#0G zi6#|f2_D?P9;b%f$|#%8oBK3W#mYMOVMINfLHz<`!y{ z;pTaCB)1T;EQV3B;sEKM7U2jx=~@;gswL}m`f%LBXvX_?I!hrfW2vIQ{2d|+(WXb z@N(ZYerfB=e=NQj=d%MmA~0*?FlP7lRt(nnxx^cHMBTL*NL=knwGiU_UK{951AjiB zOP@A>co{t{|xQ9B~9T{sHHH$Gd@T(x6< zJX8>jh!jm9G^6)Ry~R`IU z`~hP0qPn}QyZqLMb-l*UDrYzzk`WY9`ISr)@rrJ38#O!`1hd9bp3EnkVhrc|K`fi4 z+c8L4)bC|whL59JypKz1f{L$NTR<6$Tl(5|f zKhqTYoCC6nyzP2AL?=HW!~+v&faW+b*$+C@$o#p6k@K6Cx_gW+uH#1_?+3yweSkq;_8 z-~P$L{4M`kbm}7f%GsOJrzspHLocOB&7eM@u*`y0OWHUJ-R&9co`f zUwVZwkri5$-%Y&FF2*i_XWd%Ch@>a4E%C>cQ=gs}fB@AGG%-RVgxT1e3OFVM&I2hS zP-=NTrJhFLh4+Lj@vbf22ATM5Nfa|ARX0CXys3+UIS>y2atoIK`D5fhmx{baia8O1 zXDg@|0qN z<+`@daY*IYJ%}$3N{P!=1I2N0Cbw6G1(6ymRhFqZxB$c__-Ef{Gq7(} zmH@Yj05^&KMVQ9}nEjhE7l$a`o)5|4=&FoZ@ib{j7_0LUh0)Q`E_)oFub?~UUtsy) z^kEk2K2IWK<~=7O)6b`BrB}0rv?#r`IBw~bnWavfAA?f_XP*K3k~Oof$!&8zpx}-H zG=dMThKgIJhB?3+BMMH&#RnUR4U>QrMl&VYXk6=orr$&3b8!WBUt7T85#AA?FV$62FY>0Fvnofb8CgfNDuy>=JJKkPbJa)9BBifz(^z0L>&` zW#U#Wf8t5Q_?^vfIsbGn4wcUE3Y{^L%TS7FK?>64OK%@nH!4@oVjr$o94rE%-G+!L ztNI_#LroUfexODpY>53CkG9l6Wi5?c{XngrszZnbIVwpAR|C@yn}UJ{J!m;1bs`yZ zNW*?rPDNA$r5X7-uKub4n|*HJq>^h+hNbAU0(n`jY1J}(+OgU}Hoq>V+h!K)k6>z5 z@|<#;nTy#1mQ(SrOJ3V5C-$&p9xY%|VN)?IB)AGXZRpVXLD#vZGLm_k{15VeU~bD2 zP}HQ-H6D0DuS`3}Nm9v93nD*)J@chFjg$P9weN1Z#m>$a#2s1_KX>%8wLBUU0eBEf zj=Z?@+8OQA%?Ky&*riUxMeoUiE9xdZ(;Mf<{`bkZ|EJi8*`kwT{Z?hBYp9{n6W7=0 zsI&N@JK$r54X5)He)SL9n%~U@H!*UpI!?#9wI&1|UlyZZ*zOBKlpq)J5L-4s1t-V3 zn8&ykMa#i2SK8mGP-p}Mwr;P%4LswJbcQYwC)Y3TZhmt(O1De8lu6npLYUS2XX6a0 zE!SnV+%202O7{<{*Wvy~^m-ph>hvziX~gcI9emoB1-710O6yF@a$FIBsJ%l)^{r)* zZlLe4>RY?@T^$>-tDrIq(539;rN=368g(stv4m=xw}_0@jIv}cgCd{tfu7_j^ldF( z-6c(y?JUGczrOa`5JcCc1;{9;u0R*+*a-z0{+G5b3hFsO8ldo}+nTdKFvW82t-`uB z{_75N0o>$uBkoCeDD{(=%vyL8tS^be(5!PTH|6)vO||K!0ig4&4UW9vh9RB`1^>%9 z@$_+hr_DSLi&0HxhmUM7gKGpHz$yIPS5*Nbr571Rx zpe95tedWrDumv6G%Xi<@isUn+dAU;xx)0qQTd{uTn%{neJFunusUU^hvTvikANEHo zqMPTK$7KVJ!0Lp%B(CEMy?mwQ!zu*i6SMW6+NlL@bobw`u{i{mWfX;OG!KBsLbc*tMu8Ikgji<)nG;Z0RHMBi?8s3=&OW!f))==;pX&crjXEXYHMsj2bG zr4l(AS}eId%41r2Gh{<5h7YlcDq-zOEG1gg`-R-~xHoWPa&^lV?js>G40D7&=>#X= z7ptoM^adDETAjqC%$M4=#Zt1bfs-6lyT4n?7iMJLQ&#)IMb)q#d?fV}KYV^u#j}qi zA;vlrcllSGyH~*^nRUBnkr0Gqf40N?#;}Q_XLCmya($0Fdt}#Jpy+f4w4opzCl*|- zIvwqFDd0^=U@ji=|(GRP@G!}MObA9%`UcIa^ z_sn+K)^|#iw&sA9bREh;9xAjRB+RPwmspXOZ+8IJnsgX%e148SS<+j z9dKKw-dy~)cwgD^O9$sJer;UwFKp zZel53<+kOkJeC4O4_#_kya7QjZdTUOLA3|<14|;?M|;MyQ*xfinJj5lp~^5(XN=kw z5T%1u(8S*q#XEDFSon_pI!KTG@?kJ^ zgVSx4MFb}Jbr&2^hu18GgZ|Kc!d7>zo2@eAggt?kwG60j!-skFVr1qYJiMu`l5szs309nN%18s9J2HN!FaE*TEtc6fR<-(v6TjTea z^CD^BKHRPU)WU9GMl@?uh|XXh|Go&ETvWn`E>a+VWK<6=EE+;&&+n4{L26h!`{lgI zAX{6#xPfN!k$#AsjCt_L{JcVq7(ggWZloiMku_R_lp@^=AFVT*_DSbR*4;PY5u|fu zVO}>VHy(jFpy0%#&vJV^_(Kv_LhVrH#7HC>pVQp)N2R?5#7}-#m>#yEd4|vcchHs! zjBY1F@BZ$y&FK!WF^jCnBE*f!R)*Yh?gE8~G%e}{%-=G}iA&iwQ>+A`V0*_1^IyE1 z2LTKtOip*J`l zoq!LL(GYT3ZqW@EG$HnZ6&TN#tN-g~M+;Teopo3GCzmz>pL1DLqubtvyBstfa@PG2 zR0%Kpdz?8XSOf}{_%cZzjKMuDXtnRQlprpd%6NqAz|j#Fa)I7YCfc&t#+ zv$|C{xl8a6P!~afhZP88>TqYZMQ+?+M=e{~x+h^2x||<#mJ)$O|}BIXhZZl|VwbK=$<6~dTeZW^T+Q@I;AD!ZN{qwt*L$2Ps!oa zxqi~%t{mLI%!VM!UQzULT4h`)hC8~jIV7XU>QJcf#f@H<~akIFP=bZ)hhl8qT zKYQf{o)yH6xbrW87?Y;p#yx}sJ@v$k(L;(ziY;Wt^Mi`T&&r6X$j_x!D2#Sj?DdOG zBD=>T$k=>z3DwK!& z%eJA;0r(y+5{a;#mSH9JL%xZ*(gCedk=={rD>w-S50y3`s~9U+h!TvNFH#B80*OZ$ z1uhQt%o=PG8#bcSc3S1{IIfEZH$cVjN7jY zB4zyRSF$62q1810lD0an<~q4RiF%CH!gTKgpag=59W13O1@AaH*=yFJBw-iIa|nQ# zGB~hP)%8lCsFV~<;l>k&UyB>w#=-P)4BXu9b)J~mYUzg~osT6|_U&N#34(Yr?0AO< z`{C}YTBX!i7JDoxe=2>XPG?qh51}=r%m_doEfG~h=O>{Ro+Bs?DX=$CwE=n3D0z*~ z<*Rvn;dM+`W}BM^avl$Aj6*NQ?TWXUwZD|^qVGNkT{Z(;=7g0}Nq#4!5hdTk3Eish zSPIJ)MlsQ!wtB@q`@F(*|ASTjNe$YaPyZ(iR6H9WHTT-HXAiqJ>S%aRDT|m`J?fNo z9$$@);TZO|u9Fom@A*JdDxVt4zC$8MSuiwT^P{Z~z@9AxHi8og`Q!MYkkQKAkVJCt z$8Q%PPh=u1;b0LHOvgl06lD|W*1mp-U;REbpSjEeE>HwDlzz!VNIH5SO$tMN6!N;K zjN)AEJphSyz-&B6DvdCxON3bC!eqd8;s{?<&e#}s%I+;w zl>3-u4H^AC){K4FG14pchgT%mD_7l1s;;#$C>G(TErEVyskd3i#uta?D3<|>>|Z$< zV?1(-!{3#*Gc$s-VKdLko41H+N2Q%61i1J4*l+**Sgca4+-mYhFl+jjr}^ta`-*}R zqdw;1_85D*2#(o%Za5|N1yq+>3DowbuDlWnm}+@|?rLXySA9<-0W6&g4Fw~zXd8=0v|P)`>O(!iMFSD#z`#Z zC0s+iXg0iU|1S6dPwjv_nP?sdLN%bcgC>=w%8Zl|)LZ_5d3{%BM)qH%0j}so-K>xN z&(X#s2Ho}q`-E&5`yFGb$}gAH{Gj2OeUwX>aZL2yiu0{7>Yh-?Ies_4F}4z{AF~7x zG+BKc!nWJ=vrW-Nf9A1R2|s#BJ%$iVfb)yr9!E&B+}ml7kXnH@ds{jt!5afvocdfF zYRB{+i1vC9XtGZR9?wH3eg?2=7mdH%-&xr!HHst!)#KDkK8#)2*Q@ZvIUK-N`@VJn zP}ms&H*6p-Nsbm5IJNxxswF3i@d@cn|HMjK9Ca6t*pFZ{;%{cf>9=uV>@y<;wdQH& z1x!BAWY06{a4Zmfo^+Ez#I7KI;>g89Pt3m7r2rqU9mW1ct0qC>!eS%tS_xTy$AMzG zN+IIN=7VF&@zihf{DB|kZY!x5zLF{zHkF0K7ucG(PaECCW;4LQ_=x^hItkHbAo$i= zp$13z=n$C8o>6cmuGykB$&_o^?%}KrtF{q5(9aNWc@|=9>iY@jZ{`&!$L53BkKsJb z<`1&U28FXTFlFGGDGyT?yq#jy{t50X>T`%c>-l|@y2{&F5C-53&t;4ijPyU-q&cBo z3|99dNF>G{T@m|JOB0Ww9H}Bv+rxYms*#Wbq2yT#p%9!@$y}U_v7#bDj%h{>3Xly7 zWJ|w+_LC6yYVh@Rp^KcLfJNj^yU=wmq&2Rv%n>%LOY|CEXuDVuF+~7n4UBj_jAXq; zfW61K^l3%H3XG)eu!1x&6ew^H3&#Tsh*b$lF;xdZ!`KGP&e2kuP{hYc(Ne^T{uD?J zg4m^PZ)9=9`30$SqjmfpvFjVKsJ9sw4Zs)?v(KTP0|V#+Dmj9pX`Fyc#?kpay{+`K zd`7@cy4Z70)J?qTbL74`tx#DgfiS?BQ~RZKy9@A)5KbTtvN^!Ix!t-sJm;K9K9c_@ zmWNZWGU5k~9}RzzJBcYO`iSQ?rRT!U;smkn20A#{B0h+*+0$Qk|>+TZMH~ zTEiIP$G{|Kyec`gVQpl-y4@91!wB#tV3Gr@iVtD7*H2Voohkg!1@RW8+Ri;u1$}1s zKNr=hrfza)>-Xfm3Wq#%I=Ul0YaPT#F5Q`=D+Biz^%d!nHx8BRH;$=)v>*S`{&RuP zvGA}#>KFET7H?w;-^OU#{NqV|iYU*A z;6ZWZ8AT9oYbCU`+VL%{vOdG5nFh4<@_VJ)7NmAsSld>3>$|Wz<%7Ar(X4|jGF)+< zvAI_jj>n3D4jC#76zwOC2ta2Q=tLKVm3-^PhrjiJZ@o~Fw;lw%7(B}r2J6>DFX-sC zDk1%tp%&i{c%;&6Tq zn?iW#V4O%{QLD0d0Qx^9ENqnpPZ_)u`3~NLF3bodNR4Y$pfM%?4^8|N&v=2DJmfx)JUb=)tSH01H#r)h zH$CZ*5&U}ll6|hf&G;tS(+hu$UddZV{^n4a{86+oKkNG2mT!uSs3;BfS|JQEKcRPC z|0WM6J`Zm9*xXs60Dke+b1|P!qS*fUv3*pwXevP`r}7h;D8^&!?X}PA;iH{X8T0eM zWj$X)`e~*y$(3@smwg>|zBq|*FV%p}XDNI97Dqy%4u+)a6PrnP@ z14ZQozjNthbO)0#`-_ArF%(;rux;DDiA3TC4k`ZYMh{H2Z#ek^Pq(${x5*>XS&QdG z2zx;GIZG-gN-ra1Wj=ePRTBCHHSGj7>jbq*LkOqte5e(x1x9$n4B2ou4Kv6ln*TZPln{P zDY-OEiX_SoJ3N!a(8-f$c*_<0#PTpV!lo|RbCbaZx(1y#UU+1Te5oRhm7nZON<@6W zxI#$<(upgLt6=C3=H!p7Zh%0F!atOR2X{}f?x+D1W);jqIdwe5i|n9-OVz5GZaL?n z);L0}n_rMspXRh41I(AkX}E2F|1Hvbgoj>J$1j{p{dt0iSo@~gGXJ_ zVHN$+d-E2kMlnzr=fz)%(%9aLaA6_L?JsPoX+cVjzQ%t0u3huA^;&_tD69m4xl~D{#5ema-v#WjW3!->Omqe0e_E!fSKroQG=QCMzkMr z2dx6doNT0=Xw@JPqmi;YxQ8LC)oFbQ18XMgJuOcf!Y0{Mwi?21h#M=<6e>u9=9^PE1@Pk_~6A zMWDSg$)T-}Y9ABvNQ0ugF5ej*o8gBptS18`ykI|K<$!?kr)p-Xqn^BD9vi|0!TO z@Hk-Jm5>jQ%?z6GzkS6T%%6`9s4PsLlqrq-2Eq)}dYhOAGdF zl+H$I?!>Z@nyme53ijlqE;g4@pMmYew2Q=%Y++^X*UBX0P+k9=iDe>_2Y~SMK~8LC z9#?NBS>I>YZ;aPX&5TiM8tM%R4G(Iq$+GP~>^JQU*@>;-5T~AqDwwcpvdM`e#`M?m z4kR1gXm<`tKv=ZPYy_e!L&q^9dbtV-o@m>cPS@9>a+Acd&tZq#CZ#3bEkZ6XkcdeL zdtq)rG^XEfK9fOGeNjP55MQ{gYExHyup!9Wvg5mAn)58FLYji$$Ga!=E`ke*uUkS9 zoW?zWG(?q#+Vfl&%bybpU&wDRG(f5q!st=X_hy<}2R;6}do`-_1-Bx({Hftfk3a>l zD6UVS3!kuts?YeC@}*=!*>wieF=so8j{f-Isrb3?52p!vNYTo@yz5FD2YpJfp>7QW ze8%7Jy%yKWSTDn-pa0&_M~VVc#$`H~b)AJE?D~*t=I7EQF$AzpE4J#8G_r4EB616o zM|UG#l|e*9CX%i$Jt-F3?WOeb)h&z$3i!srP#bXd;6wz zyNtsZ9d!ZmhZbt)zpR!~2srBM%g;qQ9?p~L*Lu|3JnTA$U|!EfuVk;rQ-@!6cFGAY z+rd~9HcJK5xhlnl{I)s4uKLKWiY&u|JG~SD9njBMI+YhCkjp~4_r15r(e~ry_WkiI zx$+^XZ7dRsqiXf~<@aqUZE`(FwramwOa8>4)0L}!ob_UEsLYPAl~rE{_aTpJmZ?KI z_OCw)x!PM#=6#)Bly@61%?TJ&F-*uS(d(=TkW*#A*+HCsdRdt}wVxD)NLc2nKt9|{ zTOhPk-C=grKdU%5SYZmmQeh}RpnJ$n$?6WjW#FZd(?V7k%6z=>p{yySAz8X`Sjz8(AIYT&j-AfTYo?1stdnz^2GV_3zy30 zOhT{JEd!Wjfr%_k8Ns>byI#^!s|MdvwQq6NNaaeDi87cL$o2}~jW>4|DZD-% zH}Kp~Ssunst$eZ#b`~_Z6y+DTXw`Mt%iwaU$sv~i5O?f;xOR?PhyWXmR;{s5>~yE+ zG#ZZ~3geb?dkGdK#UlY#YZ%~bep5XQ8i8^9j0W_=k^0Y@g@pm#&ZfCCEH)?L7G*TvmJk0Du)}RxA$yYcag3|M zWU6KidSU$7@;E$hW)Pnfy>yt}ln7@rbd2hXEy==l!I*tMyWj>dlHwtN%AMKkM>mXp zA(?)K-;6JmA`xBtyLmDDRf<8)6txZ1&)0r~bF1hnhyAq8EPXS!RD&C%#%CxsO@omu zobxQ*Gy;poR-JHn?Ky}RD+=588QeFBfcUYQ{w5~8|AbfGO#o+Bxl7VMN+3q7cfIlZ z+261-n*#q;fj)W0wQsjyxmHKqKAGYpBcz{^O6ES1HVSlmB*E0C7Ba@27L}GDO$G(k9^=CC%+*DB@+}nols07QG4dzD8RxF$ZPg~r1_fmYp*m9RG(8HXxsAm1`%3pnlgzA>G4_i57Gwt_vPKQn86q;QjFihcV)YFp?9T<`byCEaxM_O>r$ z&wzPs^cn5|ono&!@401H^VyTjXSMhhzx5Esu#JYxToJrMjzKW-n?N~e%1mX`QD>!?;kk7oSb`4yn){f%w;@NjG3%DJ|8Fj_NI+GA_d zKuUOQf#PC&difP|(wwQJ(?L*9tpx`s$CVNG@CXd1z+(a3Q$ayix9BNk+eKdI-8%GV zQyDa2T~&oZA0Q6s>ye2t3mWY~_Q|IHL?7DKv(a&PYu)UN9956eIl#hen-bkf=WbBQ z=INg#r4evrcR>G;Y++H<3eZfnC~i?_O!nXa_ep;3a}Ash;u6d*ia)FR?$>TcLcy#y z#~3^St}_JHU@#Pr1y@ktG2uy6f>bJMg=5MMLI&T8oi(aR=MK}@K1Q( zv4!-uAXdAUkf*N{Y%V@KYa~HYl?p24-5L@}AW%U4JAQ=m637U|NX%`P+y4Sz-M{Wu) zWPO-0Yxrau-Xdrt?5sPJSCV?VyJq*3rWLL^m!YwIxFJsgub#n@I* z8=bVEOwL$fKXv)cLT545R|Un@l^)=&NjSfN6gZPdoO{&JOfX9V!28ezU}lj3aadm3!neoP{t#2k8i4Cw?YwW=ot9c{Jnh zD*x%t%)xeZu{AcC&F*;@!=vab%pR!{-n7|x7qMbU{rllsn5Z2~Fc$2N2RFYeW;Ep{ zcjMfapv8P`Y;q$BG`NT86tlH}Cr3ov=;yeWzIBrT zT5Cz(VW9~DCqF7QZP}YgPOgxy3cZ+A^)!0G9fo6iSx)JY*UbFe$V0Cre#yxyM+G-+ z>9~ix&=J}+7knCOy^nm*fPO74nQzT4P)m!>si~pQiJ^~1ofJ82GC#CEgUX7&9d5I4 zR(Kiym1{(9^^3>^J9Y|E*>Z;zD`qnr#sglG|26!+2ux+L8{(tPsXWu@3QW{? zGeET7aH{1uSy%q7&cO)F*FdW{37y0d78H?|^4k-VDMjLKp}fWJtlc6oJPn=}02gdT zgC_}!W~fU>zn&E`U`erCi25cXR3*{@eeQlgJXRjBvC}z=&ig=cR5has%Q+>KJL|=cwiN@#PQouu#g;$P zR(igV@n#{k#D;F_6q1R;J-_w2a5W~Cefj!6LSn$i)`Rh5aQ@*s@o)i0I-yS`}|`y<#+TVMS4piH)sdkpU*-6Rp9bk{o7Hah8?G3Ese zrn79zQ8p0%eq42(3U-hGrMk}M!Yk41r=yXEO}of2(;Z;nM(gx=ujO`%y5!&)1FTQD-5?ED;1CldGu^_1rPRZ3X2T_m z#rgL<+yXLZ=_Jn>!B~uVQ~)(FA0r+M?sti*sgHk{l`<2Fwk!Lq|L9#sQoLH@fCCuu z8KJVO-^4AtpRrKnGZh2~QN1*YHh} zI0J8FvpUy$YhnBL>m$6`krRFg_FupwIpoxC>wQ6GURBdo$}}F3wX}9)C(MABfZgqA z{IbIl7WZPD*39e{(QB=>=+59J(b9)7(j5#$`ZFH3Bai$4(Dcp0l?B_^(Zu$RZQHi( zWMbRCF($_3#SN^rOrrggXk_ z|9QU8jyzaSd;#d&YwCFMJ#oe>{-4^XLtL6M z_^Z{DdOS~7Lpn;BBGn2JkL%3|v85z_yhGyrTAkqMixoc5^b~e!wa~xK?+C@hnRy#V ze{Kew0_imd>c_uR0yMG!!bV}L9M zq62>)O=S%q;s^Sx<&r`Aw3Fvw7$D%g3&lfre?B$KRNGF^SqX&4bkUU0(KwE!r2mj? zcw#zc3*l3S^&85YL*2v=+;6tR_|pcX8*+oY>QQnS!ktE*(vxd1WNuGuI(HNcQ@(gv zJWJ3=mxS*MQs4G`3!~BG-6(N#3ukfv>W{rZBAv6^U*SDBI(Dv|(75*;y#V14dZoa? z6G;drIS|xZn#`M~v|vJd@A)831X(8EFukfo>`M06ED!2St{|&E2wV&W*9IkhjV+?c zdM*CU4i9$^IbzwX1*%;y5W3Y5;3H}y0hmEh(A0zmvJi+X!n;vZa%T_!L*r80Qud45K%4BNJGBbkoy_LPp0wSTayFb&X7xJ>ez}7fmOpa+`iGaNm%=HApX*xj=C$!0j!gu@kVUbcZ$9 z6bdxQ(t>Pv!JqZ0dpMLW&)D>3PuL7wPEQ%7RC8Wa>>Gi(Bx}lFA^(Kue1 z!Qm2s*s{QqPq+7SD2C9oiwEifh8AYFT5+1g>H7=B;q>5xli?IBhcLre_P(1BI-k_1 zmtdOu17%3_Wd3i7@nBiWU*ZCCV!sw%hdhz&9HxQ`m!{mMw{d}^=A8S@(8DX{=KWL6 ze%nzw`EWpI(^e7D`rUf+1SZk3xPg}Gr+I>dux>8cn7ZFA44+Jh@>n`EF`Yru4xttV z906*7?>eo)pi2}K*<{0t=f_|vQ)~q0qd-qF>^lwb>Qvp|mBa}8>9YI-1Q6t-W^WtG zt7Zq7Al^QP3%2b;a)PA5<`3qwwd!3F!N4+>zBPjq*#P9ADe##kSE85B`=%5-wF5c6NQ_?p$mxm{u zJ5tqeT?ExcudA7tWyi{e*2qA`s;P_jag#nR-kp}W)lHWSNAMt@_$>N1+*Ooqu7sn% zX^oXg0p+rl^;g69)$W@oOh{|RS*wfIVoY1TQRzr^a#T@lqTqNnq-BjR+>@qJGj^w2$l!U)Lj6MC}Oz zWDX)sLV@^Q32_(f7&4%~nZ`H7x_L~ytnf0W!03{>A^iI44rpIy-v&5o#L@k%nq%Sx znUT9yD6H})Os*PdIf6U8E>5%MH{YJWU%)FTY9kQ@Gr+M@8lWv$3yNjFErfqFi4eKoA7CeqMI-R1jZ}cefC`z$F%e5AL-ik0P=IBJ z3b}I4g)@n#5lNR8*C9dmUu{%`l{e=C%{En}6Pi6)V$JCgzbWG9f@-qvx{xl^Ui-#b<&6E>H80?{Q{)v@uf*0BT?&#yRU*`?tjc(VKdoBlwpSg%%mJgK5zxR z)AF#BK0Sx!hXPl!@_qb1bn7hL_8ZwJSYg8oUp`j8Uq16+J{d-0)>HRi%andC!`}V1 z%!ysRZU23)ZFyHpn!y(Mx)-qTiI61_CVLC~%&YH>kOc_ycMJTD`c4=s{AJS~=ZB|$ z-};1SA&-}ZprVzt`qgj_cMBnH@GXX~`ub1PQkXlgmK<6uz#6KfZKwJ^z+6Ioy?`w9 zRgkW$;zEsgJUz)-eZ7LL$x%WfeosqPV0Ny~l!b1z@-v`*tO0jgs$be!V#$0H7q^zI zb^amTq&*XN)DtIYr_wZ~&dj*IW5xXX%f`mVD+nD?6{nb%5WG`qmh!acjcC=#)Wujs zA==_Z3db3H2-@TV5MYPQilK85*^$Db38iZ#=dZOThT%!Mfl#>t1i*f4QaHSXmc%gJ zX$5*!l?(kSF{GkjG&H!35~5!=cz7uURTUP!sF1HkFfn7X3-gVeQNP8FtVM~%_Lk-_ zxRW8~$cR(#&O{5ilcDCwNKli_Mk~0JVImd(4pT2fdzSha9t?3xyME!75-c-Kkms3Y z5fq*ozSrubo&f_7?5X;}W9Es`?uoz4x|@e06WLHc3mtlQGwTra?5%^~bfV-|Nn>A) zVD8(4jU+*tqzFvW>?A1n3*rrv$g4U#2wBD&!PB-7wetiGMKpmv-;8r|5|-(h-vp>I z)1?RX2i1t!Q7mxT&o^DQzCO{6-lT}{c7|lX=7!-fHY~maAu)3XAfF`5^=63 z=~+SEsgZ1GJI1tV-saobQaDInUuD=(^O1r2{7Iwp0YI^f19PG@w*fQiAQZVyA@NqG zF@<`sV9uNP0#6Z^RiRT^+lvFer*ECftYZ9G%%C zV$>yU#Oyj`lJE?}9iQ0)Lr9`Fdj9*|k9P0DC5d_ub)V>^h?>0%`^uL^3Tw(e=AA_a zJLL=&kTZz}CAcHIZ-@bP#1rCSCCfcYqfzLeW3gV!hC5Y;cV-4Iz2{U5f(}2qv`Z); znr+0|6l&J5Zo}l$RVLUQv82c3Txx$A_1=1(IqYxPscHzi0^%;VYTc7^+i36waVZJKrmopP%^`7iUYXAs zSsEqE!^LQvgv^>{sIhG|Uxygw8ux+uQv2o68@qb}&{2iZ?;Q8oz?X&(>f;CS0KsCLULLHC1G@;J&+=*IpP(QwW0}TDQV={-7_Zz?JDD> zCw_DZ>;kYH=C_E=EJe@50{R{oc2v$K8~r=W8(7`uD^xetstn+?+bZ}`=gT@&k)%I8 z^&S?oN@1zTF@Y%iFrcd$E=Egz%Pqr8<~{=UqB$ASSbZ!ibK(i5BO z$cDlKGAVSrhH#|0!T};Zlh91iF%Ty}JZjWX{~RUJwc{8{GD+loa;^842=yexc@qp& zwFgzG#ZxD6L2OEF&M;=_6vNS;lyjy4NSr*0M43Q1RBOIM;BMl}?I=dkShe!r*ukv1 ztohwZ4zr3;VDRr-=P6+B8)Zvo0AyY7kNo6ER*_OgrGFA;;S4Lmj}unA14#j>tk|D~ zEU_$4H>Gj7UYf~q2`G$@qEN5zol+Bjvbf9^G*v0@=xi|hYmv2V9A&eHqF4gYonjg% zf;%jq+Zx33xkY_O>Cm~SMlGqD!(H=>>@CIq8R(U+jWsqluH*s{f2a;U24yy$X6%p> zlV8$Q@z)ViUzsfkepEMDNZB?ebS;ERK3!0hSdD%K>?5AaW7$tl>8-XRlKp`S*tXQS8Bc z@N#7GCe|~;OYUt{)Xm?8i40Ll5kc39ZQ@3QL#qxoh+8X-6`E{_D zgf0c9wK>~5d>YkRnuXSXwEQ>#T@tBbUs5IYqp`9IM~|aVXBL8Sh-vUUoB@P_2{sFN z+_=)7bUI~<6ACvKh` zgpO0VGm+Kl&7jzPhiy`lYt^7c)eni6%Ils1>IRiES_&LKuN2|2t2z$k0^n3tb~9a! z2$0;e)&}JjA_y&73x@X^?>Vy6e9DRk8;Km zsv6b!26&8@3FAd@bVI9hS4U-8rv$CfirgsRWaI$gJ6ihMmgQR^#ruP;{$m@IBzCj} zQolU#{WSD@+N9yKjA!+#0{Jfbn>3wEvy0^V;lArXd8?ycfVgH^;Oj{+dquyK** z5A$zhP7lLi%O_X9b8Pe=7PLm-_sps^_Shr?>2qbjRqP{gzKq`=*HzSGcxlfM><> zVt@ucV_jqum8C#fiR;!ErQiqrVBk>5j=1Z%=sE(cTzxXmThS$1z-?dM{{F4t@pv&j z_?k6BE&XVew@Gcp@N^#rfL0?Sss{ zA{v9Ux9@@!oUpN5EA0f6E9g9eQgGn2i1gDO$7mfoE z+o=H<&x{JGp4oG(_)wtlJHC1U9)=31$t5pHP#l1Z9DaS+NFp0&x;#%ST=xPp69)(a zzjT*ol$4J4AXf{t^qg~C!$+iL!^8oTQ!|EJxZTrL+`_>}#yVm|EdwYK6GLrE>qzaB zy-`TPaazT_SAvc_bLA%kp~Lb9If#aPINXO&v8A0{vj&~QM$#-!r9|YnNm_K`UR>EV zNEpC1l582+GJ*VLe%yC#$e_&Fw2w1jjSGemOxv)oUhL<8=zuT%VN=WrG1%vt5_UFo zh~XAc3}s2|@!21K1K9>7dJ$+=n#&;IRzo!0BHCOpn;9AVX*9IuEyav`Fbz52DVV}0 z(aHH|8GX6QJRv&R@_wDqwl&5fYl@a$-_Js9%G4aRaVTan-BSgm(TE_X>2=uKXYZ|b ztSlr@sRV!%Wyl{bxEC2WL(uut9y${dbSeRm0csx!kjId`MOwF`gEuh})gBp?DFw6~ z$&J$v_$U4u;UgxQzj)FfO;=){&zeHaBMR2lP}s|p2xxsUV57nSbF114X$&Chm~L5q zi;nb@{8N!&!*~*mJ4-NN{J2(}_E1r{vod|ln*GL{c|>CwyTx@p`bS4S#HfPms?A-PX5L+DorL!m{jtgDS2bi}vs5rCs2zjRI@89uok>KUc zw04KJ8E@Iy7`{oxmCMV*nI%Ee;SN$J7Lo{lF)_5%e0cD3ibAevl3;0f3bgOcyN4uB zS03{Be$&u%{rgqY25L4TfWM^_ySJV`-?x4 zhMQXOO+!qTP9^0c4UrN5oO?xl7PL(?O7(Q@C7P}WCe->m}CSU&yO zIPd`WF%qEzeYo$6s`0Lo(!rbwr6;vNf*j*1`v!(>rUDWo5cEvK7%ad~p7e?2SB_aW zSJ}z>A$lOcpUjZ$D^y+zAJv8MwG{s9Yd)diHhw9a@ z2c;DUSCoJ;=ELe|`a&nYEb)Q8{+hSDV|or*XYyYs4-}QPMc5Uvb+%Pb3VUNrCR?s$ zsQ9OhKS1w&tJ9d`WmNEwRC-50_OQePy2;x#826Wg10=kLg`*95#T_OJi#>VlhL_RS z=q>L_a=!@l0Q0%`ue%~+Zg}PIXyy84H`U=8ZDT+RDpo4Iam^7q#ETbq1A|uOUUfbH zlu~`Q@*Vr?q^5_6P}ZllNmeh(1t`Z^JAq($K(BM=z8anxR+e;{6ujKe3=Gt|p@6+Lr zr5joDI2t4M^vtTG$x<6k_1bA~`mtU;X*q8l_D)Gn6u#J!R=VzBnw{)91QrrBDv|G` zd-)N3G8F!)DFRRjJ~rixW}wk?Cev7?3TVm{8FoaQKpAZJsTI|P^P0;bg$Q*rE= zl+USUHXAyj5mt0vom#(V)~5e1CNt!2BcjATqsgCncL=&1Fi84;O4e-z8Ed_aI=PtAR6eH#C?I)5z^ z@NRhIHV(P+=SX8XJEz5i zd9;zWc2E``vc%&aAE6r9(%n&HG?wEIxre3f5C!?z_X%eN3PrXSq$VUo?gsuo-zyy# zXeV;FLxnn0R80p#ic}M?vp%TlbH*p$lREO5f;z!=Z>EP=N^1WWoG*_3OFp&1wFRnN zY52oi;QPy074{cBk*e1}+di85V#HJyf$l#Lq@&L{@)1LGcLXA1nUz~gk$#;7#tZZ*=$LlB$?nqaG1uwvumrAKw!#e)31M5vt}yU_>3VPudb>AdBaAK^51%_%)~}HEYW(%Z zbD0nqu}P;nYJc7UL2@c6{(@@?s@jaTg~eu$#Ryjh;0pyn&{U4T-7AUiXc@pWINyhf z*sof)M7+6~PH8F_f~_N>sCmwI%rZ0=>sqERISh^*E`YaSE2!y5QF|sbxx5mirJY~+ zKlV`n!$+3d^J=dNz89uJcI|KW+iQ>@^jzQ(Eil#Re~J_39&Q)t%^Q(A~~b>J7Gn>#Bv1!8~u1}_ZRv%bB>Y7-M=<$o01 zCP>80dL4TeCTMOMM#vyF&kF2)v?zNfLoBEg`|I&8iQL4*y?1M;jxOT2&HqXroWbL1 zsoC*Q&vJUbn&;^=m%q#`)}JN}rHe|NS;$Qk*16o@K8P;c31=O#5F&RFdm8nU@&}Pc z$Maw^msc??}H$ zc$?aS1rmuT#0>NoeF|E2UmAb#9#zu6xgSSVdONY&$^I`YW~{9|E5CXZpk2(rHk%u^ zwmJRx*e;?cwD;df=4oKryTd0f=wOM|kOH(+x}A^}2h)-82i4lXHQ=;$I;IB?H$*aE zAoS2T%b#lgxtC1%={qkcEM4OT-O}I9hDNWdrhtkCi3x_kixy@N<}ne^_REA~y!0#) ziRiS$)xGz!&L2aitRpuS>|oHP?0HAyjGn7g2(v|^-Ep3AE)~GqGY_L+K<` zm!rj#A--aN>;mNU-csqlNBi~pTYS$yGtP{Y3I>zxl?_GNymOORdB$8I#KpF2eoL(8Xl zb-?^`IWsIb)Xmq^B)2S28FU{)AQWlVDX@#m*|ugCTSny;c_m_(6_*z(Z@bWwu6SjE zH-*7GK?F)87Al%qnRrxZ3L8G{7qK&bFAwj+mqzj0C6VH9$e7qpp&^PlmNrL2pn-v; z&Y9{hlO;yMLoVz@+cZ3_;1n<}>Z~{tE5WhA_%q7$EZgyf8N6SOL186IAvlCcUZ3q1 za^N49SKxBA^zUY)YCN9Auo|viTbL|K=?~gc%rnrNq&HYe;9tg9-vUx#d)n&DPd`sy zPKgNo<;Xpsyq~QUC!mP)SK2>FWtRtyo_=KS{8T!tJ8I?@Nt$HX&Aq~(3&L8;Q;{e~ z=fCu&N}?vm!I+^-XdgV?^EpM7aXW2zLZf5-nh5 zJjwp$2>X`pGC}RP)5#HI>!xEaBb6Mz^ut(Ufr&4f(pB&TdB7%|7uCH`t#sXTPD4&M zO&%%`7V(5RfI;j<1bPVO#9N`*#fxPIV@CsPmW~9T%0a3!!uDFZ!=w-Oy;?(S^Fqah z$S(&s-j7ksG{yK_Rj?$aSPi7;a#t({$_K3L-eBRW-|}=DnNo>JNaGs#a9+~bY=Gy% z=xP9t^qF~qVus&;0dv@8RUmj$#)dDQv@iH#B&r%l*#vb-QDPQ5LE8P2GVc_LWSmc9|ygH@l4y_!T{6?cms zY62x0S&h!$W#+@8j4lQkkXb8-=2^glP>eY&_$eytEC=F&h=t+YYOv|tN70g-^E1I> zw#s)`QhdyW&8)Bm=+0EqJzoe@cDNH%WCke8b_Ci0{vcVI$eC>C+(S}Av9vqR)iiX? zLvZvtV$Ifvi8G3JgfV|pHn>bobH+`=X`&5IINJF0`b{5NR5bv~fy=?yzJZ!E<(a2y z)d3TPb2y+4kKWU_*1?p-%6vx$%cGZTSet0gOZIpwQc6|BTKt6MjIaeL3+j%feo+N+ z+mPU|zgim^VU1NvW(4M_MAsF9s<7SDK;{UGl%YGSKw%BNW=l- zlN`l><7+`RL8OXrY{A-jM!<}Sh2J~gH?nga#n_F4s*V!8FI23>SPSvvkmSYKf6jS@ z-=NXe;3U$1D8H<7XOOmtqy`Nw3T)pe}A|JB&U% zWd_UU$mXH`acp)1Nq}UYTUEVpBEok)o_xB*bub=qxzum%_{gijPTKD4Qq74st7>(S z!8V0$G^qamOsNt2t&1cicE9hlBO%Usq{l-@>L6~YW?t~ua`~35b6!15qIr%;Qvk#T z6ZY3|B*yCGXiEIfmV>^QG;iqVe!SSdpIA>GQuTFqINJ5S%^h%~I&Y#Yx^vVn$>Fy` z5(~7`Tw6Mg=VD3xv@z`i)s;Ujr}+&=hKd+;^jZa2riEdY=xW@Os#}>-Q2`4&^R>M) z5GsCFoe8e$ywTYH2LLx&z>Ios4{a2lkBtwj?dM2Gv9*GyAR5bAd9#EVQoXjs0Vf_CL)8TE-TMW+D#Eb?d{idwlA~ zk#T)R*v)WwFuk#=5->Zs^w5)PO_4U+qUZJ#YxiLGfq+c0g);ow_DzyM6*~+G0WaBE zvlgt626J8qeL8>8eE5XY7Sc*1^(>tFF6aU17kCy~XS}!=FFB(>n(7#e5dAO2R_9W~ z-}b1iPEb8TzB&LROm@qNR|nl2H0#l&D;h63SmL{*3sAKVfC^j+G_Ui;vp8SaN~)FX zR?9TRzg(~T=}}>C_gf2ptgYMOW?>I(%qgD;t> z2wyV2q5H{tz&}=sZHg#&?_2cFprZVWk9hiN?Di9WORWv5&&3lmUlMpd#=Dh!XFCF< z{fk${O3{FC7M;|B5Y3jR_xC~D!#Fv$_%;265KmMp3^PjS^Zfibmra*u9*uj9!FPzv z_qIs4RyGR{AZ7|Rv5fgi*)YNli9+n1Bx8ohWEVpE9JsxmsTce7y1B)EgU#V%|Z5k1-l+CEKplAz%%xR?pYQJAcU3mK6<*917T;{9fPT* z68jzDEKv#PPSJ0}sd4;Z#@)DLYf=L=e7LG$S8?hKpxr3z;E&j7Jf4-_QhV;^?j=Y0 zzvT09B1*twlbWtL!vK??`iYz(Y}LxX#$g|;d9mx{ylgWb&zk!SZ~?c*x1@PPnf!t<=L z?uGc}V1833R%E8($9IB{tB<&UrW}mx(|!;3F-U}ZEm(D{r&{(%ShEj5XC&7JUg4W} z4|J2Rh#`R`x&h(3Nm8;}teH!4rc}z~EVnUFmkcTsEg)pDPEtJ+jGDTWz?UfOB1!pK zv8|r>;sp$J8jS+(GX$(?oy#7!L+=;2E=>WZOoF1(dI`Lb*a}rx%HPx=w}#|L^>V=| zf>Z5$rqF8}8~Y6M@2c_r-Ucr-_=zra{O69fMA5*qS29m}#r{g$einrd5ww+F>v+j% zs*(ID-{1rogvaz67yO!Bi|?$|k{DeGJREZENfL&W?b~1j4`GrNeKbZ-^oPovMO4|C zmon(uxMBDaGl)M$KcdbV%IPHtaP43c-ONH8N$^u$Oa)@Kr>KJ0h(!mh-cxfBV-Re8p)6)d#}=D4DJLH-4ED~T~Xz6EPx+# zu!o1MLaig*Y=KmjDC9{#+pMr&hsQWmMCpg&PJN~~11e{E@K8~%vRQe{l`K2^3m3CR z_cwvPVI^PywdPD4r51A=_w z1K|{8$1UX#)RonOLVBb)X)|usXweSlHu4nhEzZ4u4SEcF6rC!ji`~=xUGKcHGZ2P} zaKhDs=ew$=y>?=V1}mKMKSTnjW8zoiI930Rod0~d{?bt@=*SqvTdLS2vkid)KYR}? zi^I(|9l*a}_t0_86JiCA2}tW03SYy1i!8lRR3}69>)pu!e4yWs0 zP^%0_*y9qpP1s}HZf?#KMIayi94_qaPnFr>gUSAdOs_L+&QKb2u**$6NB*qiB=EaM zI9XJ|wT){0-%@a#WkKr;3nt(3nBXDsY&At=#@_NJm0&>=o*UmouuWeAr=?I$>;2tB z>`hO3k+hT(Ok=CT-fCz~k31+eexKJXf7y5BH2;Y>MsRW>Il2$rypN~D7)%Wwb3-<5 zNrsxgSJ#;uG62nK)!j1kLFr7zxPrPxS}H8{@oy~#x><69#dLl$2)xdJMCJ;}cb&!O z)Ji$2?QBAA;-2DtlCZ^5*3cL-Pg`TRhx*M?Kc;1N6b*~*hW-Z_r-u{aDdn}UacPRv zsJgr^;>5Js8@X7%*QE2}w;_$xxX3FW`lO`id*V0`A!59W-r0rD+m)HluS-H}#o9D9 zdeM6ySNvraGq22Kt2?LuhYSd~boR^t?Z<5UYg#%5%1c}3`%;MaRGS7=ui@3LG6y}) zLB8n2$A(fGE>;4WWEmhUG9IF{q>ATSJo1Nfuly-z{d(>Mts~5;Y zXgQZqeDz5`)=?ubQ4{_wW+cc%@R_{xI~cKsfyMc#(pd9Ts)n3(T^Am(P2QTa-DvFE zI${+gc*HRqbwh3NK@9-V?hxVLbfT069y4a)g16~H=;W@V7fyvC#+AB0!-(Tl26FJ4`E1~+0!C_xu7SZgN; zR`lhUj^_(VVuetq>)bHtqUK|u2sJ{ZJiOP;mc`FTv}0~d zT!7W#4FvBJdrkhSt06Eo));ef_Rsb~lYdg^K{e^#kM-g$D26&3enn(9D2Bz@0Y@#! z3<(-TYiF0%0>7d9sZR)PB0KAq5^3F$sW|ckA`iy&f*F49!zlrFWv!<8+Z!5f1*|2| zz<1py^J+C^-*E1p<3G{IupWv|WJmdiar~ENdj|djEgAE?U{~T3Z6ytxqnf__+M2)f z2`x^&o5-R;VyG$!RpsNe#;lp~S5cpXp{Vxtn=AiWQ1KuUfZqTzF9X%knu)(di+Ks>#XQ*!fdG4K+EIjw)?wH z`is~5Dky^4n4y6$Nt`H7^ul9%Z(vwTMV6|c?%MZQ{kIqDG=AQWh7Ltj$i6}pMzHIJ zB?A!RqK70ua;?$KBxNgFO;AuICoC?_Fxr%KqOnycg%LCEt*l&1)4GgBqN4ctlNuqfHQ_>I5~ps z%>gVx;NOzlXM)D(UlK>`tiGqt0VzQB!+&RkKsby%^vh_c7CfhfE~XcAjnVj;z`oyF zYp8(8!gAI0*82RSEEoi5vGY|3aZ$i-*ac2y+vK&;Cp+{I!nZISOId!T7%Y|vk_v>_s#ugMT{fO z^V4z%+uRldHjg`ej}e=P3xO6>D{9)x5)Mx8MBvnnam8uZof5wm)MX^ z%hdQBhdq_L?FwSJ$$Sbs-c`$FF?!XB z#wCum=>i|nyE2;5v<`2Rm_y&}N$;a2Jrr~b$-~|BodlP;Rmc;ybk1?p)Y!Di1{8fdpxu;0D{gLgP*j!k4&(lz4AB zu1zv)^jf2kspT!X2d$M@t&6GF=Qc3ZE6#=(b9RrXMroIEI7&jThwAvL^-CB_@%lN0 zx_WsnuW-UoL7sEVm078SJYZyAPU1V-V)Mg{@fLABC*JNLNIqRD^uy7TvpEK}xNrH| zgN`(q8`P|TZ#;{NCu!;L-$A@UM?0M9bR8_5{zDu=7cng3jA$OdhE~>>=aD;7+=&9E zkRZ&}et#XhUQd=$Ao@f^ArRkRCHuqh1$E3`BPCX2TEGcQlQ%9RPM=P2y4&%N8uQP~bkb^897zRDWVvMw;TeeW9GJ>2<+;yGQ*56Rv8 z@e~!GrYMt->a+Ina{|^C(?yN0-FdBii;207y2p{C2G~8VGB*@@V-IL85fgrn=2KB% z5=c5T*gZ9`x37ETa$|q}Tn|F>uUf2C6J9RDc&;FFpJ2l=l*{8jv{`w7#MQS)3x=K5 zN&*s~Tzvbx?FQD>{-YsT3mLpw3rS{>V|n3NP7ThLNC3vK3R%Ls^3|bJ?+x1pU*h3! zqP#6^-+vi)70-I|_^goHH8d5_r=ZLHWP~f!!k5J;|7vJpSUazxxtNc3${`}C<3Sr9 z$Z+RDL+$|SyXZXm{-Emj7k9xzY-zn*635pU<`cz-G(eyh6krSB0k;CR+5(8dsX$A% zUxdda*JYIvZ6+ZSH+W1RY5%hXe%~H#G^Am<7Zsu^;oAOv3*GF>LN@+X@Zhhc(1Vzi zZxZMb|3Ttk@mK4b7d-})kr5QBdeUoThoXUEan^`p57bA0og-&;VI97stMOCySo0uHFKN~9DHLG5a@iWb)KV5e@`Y`j+Sfj zgZ_90>@)WnWgv&;(@#Q6m7mHxuI2vPv~v}~6jEw9%ZE6oP$77oaI7$|iUXFv+(m&a zJ9vD)3%v}$3fF1gpZUjYQkKTmhtRbNnsy4Zd4VlL#ABus!3Ocm4^#O@|HcGJ(-QK` zy2{ zVb?G5i&nd9dsD=p6BxtFbm+nKE2uyw&fa-`L5;2JJgL^hjH$9!4rh8KQ8}o{Z%io> zYY}y8eW<&&jS*{Hmx8q-s`V~=pL|xj^zsW?Xh6YPBK99oPu)NTdV9WG1?;Os!&nhM5> zT!M+)ZaF#vVsEu<&omTh+zR%FZzp^$lS29&uy5_-OLW76kG zw6FaBC4%x?<&K}azvsnN`)^f6t*(6O#_U8e#1%YvrrO(;*NeU)c73Y>p(rLq1zmQ= z&>&n|*nqRW-g@HX95x=CdNu%42+$FEB-Z zww}Bf-g1eP*e9%cfmcgI(C7@-5V#cvr!?jIX|?dFh0jwh#8M!;-GInLfc zSHm6^sn8LTOMT81ipHewcNqssxu;kJ67WHQbcjBd=2El1hFKm~u*4y8ghR|{@~79V zFD@k`Yfr~+TGNW>lQIa{>g7!_qV81nW?F8^Mn96YXr8_E?y@<%d3K;whw}$4Zf4AS zyUvpwi$}}4hl*vJR(yYD1tkRIT#2;4QXeBv0GT8)+>F{iv>hfmj2S@3_sc010-9gn zr0Dq)f3-`V`vDyTMZIOT%%o+;J62)}c}>L15?ZO2FZ9NDhbbAjs^&zX+D3vXu5a}2 z6?eGwH|WxSG^>U-V1SspL?YEH#5EfpouA3~r2)WziBErjo63oz-zlO9{r$(C2EBN- z|0Z~3$0|fb5JU5s3>~N9u`NcGo|VO?Cy!1s5rU~;J61$CE{iRu#}c7EFW#(ETqk>T z&osLE3t99eO}r0HL5Ze6TN-u$sZ>E4zv@#SofW+=7aoq6wO)vsV(i;s>2na}iT(r# z)aC@BK)PUhn+q0kf0u@TNfiVgI{|EfZseBszyT|z^%RNrbs5*nGSum_GC#xsr}_HW zdqQNKaoDXLo@0KEyy9o%GUii$g`zy{humx^E~Y#f*N=6UG7T{cdz|9#6XLOZ7Qc57 z<@52i&7mO}^i9k1KRxg7%*QB|0hVz|5CW#CJM#$sZpjG{YOn@xeAXE_{IFJ1-k53) ziJ$1)xuW$|5%2%iM5aYo+6`?62Y3m`44j;Hx)XX(FA9RgY{+&|HDe?87JktK>mKUL z@{UK-ew-df-Su`vr~!76f+f?L3&}abHQ+1Pq+YTKpVTDIu&!u{(=c zM5_X=4v>}hS(tkS=3|q2I=7>3saozcVNj!V-16#au)PK%_rcwi1L4EA&{Bk6Ft3K& z#q8DxtZIYRJy@19CWSk4|LQf^vQH?cpCV!nZd1KYo*P{C7~2yO5!iv>TGZUL;8()k z4!1U>xyWQW`&Wg3Sz-0t&VON+yE^?Hg>-uL+GsVCrrZqMk{5EE_|WyEkRwy9kV}pg zr<&0bq9fj9!f#G*hmlAUGA}F3<&-~Q?!>lghH8ORW4Fw$a#7EKEhrOr8vfovyUjm} z6xyjPf|^nEJi_Hb4;$F~5<1I_3SY}$4Z#N3=VW1p1(vKOOnI_U!P{`H?Oy>nI*c~t zjr{Ifc=H)Lp9Pm2b&e(!)|YsFKd+1|(!ZJUH5j$P#3c_){Em|+Z>qk7+A^jIEZj7X zt!U!uMnEE*{uRdaY%fjd-d{Aq%%Ks2M_`W!J)qlz;(LuJZIZFyBCq`JiE(7ehd1f( zO{+0r;1e@_F%~1|n10M|ok@zpTM->UY%h>jKTZ}P6EO|00EsW7U1NZ`-q=e=^tcRz z_mJER`sN0plwgvYcOm(iu-Y=+4>8!fW8<~J2w4o@;D-<_b7PI^3`t40jz2SA_;FUy zuF*5TyQ6PWL8$Mg#e346(=hwCV74@keFt)M15nfBb*`BvD=wu_4B<&Zqf|bPP>Se| zPx!&eSTfwc=CC*K){jqzk1Er^ed#Inxd8w`p{27&ohP1G5sAdWU}LIr_3lLAd+9wm z!NT9KX7)Id32MGruaWP;C*&nT7fwzI=O3*+82pyq^nc>)gk{>YS#jqsZ+hCAEkkTr z_);wdG55wn59_6l%9$AT6V9)b46h!6df-ZvuvwW&f}A;3K9e-aKh0$2TK=M^ybas{ zZ~q@x=M-IO7j@~_wvCEy+qP4&ZJpS*Z9A!?V%tW=ww=!RclSm2%`?s(d%x$5dG(&L z*IIL`XH~clt4gIpd!c1vm;dvtDZx`DpY}2UR8h@!pTZ_8EM1vn8x=DsNfCT`VLV0g z!=6XO3R=oMAP?sRorFf*z)jL-MAm#S6?-!Z&C@|t0*cMOnJqUFSAN;DOSiqZQblL& zAoEUKl(U>DmQuB`@#)(R#ng+;crUNp@dGaALEQ1(GwO#on3-^w+g%1oa?tf&0VYGjzsp3^Fmm(4sl=qyvC)9dIFlim2}KbWy&W>mN+fv2*DCBSZG3H-}G3KqF7 zcXC*Kr@mjDjE%BlH)5nV7RYRM>^KZp$s(YZETo_TJ-uAAAjHycG@KTCku(vk&Vb+j zHMAU|#*;yunFY&?@&ky+hahZ)w-&e+$U>Y%s>Zyv3(9_1jPNdC)9dL-WxJp_xaE$h z7b+wyg^;^{5I}~s$-wP>=2U@xTbKQYFOtSVpiKRO-vel)7OZ{dV?fo{V^y`!ry=9t z@4*~9OZ#umtwx+tY!|!qSQLcKivuVZZ#%j|75V2hzI(nmzQfGDfb3Q$nlX{37&;2F zLYKeazi(mI(>g0K(NaG*Cb zdN=$kG!25irxqyE`#mc*h9zzKP$K;uBQ1wg_^%WB^;GZV>AyA%F+KwhoB=eHqQ`iP zb{PsrDy(xNm3(jH@bLQ5!c?f-7c|L?g+bVzbPqa8G!(akG7Wmd&A#`C*P?P^zXCO%yNHZEez^gB*2L zOT@a1!yn-leJ+@qrL^YOtqk}E?z)}tRB5T*kGkImQca%iGJ(BP7qYkIlGW@GISVPmsAL@&GKK&?EvKbM9ueVWB+5|uXLZfil0|aS7$Zz$G zt3N2X^X1&1Y3ozp9a8qt!3}ydA1PN3sFN$BEP`r+G7;VXMl~hp^y0z;!KDM3N^CS8F>Qd)?l*vI3%oylgQZ4Tz|1yL=J!azSOQ3h}58?KVUo0NfO(L z*^HWABXV)^6icjWTG!6o8{B`F2~H4*1z4pREX z_62`~?R}H+mzNtAk$YiAFt-9S?{%VxqSqqIN6~KwLguM8Ap9ni463C0#*L(A8S0 z@24&;?}IMRBs%MC6VkG%0W00@8QT)`PF7`vL2DDVB0*}co{Y{STzf$cuqZa1$9dGCiH584nBR`jwK@6wa|LAOry9Qgv~qfB@CX-mSEofI-HF;C z9uu;!k)IpnD!iucdjGts=~|C%eiCk*ykakRyyyX}quCGit?C`E12$=uQ3I1pZ7eTk!xut#U#Y3{4^>MUoVd zU<1H`^_N)tf7L53bNaR2Ks(CYVk!1eq*%akFa6PkN&Uiar0V0+97sE?t+__v%{7yY z9@H{>*TM|_tBci|;`I*DR_UYe(Q&~8;3<1e-^)zs0Jn9sg;AQBYDP~kp>6UUaY%oe zyv}ueV=i`&RulkX;6?p!0NK0H#?iALCY!eXo$V2-QP)z$!tGs z>D?XKu$0p?kFMD!w5^Kayob0A+Z37!VZA%99Lbrr-!&Y!c$2-Y8IcjKwKL_A!>37J z9o@M!lI98`Nb?UCJK?HB6|R_kgVIuZTTJ z&c4qqz!V^@%9B$rjRAY*dp6M#o2u@?O3XNtO>u*S;<{#Nwbj)zDeBrVZ}P=omvm=k zy~d`=YN72x+e7-4LWtzu=|*#YllEef&`XAAmvn)l_FutQ*{tUINpOgyF(#yiEBS@* zOMtEawnNF=kp%2PeRuZC65X8{J90l(!$0c-<|Kge<`CAQZ)*|VvXM8Gr=P#eUug}_ zmV6K=N^fVy6~r5}RD~GKoQ;3rOrKLXTz}P6tVtf-s@WU^)C{o_nNw@P1+2fIVjYkD)RcobEq0^Jc@C z2|yGK%OP)9=YGcPfm^#mh}p?iQCKCxdLY2_LNXQAr$i$F>^W1sCc)z%AoH$ zrO^t3cU2pLPKk?E$6xBOQXMMCX>}DLb2(Jqv9FsSt6G0(3|GF@Q6&PU@7W|u29ji4 zsRRQ3+5t>swhEWnmi#&5A$yQi?7)%TBESg0$c9JYQlMPGP1C7Qrd-3#1W_-88Kq@D zRPc$oRmGg)wm+J-YDdZp#`?nuEKe|fJU;br0~EqB*x;LKYg{g1j=|%gFoEsVFubUF z1gYhE@#eA|U_<5Gjqi^$0Lz(3K`fGGccw|wBbij#byE~76d-pAD51`^i1#9CL8t(4<2&Zk?uA&0)u2PehS)5@MLD=w}hoPs7`^H_o z7&g}mIxGA-nFF8mJ?er>PAwd9V~n`LSKF5G9DPr<$aGsZ=TY=n$XFm4yoH*i{(Y2& zzOw@-pc0t=gB5#nnX)Ms*Z_lH%pj}gPmKOpjo^|4C=cvpL6xTLX13r3zCpb1zUHGw zG&-n{FYyLGVeB3iMlDUXdeskPG#iRYi}_~V>TZPTUnBA`|JS?_C&&>F!-?9Qr#=J5 z9*Ne_aSy~74+X7$3bSxZaC81q6JGqg3qbY6Wh7J}^`Pp&re^)m=74K-ejX(I47sLD%-4JBpFW{1e}9_~%x8UE#8je!{ShTyiW zFcP#DuE~6FO17N*uSsEzyeVn{=v1gdky8Y6Zc_8u7+1?KK6{ufN4b z96ETb%c!H-`kS-KP<}>-qdl%#a;3}je)Jyt4F)$Wpj%*Zna|?b=6KMw9T?YW@oC}d z7C*D;-Gx6fK)3m6JV!N&;7h-&LV%wnj{v_M9iq9BA6%d*-||DGwO`gULN28+&xrT} z)ZUns9#A?yL5I>gR_(;KO#>|m{;Abg{#FNlJ%k!+|fwbYAiz>?Q zX@QnmjJ%MWX|QoFWFdM9w73LaP*)Wk7kB$lJncLPn*i`*_r@NaUBkSiz=qJOkH&0`O{YSDSI%AM5Cb{KMH$_n8KWebnzAm{I-lksb)+XVPR8@3E-x>cwI<&~2JiG$b{jzUa= zyK4b~VD#NqS!*5jZDt$gJIf?xCd`dzAtqS=+nColhEzSW z;+Rx%xmC*_q&PSG1zY&s0CDotS{v>|D+fihG`Wl8*LY%J|u#$3IQ>G^^Gj=WW)i72Cp~T#RZS@kKI>bt$Rt{tyg~ zwn*$xXKV5|3paQZ<1l2Kl2#{W<$fcByHJ<_w<&-?pn7JcQP=d#*>t4>uL~$B6mQ*H z7Dbk=HY20T5F!mZ3>y!W9e$y&0GqAasW<4O2D_7q+iK5vgaa2F2jy8N`A#H!h!XQC>DzvG z5nC<5&uj+sLgL9|(yx~Ocz-1O>&uHbqwX~CjmbT9KCLL>DcP-KTK<8H^b9wWO(g6? zasR3J`;R)B2-B>=_4KRy!|*KnIgu}`A=YQDQdL1BK`c7YWyUOaW>SwI3#C10Mqxe?B(yk&!Y0D38}eSa_I>dt(s@fJ9&*$8pAXDc-Y9EEo}d z49@lYhwDS~{dF7nfI5j>&YvQN`_;~`D;OtwJ?6IN3|i>qg6!Vz2fj_gh>FOi@J zXN=}K0$8M0`-|#c{;A4rfwoeZ3v`hBgnNIm9MM^E9}jVyudpmjR1E`rSV8IxXc_lk z7uou0uL>XR|8J`w&Yk!cy5?g}2p{jkJM(cC`bmRVP zzR#KH#0N4_!(1!<=-*ldU|sY_hg*x`F8y?SRwV-c;!baJgYE*3{+W-dB4wIK_{QdM%Xu8D5!IDNr!1h1m|NvfqF0Z!gr8naLf=ux7m@;}tU3 z>>;x{c$k%`6&0y^9ZD*$k!rT0mecG;lTOycQ6g%Pv2~jb_is<9YhxyO@}m@v)wO4q zG-M%5JVGq~o$yC?Vlf`V>@0oF5X^AuCy{FRG-jLaQid{{Q%xzS1xiF7@cXUPZPQ5E zDw{%>SX)yl3yIFm-Mzvo*k~rTZ|!EmxK6=kB5-`6t&8b174uW^HvIxK>2< zJZ#IXyzkkO3qODMeI&$Ub_*=GA~Nvp`>Hpwu;Jvy`ikJq+bt9b1)ca_3N@x_Jh-FCxzr-)^md(8YL?~lhQH`&sXt!2sf3*pfQfV-GftfAPVFAD26Sc1w z6D7k8_Y=AAC0sl)<*Gr=xtt1Xg9y9n!a66VgEk|1iDX-q0zmD-8zy*8rd&X~t6!lJ zv`4nG#_1u7Mc|c~Vr<|mfT_N55JH<6*UOxRz)ra!E-|}sF@wki!|VLoKDM^5zv!VH zQ}Uiy4y}t5-V9lXq$h;`)vA()a0=MBF)fr@`M3YxmipYwEnbeh|om)!Bp4_ zSXx%yjfooteSeLM zec@RMR^n^Il_5{PBXlMqjv>m4bH^x@30@77x$i-cn(9fjuNfmEKJGuW9kqQQC8=$T zPq)2(_?w(sAA-l<@7s1~TZids6w%saEK1d6PBhjX3)-qMwfN?X0Q(^LMLyZPT~Fwv zMVUq>Kme~AhA1fH#&GRXO;aP;hW=%_Sa+EzkOhTe;p0Oap?jKd zL|3uq?>g!O_%C1WRvufEwTd3nMTS#2(PgncK$6l5wanN7++^G-2-`*$h|#Ic+;muC zMAGmyJ|qK8(YxdhP}UcPcd$E($WH4@2De7EGZ{!xYh-0x$AF~!yA1xuNGBjM5_^Re zz$R%bE~!{s%KNv;nn(Dr4?&xzYyBLC!z#jC0!2W}wxAkAcn;I@WMK^KAVWW1XyWgh zKw*(e0KK%TVd5^`e z2@8hsUCWkkPPBgSq1dQPZ69ATN7L1xfW%`T8NS4SW&jdzGGN~uMH_=I7SdQy_h2k` z2T4kAHHiTt0w2V&5%uW+ZrCK-0Z=#o=IN8>M)}=H#$4%5MhkpHyp@pq2E}JguRT>^0F2ul z1O+(NI@NO_t&d;ML!s}1xSBch?Tke@&`I{>{N3>0px~;(=dCH4|(Ejh9bCXx)Sz}u0AfQ@pJnn!gR2t z>pd7T()V(BJ1Tb8T!MS(1GNkwuaf7s($`8BWTwc+(1O=@`7|9lo3q%)vdrqBN(3?I z>ynR+#tem=Zy5AfC=|Ir*J*TBcQIK+}16S*zJyHnrLz>F73bjA=<%tJC2Z znmJ8}@7vi#oP;U^&ZXD^)Ml#)I1uEu;AaklGq_a@f7wB@-#({}bRPws7E~`YR4r;# z&mw{BjP0U!q6R(Pz$?uEbd9sGWSfWT)p>7MtUXIrPQj>$4h8zm-; zJho1c@~V2S84x~GdWovV4Yuj87dSfC!3Vm}tEMk~!mDJe4GSdme&4ljXHsvNkX?cJ znRP!*hEzu5RPw-tqJj7AW0cCz4LextptR~N)JBNk)=U(-Z|lCV171Ao(y{HSXkEc{}l&PxN6?vFWNz31;TOi8f6e52EEU2F}AicmD`K7<5?K zm??MthgL{}mF_nqH|Sv4VGWF_oxP?e!-!J;;w@;^Z4-Q z^jyc3!QQRdl*`^0Z~tW0VCXoKJa)Oq^0oo?9qJq6)2af_L2~PZ*zdI%l(%(^=zPLVlzl#Mes zG?U#3cvX=0S^eC2lw7Wm)32EV`iWnF!Y>{~v+`~3x0jzw2`Se{Xk zLM~OT{Tqcy?CvM0*ECQkJ2VXyt?#l<69HQd{T$Yj-Xm`x=PJG{9+mJBsv7^S_3ATh z8>iF_qC6|mZ(wz%lQl#3DM%SV^*i~26crSLne1c{=Ad7Xz2^5K1`n_g&E5w3@H=}^ zHsUIx&I;p4|5{@XU44L?nJ9u_%m}}iO+bo>4`**k*3vTrN_#5Zf?$#?G>Bu55dbf5 z3}~F_J?C6?H;40lBo6wTuluyuaIF{0O9L=CH4KmFyj-M=q%b2DF8OwGCe9w)NRA{` z-D4CWWzf-ypY8H`z;3v<%%>XZrF$?7ZAn~RBM&@xH!E?TVs0(GieLZTZT&-WD=rCS zzxGbU$0uO%C}&$F#jP2*B{^?t07T{xWJQsSCP7PZrH|6i-p7L zsh)OxhA-LI3N6xt+F%?O21^t!^3V8Gp6c$?LcME++u@(ztZ$R()ac;iFd*6Ivh?Zw ztvmM2#lR8)r-1YTh#0X(3S=b4d=LDD|h21o3RyV05ihb90hB1C30*iRc(|o<%Bq4+VZRq z)Gg7*fBxv)Mf?Tx1;53?*Zm|>MezwQ$~N}W5YvB#35;0r|8Zp@xt7Ai(lRC!hCei< z7hmf?O4Rv@UeCSc#PJCF56)Lykg?G6mKr`!S7`Juww5&KQ2tnEPI@xC?`J=3#<=n> z38q`e(k@a2ks>~z)5(`iI$fo{Ds6D@E<=BHv=K{2;Ql(}ch=8!;aR|h6u(fV z(>yIJ16u@!8Vt zTtikG*h_k(Hvo`rh)O9a+|gg-E8$bD0S>?PEm6e3G0`ACBTYx?KmVbS?lj&rfyF>8 zO_RmdgIM!rC{v_3(Ltm=|J|G=1*5-lEoY1Op8%*s%}+rjG*1#bVT)rpB7ve00KG%B z%69Ck3Wzl$S}6Ckq3FFwQNn~=;?6t?Pd@B+7#x~YFdAiMG}m(%`3{oxX(uiX*o-AK zGJ_C@-x#xxIX{6rrjX7%6Y>JJ4<`wn)>)p<3rIFQ+Me$V2kxj1tYesN_vBiz69*Z6 zi~>~5L&-{H!^@T{R$qSoe$a~1bOXP`VFlcMMnL=-%nAGIjWK>lW9`Rw7ir5t%{p>p zcksq---6%#g0Kq%olrV%Kh);dCsZ3mKQY0_7QaD)`xOYq=#)*N!U+LFvb1W+8@d1^ zBAUY)L+L<{9R8ugVP^&%CZBv(KP$#U4+oIBasEfXw3)8OBR|dG^W5h~#ntpu3h$D( zxPVa5>C9w_=nGj~f~`d_GxD0B1!+OM#)(@utSF6iB;rzc;LRJg^BM-9N_1X&RE!v) zS(A`8D2g8`i*Y`NGMO`j_WIZhw*`;3PFitgvJfD2yHv~~XcHp^chZvOJR+NsPzE^H zQ?lC@N;sChNtJEWyv(soX0i_eo2B4gC5+8ca5!wnA{t%left1oqUcp|%GMI9!owk8pCdx5a*ry=L%83xGKp=8{fnp$3#u$BFoCoSc&Ft>;@f__ zEGQ#fJOg)Ug-u9#)310F z-SU}>mCf*A({@#^7S5S?&WOgAA zASoAm%|%&kk%(dN(@X-ddwc8DIG6x*yVUtZBk1xVq<1%7Um=~UxSvbpb$D~XEpAoM zm0h`I@Vh>rJe-2~bb#e;2PjC0yfE>0AanBGsEk|gL|Mhf$Nu%NkkIc1BV#bcNyKEt z9)nF!JOG!Ky#pzw^aM^yMnEd1_6>@~FQxMgViTnL`;Q2Xf?-E~6gIv8=NRDk&pAd< zV3qX0{#3I1y+3<~Fblx_Xr=bE4Www>JfST%{>tq>g1>$?bK)@>Lw>&hzX$*S=So3? zsbv4<8%zAsf4`uiCSu($C&aSY`H}#d&^(Y@eHlj z15ikZps=rp;0$p@*=HS&h*rU-WRW+|p5-iYRQ9&GByJ5`$NB@_)dlP{eTt)qOSXL% z6oa}8lApRkT@@*9n{pfEGd^HJ-mI43=X0GLzlA0*K z!6GegLa;f{xHizbE)Kh78l$qoPA$$uu#K2m5oA{I;4b#(RDkoV6cr5kuBy_BsIWP4 zz9M8*b=$Z{H?BYXhIyTTvGb@ES+&xRYtdQ=@%!C>5i`=9K0XUiXvv&yP0WpYW zFJUbEBK7>>-wt*@P`N-ih?v7+upa{@x5S!0DF6?1AE;${WH7=^G)Rv0Jr!#wp9Kr~ z8K_)B3^Agz%~hj!Q4LmH(5b&TYRy?dmq_H)+Oh!{`Y}}NQ~qxHkH6NZ0^GvI(daM~ zqo8o;1KjlWDA%`uFOeQ8C_SO3u$;h2F^sE*I9H8~T6zI?-79pZ>QR>ULz7lau&wDjbVq#{uvJ4Ot45YB znh-jhT69%An~%K)mPTTQ0yHF=ZbpU`V>~RzU7VKyiS#m3D}u zw*1l+qTcA^Uylz-zt5t3az20IeYQ0bp3aG^JdyH^pKkjV9}8}+#y#wmd%q{-a=Y3K z%#&8xT}XHhFLixNB93;n5uToEb3Bpq#GY^anV5TSZNyy=)$_b3_*)wZoN*IR`z@05 z|Dc5HKd}F|Wc~r5gzmpJ^?z%M|33X3WNqi4_hZ%M{=o~|vL9JY=2{%L0eb_XE4{6W zz?p28g}~Y7#;D(7#-D`G@_V3kebC%+1?B(Q80b*qaf!P zcP*|1iflbDl$N!T5Pr2=J?_o2ejwN*g0l z-nb4{yn?9)#DR(@?EkaL!Su74_1|V01R3zkp#P#PKsXz?LdNGmIR6LR|6uYTbpC_d ze~|qTBH6%}4!*^}mh~<_xUsGVmcn6UA#&}uF%mq}T_5#d%wV7MU;NXS09?W1ObV)e zd?^a5YFvUAM6p>7^M)LKc?#lPWqLveyP;af?HdAp5U22Znb+boR ziCB{=4Ym`4cz3ERI7B_!)^+VDZIx%EsIEuHkrAi!>MtAqrR3+@re}{6_>r5&C2QYe z9W9qq7Z(OEZ}GS-VYN@1y_z*;mKF5u5x_*94(wFdmURp97YiSlHFZajC;Nany7JsB zM?*e^g!@i-$5DQyqYDn%H%ppy9hya25J7Mrzr&10J4LcmK%lmazalJilxel*Ar91~Klb z-*b0Q2e{T+Iyyh(R%cOkC?LPIYtbH>PJ&>_HGZVX9isJztQmP4lZv(d`+(f~1ww9{ z=?bueOBA`De;Mf;LD{woPUMGXxgW6q_ed>NcT_%q(%oxMF3 z+62CA=_euT3hRoqUTvou5}4fZ>i;T6kfS`O?jBP-7bkS%1=DLICcoj$Y;yc&bqKFN3X_L=ZeYpO60nxbYFuk;&-(!N*f>J#JfC_UA>TYO5(rql24L z4Q5n@rQ|060}c^6Wr4BMsLu{C3-Rm~frbMy`N?n`&13SSJBrfuT6*pT^gXQGug{%d z*`dkQz40$Fr0XAw@OZ_DySq1lRTVM#^?`X)>!8>q2-X7#e`a4Y2(j$3l^Bo#WTJT3 zC=p15T)uQ=YQAsU0W0CR%g6kS0|LO~CDA6xOr66zEAPiyOMAHdh=)JuD-@v zyhB{Nn#WnE6bp1*Y7;>Zni{=MRkeyl4+4YZm$yO82}>FrHC~?TN^QtBpOW2#Q>b z%G#Xl7x;W3llFA$-8@ZB;GKUqQ6H+(`=O;=Kd;;=XG`DlT+99VrPHhc?8~xELCK8B zS@}TEn!HZJMR^=7b&;*B(9hY=Vp%4|ANpHrfflK%9@pvb!>s~=NXE~A9Wq`VmFl*b z!x5;N(k0)whfJ=-Ob~XN?1ID82Ue<~?J1Epj=xEpq@%b9Yg?ZhaDV6T3Ci@jh6y@Y zLjB^e{YWs9cN!z<;L9fhoEMxT22kUDfYU6>ukF4Q#g`&I%s`24;dB8JeU6+*?!V>q0ed8oO_Bhm=u23tYry_nz(}9nlayv z?R+QERdR@XiBQ>6-kVUx9D)9L@7%j=A9Y|J*gVb>eH^{m{+}$p7&Yno+v&-DifEMXj;q zBNen(X)G#}Knh7^=0nvhD|!(KXv6KFNh`uF0S%~_dlbCOydWdv!8d|hnIg7vg}M~wf!EQB=;B*8lXFM){!8yc_T+a6O!P_u6HKa! zXOs$hK~uK}7{uX{R`G#yns#H)lJD(3-$^e_1^;ei+KY(R7VW*00I(AK?3HKIqA1O-%SD!UY;MnE!U#mWf#gLx zt{Wjk{-l$UNSFAByVa-%r-He09hqekNTN0n>*%%s3e0qp_yZd2uDs7b9LD-cExRDi zS{8vHUvxSm-S@E&{_>x-07PaO) zT{;w85T6jRl~})%jfIIqRUUmN_S#ezAuYT#>8J-X*IRT)E+?HjGX29;!QItWKe3*sFH=GGWwSFO`vJh@%%Pfl8yseuaBX#gJ(%atq zh+Go0cnR{Od04YRi-}VK`1z5J<^gC3hePoLMlUd%Z0iD7P>X)93vsl1~A3B>mRb@8+0Fgl<&@hE*WmyLt-eXe~y zL)VrrB*@Iud||gx!v0iI-Mo@GypTx*= z0JJ+)+V34YuoC0$%q4Rxm=8!=y_b}Tv;Ja0ZbHr%bB>4zK_+FvF~yON$@EU6IlA`& zzA>%JK!YYUYQSY^8gha7ZT>eR0f&Q0bTOs((5W%_jqota2PC)bq|1{m6oAYCU{I;d zK8kwodeuXV0c|8ff|HgWg!7=96_zg~5|xT5mK4EOa=vux^J2;w#5$X68ew)5C2buY zrb*{}eHCr&+Q`WWe|vst*X&(IJZlpmO0X3ipPy;PT4U{XX^tIp7uZ`h7}}8 z4gb3T-HL}$@WqkT>4S9vp9Xa+7N}VNIfYOBND?{h*ANc{K~8D}@fXd49?ucU=s-ki zkdlOeUeWn-){w6!3*I<2@?>q}=76(dzEexV>_*z|Zv;|&Op+*N;rpW#fHy-n|4Jk4 z)&k`W4ioW9D9|N(Oq(|=IL!!nl?D%_Gv7uO=^w}2Q6VxokvKCM8%{00RpQnuVO;CJ zT(se!Jl+fwN|ys|oBIZws?J*$)E|d=!XaAReV^Q*F8f9wD09ZD_x_T=E(N5>(>q^# z-maqVxL$%-ktbz$e4VxuZL&2f#1=!X2uHYiJ^$UfwCf+zKP;2CSd)gh)H|>R^#a zN~^T>Y|+rOEvIpCA~ky7z$C@AQ)$4PF-P)F9n!!nN0)OQSovrtdS$NqMJA}AZejl` z*m>o9MUamuTzLTNyX2ttY2(v#^o~Fgx@a!xs}@J8?80*Md;p2BDfm@N2=B(cHLDbT zb$P9b_9+35AzpE01Q-B?>0E(g`n#48vn7%Z6ez*@KR<{MWng~Hh42RlM*r>9=$*=K z#{B^_1i^F~fKyPEX&uYnFgpZGsL1xuaBg3C{ zVW`|ELi(v&C<1&>Xr+loKCZb?gx0xIpT2eFFm^>Oy}Sb$D1~6b7R!A?S=ky(5~&S! zO7lZl_lqn@`t>X6nKe=@=IDSSXz1NFc4UvQ;lKFJEyyloH zR~b5=>Q}z*=N7O}_eoYVK|bvbXS@SCw(h{04aZcCllPUr6sN z5URg9t)&(aJ4Va=N>;-*vT5kHmBjK{Un*jGpZ9QbLPl>RhnN;kZ=BkqlUg_KF34I;(gsI^Ph zcS4{%Fz(y7^IO58$pu~G7hwC$?mD?xnPM$(V!IHVOtf zZdm|?@q`Fb*%_KtOv_e!2c`UK`w%H?da}EwM3ut#Nf(p9P*yUX+aS#kQAJR|C8v*q z(@g2FygQAW#t^4%Ze}bKH5^lL&NAsmSCUAhoqX?hKm+HOo8RAUyc4wXdrs(I?4Y7& zWt|zZX3X{|dVCx70A-1&f4xegdg8mFwZH*1UQJty@XQ+iUQu+UX7bRtihE%#2q@J5 z@}Qp251deVcNm{ucdcd;6Q+}nlhaznA1>eo=7M2agJ3)-@>b`?nkw*E=Kb0Cot2MM zu;ES3z<(O`)a-^I=E8VCnOj8gmgt(mPb%P5%}tf`OwciBG7)iP6Ncn3q{&H@$_D|{ z$#B@}KJ}!0i^2gy<8O|Rpk*_1AbSUS_ytrN`0WO@aIML_n!&hZM56WTjqOzY=#_&o zq7pK~g6OrVGBo2!Gbe=h&j)S3#ji%Av}x0Gf~L}1X(qd+;9m5d+J+7Ay+2p_qGaXt zgRWi-yh0IfO8?}9_bA!$X^cv<{s{sCwzHJ@$CKJH3~bFG6p-j_SS>!o)Ca260@y>A-FJ2(#S(yaEtBrthv zux<{Dapw!y__}FCj~fBNR)0wT)Chs#``&E=(hU8xvcMg)ZwDwkO#&hA;2OOii?VI^ zS(E&^y5HtdCp5)iK5C(-MSNLA(QS92X7qLkgwS4tE%P-a=z<|TWt2mvsN!2$w^^SCl%s+U zHi|7gwl*Zdbg1ACtZ={v)CiehHQ)GT!OHly=KZg(zB(+b=Z$x1kPd-eT9AQqeoq!!q*z>f#9*c+TNs#DDl7ARP1bO93j9Lw(fPV8eQw|F4}QzZ~jQa z7bO{Yh^<)aFjZL{4ZA_Fuz*5ZpCd^QrLEv&G=h&Qn!H=@NC)oOY5iEdKD&!*>9g|seo{*~n>=?6L)<<^Tz7a?x~f4hd9I@jVu zg{hkIZ$yi=sf#Xu`lLlLL_^beJ-DIK>fZY8=92PeEh?#`J}xjR;-;3cS_)*)dB9 z;)OF`N_?k(_B4y?`3X{*&==n7JxfKnO%9(8)`|+GCRFrF%$)V>LxI2S(JX}w-YZRM z=)tK^_|8(VV4D;8I^Zd)rms$Vi{3sCDP^95IBN_rcimuoI|jdjO^ zi%v`hvCf=%f)AA1NIio%HaK!8`ZRK<-8}VIWd)fyun*s#J?~qvXA~$elE+PkK2PeC z>_`?n-m(g)HC@*0$^7Ui4&k zX&cEYa8G;||LHGtS3|(s`zSI z!i5@$wlRaj_;K@21P!7WU$kJq>cR3jxX(N3-ASO13owQTFdsBK%gBks9-5>VmM!Wl zSLXjmCB)p90nWwks1-bH(t}Aa^gZF1VRIr?Q@4g8jkzI;Y&(A-@qr zbD^I{)RB#sqXg@4%!%#o+PdT4s~ARWD6)lLXnQc| z8b*)MR;m)IJegHsK5$9tD$Yv(csAs&SLituClnKNoZM#i)W9ZW>Lhi5K#WC8gU;Y9 zjr90jb`z>gMdwhSMFGVj3S&mF>M@fb%s2r4viGGMN79EWRyOJya zP^d52tGV#gv23hKrLa~k{q)wG-(~E#Ix}j~(L;uHUwZREW6L|4C(s1i9-7 zdm>rJ>!`@+jA+&mmO-D1k)2Nqzo9Pspu<~b#qd0YtI!5n9($S%5M_d`W*?qdKJtnn zwpX{~m%n0unm@EHqQ`G65TF9C`SPIEqGH>Ct1k zG`RO;DkN__SK4CAn%6`DXDc94C}R9%#v!f44;+1}YMXYIuLCn{0?vYU^AdhbVi@4? zD1e}3r+z{R*!rs9ZX!3G;8ZszL|*IkJ(j||V5)O_{b7}Q!KW#$Y1^d$V#l1LiI>w_ zroy8_IU_SKK8#5v*(KWg&o$P8VdU|JCr)JmKm)>(;gQ$sbq9aJAAS#?(|_xf`1?UQ8MZyTXJA9rcpyZt-IGy zyR!c5$UVvJpsA9lIkr2`@0Q>NVhf!}C?|2}{61=4OY4uw z>#`iqofdsn>XaJ}0{i)7d)pwimQrjjkw^hN0jogkwp|$teAi%$=2vTp3TvLAr$193 zC#Y3++Ut@9F>eJvpyJf;B{HGoNATLYPO$s?+hYxGeG36k*fSsAI6rV&0!{4v4r(Ue zsSUcBNh^ONL)bZi;E58*w*A`W%ZGF`NPsr^@!nBD{MgHp@Z@KH(I%iC{ zW|(~yEC7>z6Sm(B4g)sQ)xKnbxD`8zDj09O_MI|6HZ{PuXB~|W6nvBbmHqBm79WqB zI~3V{=0@V+ny@eTofNy+({N?$oznv<@Y`bK$0A(zm7=(ZiV%jpdJ6eZw3SJO9uYW-*H)s~gz2+X-Q z2l~t9JGPvRl6WIktWw6Y)zz^xU z>6M{rx9XvfWXg#MEImCJF6mym3GEcx8bfIX29AV$q47u*8@|-DnXT)2m2`1kLevZyr`ilUT(FSHj;j8)C2A)HKVvLofP)U-h z)41p-1{P5MF(G+dB1H}hP$Q1(+f$A<@D7>#z~U=loaNEp{}bcYVl|?PwMVJ++QpcL z`~RNhn2NgVzcaD=fPL=d5nn<;Qf72XCnlfA3UFBy7ahITyn$8g8-jKN>LVv{!cC*m zQ+F_jrIgiJ0frOwJB3xi=R9=VWE~+J$bP)#>+`Q}8UF5cA#-VG+P~Z~oZq!Qt(nU* z+`{8)rs$U1fnzZf2G_H;;!1E`+bsENWjx%$t2i*ImeI%NmJpWyC`;%jf?tPtu8WUq zqV0V2Y!@QFdoW_DchnJoxb|}dx5dW&ZGiViqFL#IS8_Js_c8M3)b zdKq@~!?XR258h7`+=fvet+=P=Sri0Ie?kY=n(Vo>KcKfoF-IR+;&iH`tYt843cofk zF5&NM1DS|7)}+})g-XFQ>gQ0H3On z!TXT&+@-E!CLZL9T~#-z34K%kr4GOSKu^b*i&P*j&<*% z8nOj;R?~sv5tnV=!A)LnriVB7InZ}Pb=(T-zIx=jP`mUObYCZIyUJqcWYr9CVNYo^ z^4hV!GRL=?iuClB2w}9fj($^;q*f~@($7)Sg&{KS9*!*TZCYxgFmhbs%s$o{eTYrU zaXOC8q<6ijFa?6y)&tVF)cD3$U`)U zZFj7N@e{iToIp{@#<O8^|6{svuhQ$O zGT90ReU?xOXfR)?;D<=_Fj<+I>HaI90&NV#Msow+?&@z}*8^MgMd_>;A5k|&P^ogi z?a5Dd!}y&H3iGJJJ!g6EnPtQsCs$`QRP3LUd(VHckx9Wk-8X>RumXSWcXW_d*0AC= z2i_vI1l*LtY~MnqGnk^@kLplz^)m3-ri4~J>jLkl*yI35(y|_or6H=gE0(iuoR%73 z)QHXYM=#O7qri9n{*^^(QKzG_BC4VG@O5v4(HAH=eTRRO^oxv=z9D^drAFKCufL=q zVldB{U06)QmtNH&f8(myZ5t)0{VA_6Y}?PEPH2RuYra2w*Q1wN%l1s0Bv7UI>d8rX&=zhC%}`Bi5S^$X=620waBJS=uwN53)YKbqS`)&Z}@ zRz3BMs>IxI=NZr#vbi^jYt8FtjN+>-=Tb{Euar+2ZeTU?47O0C7n%Z@9>09QN`2rm zgre5;4rT6NTcTNeM0d>04aQ5x+*mRSN@TWiNiP$4D;m@=(MMUAOKCJKU z$g&TJlo+Z5-e8Y4<=E{%gv+jpox zlsYJ6O6(Fp>M}Gk=y7oHT=3^Mo-^}>3TNnu+Q->Q_-0s!(v#i^l)_n$IZCbJw2cM4 zxnvAv%)_u)M&&1u?Y|QzDMf9dkZ4aA&ATH-!rGek_NQI4r)R5K`*vmAbl)mm>LO7&WU-8G9I@>EtziTHWQ>8`7`rKKN!mIx;As7+W;Ih#ux@!cg_4w| zFpe%Oc7t?K_)GGa>=~=!kYhy;ys(7jD9%1oc#k_~=Ih*L`FtL>5mwG~uc}wfoQq@ZtDkaGb8rU&Krs^cXfOy<*ZrqzCtH`rH?!M{i>d) zo!jC5ck*~EWy-Wa<@cS(y#gN_@C|y`;(UK_q5H&53S!PP%=%5c`k8a=xfC|*n^AnZ z&)nu9WY4!+1s>uZ^A>DP5efQhE_;y=Z>99lu|`0y4|-|>w7z2T&k?4Q^b)ebp&+x9 z-&NcKIwVLJsh6c~kwysftmz1j&(F{|TB~?Fg#!*(H#=UHN6DBB@uRkY|E@QYhcrkp zL>`CH?LBSkW`Xl8dNkd`?tVa3noO*JLGrwN0>w|oq)(61gz*BUFl!=b;Q{Kh3D1)j_w5#9H(Yq%T z9)QA5PnTz2vc|m;>&XvtwIO*6>s~1_ip;@@>LMno?WsY)Ci=l?D6e5|1Hh{m*We}} z7T8kAj|RtbGO|^<8R26j0hYp`e;MiDRqa+!Dcq8;DXHGF;0;Pw&-7)IDRs3p+8)?F zO%HLQ2f1=`3)q$adM_Pqk9huB!P?wDyk>i zd*9TXryPuzm)XnkMA5P;p9i)=G9ZbLOXo|W^n@x4S4!P8MFks6nJ$ zdEK{mW1ev~J$*q7;)y&>x<8xilmb`n)&yAmes+YAZXtaH=2^gF$p9Y@G1^D>i-=8D`r;tv73Q7B zbY)L@LSECyf0#pC#_RFhKJX1_`BJd>()T=htu$jJY34 z?8z7^1T(Zz`Lvi4=N6BBHvEMA8DX|c<4|sWL~KU1_yV156bvRJt`&C`v3VeBw8NI4+PRIzMi!*iG6RGerRS+b9Ctn^c~fIYynx?4FlJeTFg|QzR(}l$lwZsD5*a_$BSknuYLwWnf9^Ktau|aS(C*n zDPe*lx#&%%F7yk365az#j6ENP2=1j-<{k)XARC)j2_QoA%+FCrx6(v#yKo12-AUBa zu_fezBWdC({2c4iW9YcaW-#v=%F6n+w1)RH5EWUFY}0Fq%KQt=%BK2omV%AuI@E2AezT(_E|yc$B$^V z&I?0UVVi=6WSdjmJG-t7nbl+Oj9?%gAFps*F45^5eD|G; zQ#^)$%D|IMYI%@DJf#nSM9}Z$NTNY|C&cHsS+Q0T>Yn_41o22q0S-E`3M6(GU=lY0 zxD8u%8oPsjEg#mcXlVbp7v9&4Nj(0Y!c2E zQ^dP8DV|7F8J7I?mQ~Mun)Uhce43yDMtIzQYpk01o1TSEK)C3cpDvjuEM6 zsxvuTm80W@29JAM2;^Xv}&F1TgvvpH7fW?7;NCs>LBTt5E64}}w~ zQ~U*cFGh!*XDhQMTaD8YKjDhgI>9q1 z^8*j3Ll5VpnNFmG*$IOEnztTm%Z7p2IYGYphM>0lVr5FEewLV0edOUXGUgQ_c`S#G zVf@i5c9@qzC;?Gr~R5FoIj%PpY~*2i6Ugny6Q`tU=XyM8rz+%p3H$D zPa}pt<6JN&m;r7usWo<>EW$?B!;G^8QS3E}cEA5%ca6T@p z=cS(HuI1~vh(bKw)obXUmRRL0CX9D)TZ>u*_*AF7Nh*hRn>(Uc3r=+6~KYAKm(B6{V&Oh8;L#& zPL(ZsUn`0WLi94ZCr32!m8x;#Z3;RWr$e!-zGCIt)ZkQ2Ik->SXkK|6BE78pK4@GN z(Uka*YYa6uA4bFpAT!l@T*Ii3ZLr4@F&Mczm#$`^kGr<8ePt1O?fM66 zUeaKf>};u!F33#%N@P)qo-K;*@kNx%#Z$6nmf>1vu4Rj?bOu{Zash)9?zbDnlV29o zo(javXnnwq`FuK-?afr9`T40jN~+RpanMdrFv}O(o-JZZ=%YHN*S_fQgZEv3OYz%D zM`d5)K_>e1{P3#y(YJbnnK#oFpGu;Ns~k}VTHys}AKFuXDx%lhVU**fM_W03)fxqy zgqDEe_NKz@aVif>cc?3G^mj9j1pK836gKUj{+t`ZMeVmFWuNu0BZ8C7J3rC$uN+#+ zt5sNNB+x9Ge}r0hf1;P~d@RuMUbH7nKP{|Q#pU@Cyb^<>HCa@)x_`X~GsV3B6TL-e z2X9ZRsO)%5v~{qk+xxE-sezIA&(IP41va?4RkCiuc&YG2e6HDSQCafXXp>+Sw_r60 zMTc$L3KQ&4D)OD*&bJ*vRX%MLcbI>`=Q{Q95_gnFr{wuW*95%i|^C6!DEi z`p5k*FF`JS;LL_7NuO_5s~_ud#7=PpJfP)eL##*^Y$1Ci-+WG5x8K9ZYK9W~DZgSh z5n~@K1bou6Za9<_ zTeLMn;&V7tu*chnK60EY=zHEe`4*A z3AVZ!cvM|Wu%muDONsOhh87j;WhjmyyQU`nu0Z{M=u{H+c2xK>jvxo|VIoIgqS?GR zO?}44kXHq8esr;sYKhO)%j-DknfAsRT1zCY(ug{V&*KmILKO}GzT&h)Wj5FJ{2PaO zC>ne`nuS3C-=G466qd1{3ND%gyqbkkQCXRm78Q;`0SH_#PG3*VpRMnBzj?)gTvqf5VKJ7Fwao70|OamfUXOarCTZZLtJw>fLR<#(; zq+i3o995YV-cx14r$?}ItD9Ess=~+D=8ewtcqcW9ke1EvBrEFy>r8)0uSU`3*qa3$ z;|UsJ+*81t$2k5c-DUxEA)xmP|1#MJ(g!dJ_W+pS?~yfEISmLLs4^yxu7iVTTDW6d zp{NT$q=MM2cP3(vMC$=|GsSj)V2T|1f4g*sJ2nW4+A6%OTCgzJ&Ydn4Y6*B)64+H` z?1Zm_Q9o_KIs>JHS`x2D?P?1y^5D>6%|q2qObteWgE+up7;uPpNs8SR1cbj~4p^^Z zV7kcja3}~ef$-*N3=z!(Y%wo!&@+%QjW)>{fN4Os$V1P%9ct54_1JHz^? zfo}9bWBJ7$o1*^rK>)mmT%yYX-V4mq0q61(9o!{G`~#Pxk$J#?HU)aeVmDLfRQ+<) zj?os#DV0KfwbD4{_Sjh1_XD>v7$ZTB@yqi0AQUl=NUI(=B20hq$9_Xd!C?HeVJwT?W?B-#L{e?iL zL;$uZP}Cq6AO|j*C#nUXGuL3%PiFEj@-RSS?ZB`*KHLpGOhCe%c;31is7s(bh(pEvBlYqHl$mee`%+#=UT&z`Js2Ia7thjdV>a-9;;KsRnU|@)krBhso|OrS7tpH z^2PH18^A#Q%6i=20Zao225{G*PSg+27v1ZC|8r9G#vmvV;DQ+lfWia>h#|iXuv6!v z0|Wr(LeC1I{=gmZvL6*^H`Aixp~h$pjK|>AKPjE`(m@GuYPg*~i&#FKNYhnqb6kzT zOTe5B7><+pKoc)nhyqBv+^4W1qWN&lciSoB1F4E}cJ1b3lJZ%9n{dh^Oymc&0dftr z!A>4%!={i18sOq~PWl3nJSD}JK=7uA`_@^A;a@3qRXNQIyjEkZhOy6rsjxgDBKgGp z8!+`*FeMat(|gkwEc16W_~b z8lN(_;&69Fx=^G$x2LLbbr;p|Ajat>yzTa+^l*PP8_y|__6(xr5*#s51< zQ=Irfx772&zDmFr0rfO(vy0L<$9SV!{#DOK*3=(0q*$XZtuwQ2Tdu@jOH0Szk@e91 z*DP_L-(`xsQm$ugSATPgZ?46)sp)$0JGNe&_y&_;r=20Uu3`G3K~iJMsbQ8j)Af14 zPCKu_z8?z#vz-d;(*SY_$Fgp)CeCzo*>JI@-GFIlp zUi9=Q={VcwK|lhb)vdKM|lS%?a0E-dr+U%BuUseNcaP(@gz!)sYG_yB>-`ED(r4S#F7VXHlb0 zEMQxiYY-fV`A|FA^ds5f$OHKs-}tcz&ZvA5G8#kgcip~SUYbh#gNnLTgoYI?>=-jf zb1#0hM>;KB2=qyCE zX90)2agP_I(3&jstniHc z@Ai4am#O)x^Si5yH`ywf@3#zVC9j+3)>QcWEL-bTC)+80by{wYtkC&gjk;w+jV3A- zOP&5{Q+-2cg<FpZr9Hgx(~aO8Xl5u*>d;8r z60E@HaR12akV~3*4Q+AONlx>C<`5+MI~U`WH5$cKv(DpJdJf5!6bLz7RDV-Nde=z0uTJPO1=h8ANd<;{~Emd7u5W|0T*K5 ziXyNfd$%HA97q<*EuzJR@KW9e8DCMMmc#&o-sAm8$ej_Qjd5$%!wTWM1=p+)ky{|j z29du7P&UZZTL5Q+sNVv{M|TphM-ZJ`$-pDX^IHJiHp$@X#Qu#3DLg=!JKzGlbjIaTZu3i zXz|=Bm+;(4uy`TQZk0`WAx5{L>7Rsx?~aDuKTyvHF}u~F5ZPPLITCloRwN)ww-O#n$m82#yUoVe21^iyki!xsAuP9b zjgoiW${=;;$nGB~{|C9VuK<)C zU=j)tCi=fl{x=Ey|4z;iVSx$|*8fcie|r}7{1Vo!a7S<#@P)Q=1%?q_gCQ{1#}K?* zUQLQ^&NToT8Wa%d{{Kh;XcDIL7{YYR>&;`p_U8>4hP(k&!EnUxY!?GMDF4~g{Xe#j zu-V5Du3K9|MW794Fm^=<`)%0(D5Ig{LSS6DkpFz$ia-BV6M;1 Date: Wed, 29 Jan 2020 22:38:14 +0100 Subject: [PATCH 277/784] Add fields array on common objects --- .../facture/class/facture-rec.class.php | 76 +++++++++++++++ htdocs/compta/facture/class/facture.class.php | 97 +++++++++++++++++++ htdocs/contrat/class/contrat.class.php | 29 ++++++ 3 files changed, 202 insertions(+) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 5480142ec78..593721a6f17 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -93,6 +93,82 @@ class FactureRec extends CommonInvoice public $suspended; // status + /** + * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') + * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" + * 'label' the translation key. + * 'enabled' is a condition when the field must be managed. + * 'position' is the sort order of field. + * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). + * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) + * 'noteditable' says if field is not editable (1 or 0) + * 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created. + * 'index' if we want an index in database. + * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). + * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. + * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). + * 'css' is the CSS style to use on field. For example: 'maxwidth200' + * 'help' is a string visible as a tooltip on field + * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record + * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. + * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'comment' is not used. You can store here any text of your choice. It is not used by application. + * + * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. + */ + + // BEGIN MODULEBUILDER PROPERTIES + /** + * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + */ + public $fields=array( + 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), + 'titre' =>array('type'=>'varchar(100)', 'label'=>'Titre', 'enabled'=>1, 'visible'=>-1, 'position'=>15), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25), + 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>30), + 'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35), + 'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>40), + 'remise_percent' =>array('type'=>'double', 'label'=>'Remise percent', 'enabled'=>1, 'visible'=>-1, 'position'=>45), + 'remise_absolue' =>array('type'=>'double', 'label'=>'Remise absolue', 'enabled'=>1, 'visible'=>-1, 'position'=>50), + 'tva' =>array('type'=>'double(24,8)', 'label'=>'Tva', 'enabled'=>1, 'visible'=>-1, 'position'=>55, 'isameasure'=>1), + 'localtax1' =>array('type'=>'double(24,8)', 'label'=>'Localtax1', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'isameasure'=>1), + 'localtax2' =>array('type'=>'double(24,8)', 'label'=>'Localtax2', 'enabled'=>1, 'visible'=>-1, 'position'=>65, 'isameasure'=>1), + 'total' =>array('type'=>'double(24,8)', 'label'=>'Total', 'enabled'=>1, 'visible'=>-1, 'position'=>70, 'isameasure'=>1), + 'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>75, 'isameasure'=>1), + 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>80), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>85), + 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>90), + 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>95), + 'date_lim_reglement' =>array('type'=>'date', 'label'=>'Date lim reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>100), + 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105), + 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110), + 'modelpdf' =>array('type'=>'varchar(255)', 'label'=>'Modelpdf', 'enabled'=>1, 'visible'=>-1, 'position'=>115), + 'last_gen' =>array('type'=>'varchar(7)', 'label'=>'Last gen', 'enabled'=>1, 'visible'=>-1, 'position'=>120), + 'unit_frequency' =>array('type'=>'varchar(2)', 'label'=>'Unit frequency', 'enabled'=>1, 'visible'=>-1, 'position'=>125), + 'date_when' =>array('type'=>'datetime', 'label'=>'Date when', 'enabled'=>1, 'visible'=>-1, 'position'=>130), + 'date_last_gen' =>array('type'=>'datetime', 'label'=>'Date last gen', 'enabled'=>1, 'visible'=>-1, 'position'=>135), + 'nb_gen_done' =>array('type'=>'integer', 'label'=>'Nb gen done', 'enabled'=>1, 'visible'=>-1, 'position'=>140), + 'nb_gen_max' =>array('type'=>'integer', 'label'=>'Nb gen max', 'enabled'=>1, 'visible'=>-1, 'position'=>145), + 'frequency' =>array('type'=>'integer', 'label'=>'Frequency', 'enabled'=>1, 'visible'=>-1, 'position'=>150), + 'usenewprice' =>array('type'=>'integer', 'label'=>'Usenewprice', 'enabled'=>1, 'visible'=>-1, 'position'=>155), + 'revenuestamp' =>array('type'=>'double(24,8)', 'label'=>'Revenuestamp', 'enabled'=>1, 'visible'=>-1, 'position'=>160), + 'auto_validate' =>array('type'=>'integer', 'label'=>'Auto validate', 'enabled'=>1, 'visible'=>-1, 'position'=>165), + 'generate_pdf' =>array('type'=>'integer', 'label'=>'Generate pdf', 'enabled'=>1, 'visible'=>-1, 'position'=>170), + 'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>1, 'visible'=>-1, 'position'=>175), + 'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>-1, 'position'=>180), + 'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Multicurrency code', 'enabled'=>1, 'visible'=>-1, 'position'=>185), + 'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency tx', 'enabled'=>1, 'visible'=>-1, 'position'=>190), + 'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total ht', 'enabled'=>1, 'visible'=>-1, 'position'=>195), + 'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total tva', 'enabled'=>1, 'visible'=>-1, 'position'=>200), + 'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>205), + 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>210), + 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>215), + 'vat_src_code' =>array('type'=>'varchar(10)', 'label'=>'Vat src code', 'enabled'=>1, 'visible'=>-1, 'position'=>220), + 'suspended' =>array('type'=>'integer', 'label'=>'Suspended', 'enabled'=>1, 'visible'=>-1, 'position'=>225), + ); + // END MODULEBUILDER PROPERTIES + const STATUS_NOTSUSPENDED = 0; const STATUS_SUSPENDED = 1; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 9172993acc7..f877a353003 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -221,6 +221,102 @@ class Facture extends CommonInvoice */ public $retained_warranty_fk_cond_reglement; + + /** + * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') + * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" + * 'label' the translation key. + * 'enabled' is a condition when the field must be managed. + * 'position' is the sort order of field. + * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). + * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) + * 'noteditable' says if field is not editable (1 or 0) + * 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created. + * 'index' if we want an index in database. + * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). + * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. + * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). + * 'css' is the CSS style to use on field. For example: 'maxwidth200' + * 'help' is a string visible as a tooltip on field + * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record + * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. + * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'comment' is not used. You can store here any text of your choice. It is not used by application. + * + * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. + */ + + // BEGIN MODULEBUILDER PROPERTIES + /** + * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + */ + public $fields=array( + 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), + 'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>15), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1), + 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>25), + 'ref_int' =>array('type'=>'varchar(255)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>0, 'position'=>30), + 'type' =>array('type'=>'smallint(6)', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35), + 'ref_client' =>array('type'=>'varchar(255)', 'label'=>'Ref client', 'enabled'=>1, 'visible'=>-1, 'position'=>40), + 'increment' =>array('type'=>'varchar(10)', 'label'=>'Increment', 'enabled'=>1, 'visible'=>-1, 'position'=>45), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>50), + 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55), + 'datef' =>array('type'=>'date', 'label'=>'Datef', 'enabled'=>1, 'visible'=>-1, 'position'=>60), + 'date_valid' =>array('type'=>'date', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>65), + 'date_closing' =>array('type'=>'datetime', 'label'=>'Date closing', 'enabled'=>1, 'visible'=>-1, 'position'=>70), + 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>75), + 'paye' =>array('type'=>'smallint(6)', 'label'=>'Paye', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>80), + 'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>85), + 'remise_percent' =>array('type'=>'double', 'label'=>'Remise percent', 'enabled'=>1, 'visible'=>-1, 'position'=>90), + 'remise_absolue' =>array('type'=>'double', 'label'=>'Remise absolue', 'enabled'=>1, 'visible'=>-1, 'position'=>95), + 'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>100), + 'close_code' =>array('type'=>'varchar(16)', 'label'=>'Close code', 'enabled'=>1, 'visible'=>-1, 'position'=>105), + 'close_note' =>array('type'=>'varchar(128)', 'label'=>'Close note', 'enabled'=>1, 'visible'=>-1, 'position'=>110), + 'tva' =>array('type'=>'double(24,8)', 'label'=>'Tva', 'enabled'=>1, 'visible'=>-1, 'position'=>115, 'isameasure'=>1), + 'localtax1' =>array('type'=>'double(24,8)', 'label'=>'Localtax1', 'enabled'=>1, 'visible'=>-1, 'position'=>120, 'isameasure'=>1), + 'localtax2' =>array('type'=>'double(24,8)', 'label'=>'Localtax2', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1), + 'revenuestamp' =>array('type'=>'double(24,8)', 'label'=>'Revenuestamp', 'enabled'=>1, 'visible'=>-1, 'position'=>130, 'isameasure'=>1), + 'total' =>array('type'=>'double(24,8)', 'label'=>'Total', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1), + 'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1), + 'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Fk statut', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500), + 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>150), + 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>155), + 'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>160), + 'fk_user_closing' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user closing', 'enabled'=>1, 'visible'=>-1, 'position'=>165), + 'fk_facture_source' =>array('type'=>'integer', 'label'=>'Fk facture source', 'enabled'=>1, 'visible'=>-1, 'position'=>170), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>175), + 'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>1, 'visible'=>-1, 'position'=>180), + 'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'Fk currency', 'enabled'=>1, 'visible'=>-1, 'position'=>185), + 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>190), + 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>195), + 'date_lim_reglement' =>array('type'=>'date', 'label'=>'Date lim reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>200), + 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>205), + 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>210), + 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>215), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>220), + 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>225), + 'situation_cycle_ref' =>array('type'=>'smallint(6)', 'label'=>'Situation cycle ref', 'enabled'=>1, 'visible'=>-1, 'position'=>230), + 'situation_counter' =>array('type'=>'smallint(6)', 'label'=>'Situation counter', 'enabled'=>1, 'visible'=>-1, 'position'=>235), + 'situation_final' =>array('type'=>'smallint(6)', 'label'=>'Situation final', 'enabled'=>1, 'visible'=>-1, 'position'=>240), + 'retained_warranty' =>array('type'=>'double', 'label'=>'Retained warranty', 'enabled'=>1, 'visible'=>-1, 'position'=>245), + 'retained_warranty_date_limit' =>array('type'=>'date', 'label'=>'Retained warranty date limit', 'enabled'=>1, 'visible'=>-1, 'position'=>250), + 'retained_warranty_fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Retained warranty fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>255), + 'fk_incoterms' =>array('type'=>'integer', 'label'=>'Fk incoterms', 'enabled'=>1, 'visible'=>-1, 'position'=>260), + 'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'Location incoterms', 'enabled'=>1, 'visible'=>-1, 'position'=>265), + 'date_pointoftax' =>array('type'=>'date', 'label'=>'Date pointoftax', 'enabled'=>1, 'visible'=>-1, 'position'=>270), + 'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>-1, 'position'=>275), + 'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Multicurrency code', 'enabled'=>1, 'visible'=>-1, 'position'=>280), + 'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency tx', 'enabled'=>1, 'visible'=>-1, 'position'=>285), + 'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total ht', 'enabled'=>1, 'visible'=>-1, 'position'=>290), + 'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total tva', 'enabled'=>1, 'visible'=>-1, 'position'=>295), + 'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>300), + 'fk_fac_rec_source' =>array('type'=>'integer', 'label'=>'Fk fac rec source', 'enabled'=>1, 'visible'=>-1, 'position'=>305), + 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>310), + 'module_source' =>array('type'=>'varchar(32)', 'label'=>'Module source', 'enabled'=>1, 'visible'=>-1, 'position'=>315), + 'pos_source' =>array('type'=>'varchar(32)', 'label'=>'Pos source', 'enabled'=>1, 'visible'=>-1, 'position'=>320), + ); + // END MODULEBUILDER PROPERTIES + /** * Standard invoice */ @@ -284,6 +380,7 @@ class Facture extends CommonInvoice const CLOSECODE_ABANDONED = 'abandon'; // Abandonned - other const CLOSECODE_REPLACED = 'replaced'; // Closed after doing a replacement invoice + /** * Constructor * diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 3f4027b9935..aba614f3c74 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -194,6 +194,34 @@ class Contrat extends CommonObject protected $lines_id_index_mapper = array(); + /** + * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') + * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" + * 'label' the translation key. + * 'enabled' is a condition when the field must be managed. + * 'position' is the sort order of field. + * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). + * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) + * 'noteditable' says if field is not editable (1 or 0) + * 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created. + * 'index' if we want an index in database. + * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). + * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. + * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). + * 'css' is the CSS style to use on field. For example: 'maxwidth200' + * 'help' is a string visible as a tooltip on field + * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record + * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. + * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'comment' is not used. You can store here any text of your choice. It is not used by application. + * + * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. + */ + + // BEGIN MODULEBUILDER PROPERTIES + /** + * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + */ public $fields=array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), 'ref' =>array('type'=>'varchar(50)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'showoncombobox'=>1, 'position'=>15), @@ -223,6 +251,7 @@ class Contrat extends CommonObject 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135), 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>140), ); + // END MODULEBUILDER PROPERTIES const STATUS_DRAFT = 0; const STATUS_VALIDATED = 1; From a9d917a3f01d7e78b0f79c31f055c37a51a21ef1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Jan 2020 22:40:10 +0100 Subject: [PATCH 278/784] Fix phpcs --- htdocs/admin/mails.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 165f5f9c7f1..474c6020610 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -863,8 +863,6 @@ else print ''.$langs->trans("EMailsWillHaveMessageID").': '; print dol_escape_htmltag(''); print ''; - - } } From f1f83656f1f4f7d1fe528e01cc0242cd0fcc3ac8 Mon Sep 17 00:00:00 2001 From: Michael Jeanmotte Date: Wed, 29 Jan 2020 15:17:12 +0100 Subject: [PATCH 279/784] Feature Request: Dolibarr API - [GET] /bankaccounts/{id}/lines : add sqlfilters #11259 --- .../compta/bank/class/api_bankaccounts.class.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 57aa50f1568..2ecb59861d9 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -411,8 +411,9 @@ class BankAccounts extends DolibarrApi * @throws RestException * * @url GET {id}/lines + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.import_key:<:'20160101')" */ - public function getLines($id) + public function getLines($id, $sqlfilters = '') { $list = array(); @@ -428,6 +429,18 @@ class BankAccounts extends DolibarrApi $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."bank "; $sql .= " WHERE fk_account = ".$id; + + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + $sql .= " ORDER BY rowid"; $result = $this->db->query($sql); From b2610903a4cbcbdacfaacd21e88c2ba6daebe221 Mon Sep 17 00:00:00 2001 From: kadogo Date: Wed, 29 Jan 2020 17:05:39 +0100 Subject: [PATCH 280/784] NEW enable put for agendaevents api --- htdocs/comm/action/class/api_agendaevents.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index 0d3c5de514d..6299b72b28b 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -229,7 +229,6 @@ class AgendaEvents extends DolibarrApi * * @return int */ - /* public function put($id, $request_data = null) { if (! DolibarrApiAccess::$user->rights->agenda->myactions->create) { @@ -257,12 +256,11 @@ class AgendaEvents extends DolibarrApi $this->actioncomm->$field = $value; } - if ($this->actioncomm->update($id, DolibarrApiAccess::$user,1,'','','update')) + if ($this->actioncomm->update(DolibarrApiAccess::$user, 1) > 0) return $this->get($id); return false; } - */ /** * Delete Agenda Event From 1144b937eb5dc0eeccb81028b0d60ec8296396c8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Jan 2020 23:34:54 +0100 Subject: [PATCH 281/784] Fix phpcs --- htdocs/comm/action/class/api_agendaevents.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index 6299b72b28b..271257c3ecc 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -244,11 +244,11 @@ class AgendaEvents extends DolibarrApi $this->actioncomm->fetch_userassigned(); $this->actioncomm->oldcopy = clone $this->actioncomm; } - if ( ! $result ) { + if (! $result ) { throw new RestException(404, 'actioncomm not found'); } - if ( ! DolibarrApi::_checkAccessToResource('actioncomm',$this->actioncomm->id)) { + if (! DolibarrApi::_checkAccessToResource('actioncomm', $this->actioncomm->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } foreach($request_data as $field => $value) { From 5fda82902376dc05414c85be949897ebc33da768 Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Thu, 30 Jan 2020 00:48:28 +0000 Subject: [PATCH 282/784] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- htdocs/accountancy/admin/account.php | 14 +- htdocs/admin/commande.php | 6 +- htdocs/admin/contract.php | 2 +- htdocs/admin/facture.php | 226 +++---- htdocs/admin/mails.php | 2 +- htdocs/admin/mails_senderprofile_list.php | 14 +- htdocs/admin/mrp.php | 118 ++-- htdocs/admin/order_extrafields.php | 18 +- htdocs/admin/orderdet_extrafields.php | 18 +- htdocs/admin/tools/listevents.php | 170 ++--- htdocs/bom/class/bom.class.php | 2 +- htdocs/comm/action/class/actioncomm.class.php | 262 ++++---- htdocs/comm/action/index.php | 34 +- htdocs/comm/action/list.php | 2 +- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/commande/class/commande.class.php | 562 ++++++++-------- htdocs/commande/list.php | 24 +- htdocs/compta/cashcontrol/report.php | 54 +- htdocs/compta/facture/card.php | 14 +- htdocs/compta/facture/class/facture.class.php | 8 +- htdocs/compta/prelevement/card.php | 14 +- htdocs/compta/prelevement/create.php | 84 +-- htdocs/compta/prelevement/demandes.php | 74 +-- htdocs/compta/sociales/card.php | 86 +-- .../sociales/class/chargesociales.class.php | 86 +-- htdocs/compta/tva/document.php | 46 +- htdocs/contrat/card.php | 2 +- htdocs/contrat/class/contrat.class.php | 4 +- htdocs/contrat/services_list.php | 202 +++--- htdocs/core/actions_setmoduleoptions.inc.php | 36 +- htdocs/core/boxes/box_factures_imp.php | 66 +- htdocs/core/boxes/box_services_expired.php | 2 +- htdocs/core/class/doleditor.class.php | 2 +- htdocs/core/class/dolreceiptprinter.class.php | 90 +-- htdocs/core/class/extrafields.class.php | 298 ++++----- htdocs/core/class/html.form.class.php | 6 +- .../core/class/html.formaccounting.class.php | 6 +- htdocs/core/class/smtps.class.php | 392 +++++------ htdocs/core/extrafieldsinexport.inc.php | 52 +- htdocs/core/lib/files.lib.php | 304 ++++----- htdocs/core/lib/functions2.lib.php | 2 +- htdocs/core/lib/pdf.lib.php | 2 +- htdocs/core/lib/security2.lib.php | 248 +++---- .../commande/doc/pdf_einstein.modules.php | 610 ++++++++--------- .../commande/doc/pdf_eratosthene.modules.php | 356 +++++----- .../expedition/doc/pdf_espadon.modules.php | 274 ++++---- .../doc/pdf_standard.modules.php | 330 +++++----- .../modules/facture/doc/pdf_crabe.modules.php | 2 +- .../facture/doc/pdf_sponge.modules.php | 448 ++++++------- .../core/modules/facture/modules_facture.php | 12 +- .../livraison/doc/pdf_typhon.modules.php | 298 ++++----- htdocs/core/modules/modCashDesk.class.php | 30 +- htdocs/core/modules/modMrp.class.php | 72 +- htdocs/core/modules/modTakePos.class.php | 68 +- .../modules/propale/doc/pdf_cyan.modules.php | 364 +++++------ .../supplier_order/doc/pdf_cornas.modules.php | 312 ++++----- .../doc/pdf_muscadet.modules.php | 592 ++++++++--------- .../doc/pdf_standard.modules.php | 256 ++++---- .../doc/pdf_aurore.modules.php | 618 +++++++++--------- htdocs/core/tpl/massactions_pre.tpl.php | 30 +- htdocs/cron/class/cronjob.class.php | 2 +- htdocs/expensereport/card.php | 12 +- .../class/expensereportstats.class.php | 66 +- htdocs/exports/export.php | 2 +- htdocs/fourn/ajax/getSupplierPrices.php | 40 +- .../class/fournisseur.commande.class.php | 100 +-- .../fourn/class/fournisseur.facture.class.php | 2 +- htdocs/loan/class/loan.class.php | 8 +- htdocs/modulebuilder/index.php | 578 ++++++++-------- .../template/class/myobject.class.php | 8 +- .../modulebuilder/template/myobject_list.php | 8 +- htdocs/mrp/class/mo.class.php | 2 +- htdocs/product/class/product.class.php | 12 +- htdocs/product/list.php | 12 +- htdocs/product/reassortlot.php | 266 ++++---- .../stock/class/api_stockmovements.class.php | 30 +- htdocs/product/stock/class/entrepot.class.php | 266 ++++---- htdocs/product/stock/productlot_list.php | 76 +-- htdocs/projet/class/task.class.php | 4 +- htdocs/projet/tasks/time.php | 64 +- htdocs/public/demo/index.php | 174 ++--- htdocs/resource/class/dolresource.class.php | 2 +- htdocs/societe/card.php | 18 +- htdocs/societe/paymentmodes.php | 22 +- htdocs/stripe/charge.php | 12 +- .../class/supplier_proposal.class.php | 6 +- htdocs/takepos/floors.php | 52 +- htdocs/takepos/freezone.php | 16 +- htdocs/takepos/pay.php | 2 +- htdocs/takepos/receipt.php | 26 +- htdocs/takepos/takepos.php | 44 +- htdocs/theme/eldy/info-box.inc.php | 12 +- htdocs/user/home.php | 98 +-- htdocs/user/list.php | 276 ++++---- 94 files changed, 5323 insertions(+), 5323 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 894284f8603..9de858da26b 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -49,10 +49,10 @@ $search_pcgsubtype = GETPOST('search_pcgsubtype', 'alpha'); // Security check if ($user->socid > 0) accessforbidden(); -if (! $user->rights->accounting->chartofaccount) accessforbidden(); +if (!$user->rights->accounting->chartofaccount) accessforbidden(); // Load variable for pagination -$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha'); $page = GETPOST('page', 'int'); @@ -211,7 +211,7 @@ if (strlen(trim($search_account))) { $search_account_tmp = $search_account; $weremovedsomezero = 0; if (strlen($search_account_tmp) <= $lengthpaddingaccount) { - for($i = 0; $i < $lengthpaddingaccount; $i++) { + for ($i = 0; $i < $lengthpaddingaccount; $i++) { if (preg_match('/0$/', $search_account_tmp)) { $weremovedsomezero++; $search_account_tmp = preg_replace('/0$/', '', $search_account_tmp); @@ -271,7 +271,7 @@ if ($resql) if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; if ($search_account) $param .= '&search_account='.urlencode($search_account); if ($search_label) $param .= '&search_label='.urlencode($search_label); - if ($search_labelshort) $param.= '&search_labelshort='.urlencode($search_labelshort); + if ($search_labelshort) $param .= '&search_labelshort='.urlencode($search_labelshort); if ($search_accountparent > 0 || $search_accountparent == '0') $param .= '&search_accountparent='.urlencode($search_accountparent); if ($search_pcgtype) $param .= '&search_pcgtype='.urlencode($search_pcgtype); if ($search_pcgsubtype) $param .= '&search_pcgsubtype='.urlencode($search_pcgsubtype); @@ -356,7 +356,7 @@ if ($resql) print ''; if (!empty($arrayfields['aa.account_number']['checked'])) print ''; if (!empty($arrayfields['aa.label']['checked'])) print ''; - if (!empty($arrayfields['aa.labelshort']['checked'])) print ''; + if (!empty($arrayfields['aa.labelshort']['checked'])) print ''; if (!empty($arrayfields['aa.account_parent']['checked'])) { print ''; print $formaccounting->select_account($search_accountparent, 'search_accountparent', 2); @@ -416,12 +416,12 @@ if ($resql) } // Account label to show (label short) - if (! empty($arrayfields['aa.labelshort']['checked'])) + if (!empty($arrayfields['aa.labelshort']['checked'])) { print ""; print $obj->labelshort; print "\n"; - if (! $i) $totalarray['nbfield']++; + if (!$i) $totalarray['nbfield']++; } // Account parent diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index ef1d8e710d4..e8163c72f56 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -472,11 +472,11 @@ foreach ($dirmodels as $reldir) print ''; // Info - $htmltooltip = ''.$langs->trans("Name").': '.$module->name; - $htmltooltip .= '
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); + $htmltooltip = ''.$langs->trans("Name").': '.$module->name; + $htmltooltip .= '
'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown")); if ($module->type == 'pdf') { - $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; + $htmltooltip .= '
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; } $htmltooltip .= '
'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file; diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index 0e2680f3d0b..ae0c9c89b38 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -409,7 +409,7 @@ foreach ($dirmodels as $reldir) // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; - $htmltooltip .= '
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); + $htmltooltip .= '
'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown")); if ($module->type == 'pdf') { $htmltooltip .= '
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index b84d77cae16..8d917088d51 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -36,13 +36,13 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; // Load translation files required by the page $langs->loadLangs(array('admin', 'errors', 'other', 'bills')); -if (! $user->admin) accessforbidden(); +if (!$user->admin) accessforbidden(); $action = GETPOST('action', 'alpha'); $value = GETPOST('value', 'alpha'); $label = GETPOST('label', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha'); -$type='invoice'; +$type = 'invoice'; /* @@ -53,22 +53,22 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if ($action == 'updateMask') { - $maskconstinvoice=GETPOST('maskconstinvoice', 'alpha'); - $maskconstreplacement=GETPOST('maskconstreplacement', 'alpha'); - $maskconstcredit=GETPOST('maskconstcredit', 'alpha'); - $maskconstdeposit=GETPOST('maskconstdeposit', 'alpha'); - $maskinvoice=GETPOST('maskinvoice', 'alpha'); - $maskreplacement=GETPOST('maskreplacement', 'alpha'); - $maskcredit=GETPOST('maskcredit', 'alpha'); - $maskdeposit=GETPOST('maskdeposit', 'alpha'); + $maskconstinvoice = GETPOST('maskconstinvoice', 'alpha'); + $maskconstreplacement = GETPOST('maskconstreplacement', 'alpha'); + $maskconstcredit = GETPOST('maskconstcredit', 'alpha'); + $maskconstdeposit = GETPOST('maskconstdeposit', 'alpha'); + $maskinvoice = GETPOST('maskinvoice', 'alpha'); + $maskreplacement = GETPOST('maskreplacement', 'alpha'); + $maskcredit = GETPOST('maskcredit', 'alpha'); + $maskdeposit = GETPOST('maskdeposit', 'alpha'); if ($maskconstinvoice) $res = dolibarr_set_const($db, $maskconstinvoice, $maskinvoice, 'chaine', 0, '', $conf->entity); if ($maskconstreplacement) $res = dolibarr_set_const($db, $maskconstreplacement, $maskreplacement, 'chaine', 0, '', $conf->entity); if ($maskconstcredit) $res = dolibarr_set_const($db, $maskconstcredit, $maskcredit, 'chaine', 0, '', $conf->entity); if ($maskconstdeposit) $res = dolibarr_set_const($db, $maskconstdeposit, $maskdeposit, 'chaine', 0, '', $conf->entity); - if (! $res > 0) $error++; + if (!$res > 0) $error++; - if (! $error) + if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } @@ -79,20 +79,20 @@ if ($action == 'updateMask') } elseif ($action == 'specimen') { - $modele=GETPOST('module', 'alpha'); + $modele = GETPOST('module', 'alpha'); $facture = new Facture($db); $facture->initAsSpecimen(); // Search template files - $file=''; $classname=''; $filefound=0; - $dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']); - foreach($dirmodels as $reldir) + $file = ''; $classname = ''; $filefound = 0; + $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); + foreach ($dirmodels as $reldir) { - $file=dol_buildpath($reldir."core/modules/facture/doc/pdf_".$modele.".modules.php", 0); + $file = dol_buildpath($reldir."core/modules/facture/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound=1; + $filefound = 1; $classname = "pdf_".$modele; break; } @@ -167,9 +167,9 @@ elseif ($action == 'setribchq') $res = dolibarr_set_const($db, "FACTURE_RIB_NUMBER", $rib, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "FACTURE_CHQ_NUMBER", $chq, 'chaine', 0, '', $conf->entity); - if (! $res > 0) $error++; + if (!$res > 0) $error++; - if (! $error) + if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } @@ -184,9 +184,9 @@ elseif ($action == 'set_FACTURE_DRAFT_WATERMARK') $res = dolibarr_set_const($db, "FACTURE_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); - if (! $res > 0) $error++; + if (!$res > 0) $error++; - if (! $error) + if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } @@ -198,13 +198,13 @@ elseif ($action == 'set_FACTURE_DRAFT_WATERMARK') elseif ($action == 'set_INVOICE_FREE_TEXT') { - $freetext = GETPOST('INVOICE_FREE_TEXT', 'none'); // No alpha here, we want exact string + $freetext = GETPOST('INVOICE_FREE_TEXT', 'none'); // No alpha here, we want exact string $res = dolibarr_set_const($db, "INVOICE_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); - if (! $res > 0) $error++; + if (!$res > 0) $error++; - if (! $error) + if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } @@ -219,9 +219,9 @@ elseif ($action == 'setforcedate') $res = dolibarr_set_const($db, "FAC_FORCE_DATE_VALIDATION", $forcedate, 'chaine', 0, '', $conf->entity); - if (! $res > 0) $error++; + if (!$res > 0) $error++; - if (! $error) + if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } @@ -232,19 +232,19 @@ elseif ($action == 'setforcedate') } elseif ($action == 'setDefaultPDFModulesByType') { - $invoicetypemodels = GETPOST('invoicetypemodels'); + $invoicetypemodels = GETPOST('invoicetypemodels'); - if(!empty($invoicetypemodels) && is_array($invoicetypemodels)) + if (!empty($invoicetypemodels) && is_array($invoicetypemodels)) { $error = 0; foreach ($invoicetypemodels as $type => $value) { $res = dolibarr_set_const($db, 'FACTURE_ADDON_PDF_'.intval($type), $value, 'chaine', 0, '', $conf->entity); - if (! $res > 0) $error++; + if (!$res > 0) $error++; } - if (! $error) + if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } @@ -260,14 +260,14 @@ elseif ($action == 'setDefaultPDFModulesByType') * View */ -$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']); +$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); llxHeader("", $langs->trans("BillsSetup"), 'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura'); -$form=new Form($db); +$form = new Form($db); -$linkback='
'.$langs->trans("BackToModuleList").''; +$linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("BillsSetup"), $linkback, 'title_setup'); $head = invoice_admin_prepare_head(); @@ -298,24 +298,24 @@ foreach ($dirmodels as $reldir) $handle = opendir($dir); if (is_resource($handle)) { - while (($file = readdir($handle))!==false) + while (($file = readdir($handle)) !== false) { - if (! is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')) + if (!is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')) { $filebis = $file; $classname = preg_replace('/\.php$/', '', $file); // For compatibility - if (! is_file($dir.$filebis)) + if (!is_file($dir.$filebis)) { $filebis = $file."/".$file.".modules.php"; $classname = "mod_facture_".$file; } // Check if there is a filter on country preg_match('/\-(.*)_(.*)$/', $classname, $reg); - if (! empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) continue; + if (!empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) continue; $classname = preg_replace('/\-.*$/', '', $classname); - if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/', $filebis) || preg_match('/mod_/', $classname)) && substr($filebis, dol_strlen($filebis)-3, 3) == 'php') + if (!class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/', $filebis) || preg_match('/mod_/', $classname)) && substr($filebis, dol_strlen($filebis) - 3, 3) == 'php') { // Charging the numbering class require_once $dir.$filebis; @@ -323,7 +323,7 @@ foreach ($dirmodels as $reldir) $module = new $classname($db); // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; if ($module->isEnabled()) @@ -338,9 +338,9 @@ foreach ($dirmodels as $reldir) // Show example of numbering module print ''; - $tmp=$module->getExample(); + $tmp = $module->getExample(); if (preg_match('/^Error/', $tmp)) print '
'.$langs->trans($tmp).'
'; - elseif ($tmp=='NotConfigured') print $langs->trans($tmp); + elseif ($tmp == 'NotConfigured') print $langs->trans($tmp); else print $tmp; print ''."\n"; @@ -356,62 +356,62 @@ foreach ($dirmodels as $reldir) } print ''; - $facture=new Facture($db); + $facture = new Facture($db); $facture->initAsSpecimen(); // Example for standard invoice - $htmltooltip=''; - $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; - $facture->type=0; - $nextval=$module->getNextValue($mysoc, $facture); + $htmltooltip = ''; + $htmltooltip .= ''.$langs->trans("Version").': '.$module->getVersion().'
'; + $facture->type = 0; + $nextval = $module->getNextValue($mysoc, $facture); if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval - $htmltooltip.=$langs->trans("NextValueForInvoices").': '; + $htmltooltip .= $langs->trans("NextValueForInvoices").': '; if ($nextval) { - if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured') + if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') $nextval = $langs->trans($nextval); - $htmltooltip.=$nextval.'
'; + $htmltooltip .= $nextval.'
'; } else { - $htmltooltip.=$langs->trans($module->error).'
'; + $htmltooltip .= $langs->trans($module->error).'
'; } } // Example for remplacement - $facture->type=1; - $nextval=$module->getNextValue($mysoc, $facture); + $facture->type = 1; + $nextval = $module->getNextValue($mysoc, $facture); if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval - $htmltooltip.=$langs->trans("NextValueForReplacements").': '; + $htmltooltip .= $langs->trans("NextValueForReplacements").': '; if ($nextval) { - if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured') + if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') $nextval = $langs->trans($nextval); - $htmltooltip.=$nextval.'
'; + $htmltooltip .= $nextval.'
'; } else { - $htmltooltip.=$langs->trans($module->error).'
'; + $htmltooltip .= $langs->trans($module->error).'
'; } } // Example for credit invoice - $facture->type=2; - $nextval=$module->getNextValue($mysoc, $facture); + $facture->type = 2; + $nextval = $module->getNextValue($mysoc, $facture); if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval - $htmltooltip.=$langs->trans("NextValueForCreditNotes").': '; + $htmltooltip .= $langs->trans("NextValueForCreditNotes").': '; if ($nextval) { - if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured') + if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') $nextval = $langs->trans($nextval); - $htmltooltip.=$nextval.'
'; + $htmltooltip .= $nextval.'
'; } else { - $htmltooltip.=$langs->trans($module->error).'
'; + $htmltooltip .= $langs->trans($module->error).'
'; } } // Example for deposit invoice - $facture->type=3; - $nextval=$module->getNextValue($mysoc, $facture); + $facture->type = 3; + $nextval = $module->getNextValue($mysoc, $facture); if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval - $htmltooltip.=$langs->trans("NextValueForDeposit").': '; + $htmltooltip .= $langs->trans("NextValueForDeposit").': '; if ($nextval) { - if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured') + if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') $nextval = $langs->trans($nextval); - $htmltooltip.=$nextval; + $htmltooltip .= $nextval; } else { - $htmltooltip.=$langs->trans($module->error); + $htmltooltip .= $langs->trans($module->error); } } @@ -420,7 +420,7 @@ foreach ($dirmodels as $reldir) if ($conf->global->FACTURE_ADDON.'.php' == $file) // If module is the one used, we show existing errors { - if (! empty($module->error)) dol_htmloutput_mesg($module->error, '', 'error', 1); + if (!empty($module->error)) dol_htmloutput_mesg($module->error, '', 'error', 1); } print ''; @@ -445,17 +445,17 @@ print '
'; print load_fiche_titre($langs->trans("BillsPDFModules"), '', ''); // Load array def with activated templates -$type='invoice'; +$type = 'invoice'; $def = array(); $sql = "SELECT nom"; -$sql.= " FROM ".MAIN_DB_PREFIX."document_model"; -$sql.= " WHERE type = '".$type."'"; -$sql.= " AND entity = ".$conf->entity; -$resql=$db->query($sql); +$sql .= " FROM ".MAIN_DB_PREFIX."document_model"; +$sql .= " WHERE type = '".$type."'"; +$sql .= " AND entity = ".$conf->entity; +$resql = $db->query($sql); if ($resql) { $i = 0; - $num_rows=$db->num_rows($resql); + $num_rows = $db->num_rows($resql); while ($i < $num_rows) { $array = $db->fetch_array($resql); @@ -484,43 +484,43 @@ $activatedModels = array(); foreach ($dirmodels as $reldir) { - foreach (array('','/doc') as $valdir) + foreach (array('', '/doc') as $valdir) { $realpath = $reldir."core/modules/facture".$valdir; $dir = dol_buildpath($realpath); if (is_dir($dir)) { - $handle=opendir($dir); + $handle = opendir($dir); if (is_resource($handle)) { - while (($file = readdir($handle))!==false) + while (($file = readdir($handle)) !== false) { - $filelist[]=$file; + $filelist[] = $file; } closedir($handle); arsort($filelist); - foreach($filelist as $file) + foreach ($filelist as $file) { if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { if (file_exists($dir.'/'.$file)) { - $name = substr($file, 4, dol_strlen($file) -16); - $classname = substr($file, 0, dol_strlen($file) -12); + $name = substr($file, 4, dol_strlen($file) - 16); + $classname = substr($file, 0, dol_strlen($file) - 12); require_once $dir.'/'.$file; $module = new $classname($db); - $modulequalified=1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; + $modulequalified = 1; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0; if ($modulequalified) { print ''; - print (empty($module->name)?$name:$module->name); + print (empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) print $module->info($langs); else print $module->description; @@ -555,8 +555,8 @@ foreach ($dirmodels as $reldir) print ''; // Info - $htmltooltip = ''.$langs->trans("Name").': '.$module->name; - $htmltooltip .= '
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); + $htmltooltip = ''.$langs->trans("Name").': '.$module->name; + $htmltooltip .= '
'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown")); if ($module->type == 'pdf') { $htmltooltip .= '
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; @@ -600,7 +600,7 @@ foreach ($dirmodels as $reldir) } print ''; -if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) // Hidden conf +if (!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) // Hidden conf { /* * Document templates generators @@ -617,13 +617,13 @@ if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) // Hidden conf print ''; print "\n"; - $listtype=array( + $listtype = array( Facture::TYPE_STANDARD=>$langs->trans("InvoiceStandard"), Facture::TYPE_REPLACEMENT=>$langs->trans("InvoiceReplacement"), Facture::TYPE_CREDIT_NOTE=>$langs->trans("InvoiceAvoir"), Facture::TYPE_DEPOSIT=>$langs->trans("InvoiceDeposit"), ); - if (! empty($conf->global->INVOICE_USE_SITUATION)) + if (!empty($conf->global->INVOICE_USE_SITUATION)) { $listtype[Facture::TYPE_SITUATION] = $langs->trans("InvoiceSituation"); } @@ -631,7 +631,7 @@ if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) // Hidden conf foreach ($listtype as $type => $trans) { $thisTypeConfName = 'FACTURE_ADDON_PDF_'.$type; - $current = !empty($conf->global->{$thisTypeConfName})?$conf->global->{$thisTypeConfName}:$conf->global->FACTURE_ADDON_PDF; + $current = !empty($conf->global->{$thisTypeConfName}) ? $conf->global->{$thisTypeConfName}:$conf->global->FACTURE_ADDON_PDF; print ''; print ''.$trans.''; print ''.$form->selectarray('invoicetypemodels['.$type.']', ModelePDFFactures::liste_modeles($db), $current, 0, 0, 0).''; @@ -663,14 +663,14 @@ print "\n"; print ''; print "".$langs->trans("SuggestPaymentByRIBOnAccount").""; print ""; -if (! empty($conf->banque->enabled)) +if (!empty($conf->banque->enabled)) { $sql = "SELECT rowid, label"; - $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; - $sql.= " WHERE clos = 0"; - $sql.= " AND courant = 1"; - $sql.= " AND entity IN (".getEntity('bank_account').")"; - $resql=$db->query($sql); + $sql .= " FROM ".MAIN_DB_PREFIX."bank_account"; + $sql .= " WHERE clos = 0"; + $sql .= " AND courant = 1"; + $sql .= " AND entity IN (".getEntity('bank_account').")"; + $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); @@ -684,7 +684,7 @@ if (! empty($conf->banque->enabled)) $row = $db->fetch_row($resql); print ''; $i++; @@ -708,15 +708,15 @@ print "".$langs->trans("SuggestPaymentByChequeToAddress").""; print ""; print '\n"; print ''; -$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2); -$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); +$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2); +$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation"); $htmltext = ''.$langs->trans("AvailableVariables").':
'; -foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; -$htmltext.='
'; +foreach ($substitutionarray as $key => $val) $htmltext .= $key.'
'; +$htmltext .= '
'; print '
'; print ''; print ''; print ''; print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; -$variablename='INVOICE_FREE_TEXT'; +$variablename = 'INVOICE_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; @@ -780,7 +780,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); + $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); print $doleditor->Create(); } print ''; diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 474c6020610..f74ee2fac7d 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -638,7 +638,7 @@ else $liste['user'] = $langs->trans('UserEmail'); $liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL) ? $langs->trans("NotDefined") : $conf->global->MAIN_INFO_SOCIETE_MAIL).')'; $sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile'; - $sql.= ' WHERE active = 1 AND (private = 0 OR private = '.$user->id.')'; + $sql .= ' WHERE active = 1 AND (private = 0 OR private = '.$user->id.')'; $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index a0ebbc16e34..137d4129929 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -108,9 +108,9 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) { $arrayfields["ef.".$key] = array( 'label'=>$extrafields->attributes[$object->table_element]['label'][$key], - 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), + 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], - 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]) + 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]) ); } } @@ -451,7 +451,7 @@ foreach ($object->fields as $key => $val) elseif (strpos($val['type'], 'integer:') === 0) { print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1); } - elseif (! preg_match('/^(date|timestamp)/', $val['type'])) print ''; + elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print ''; print ''; } } @@ -555,10 +555,10 @@ while ($i < ($limit ? min($num, $limit) : $num)) // Action column print ''; $url = $_SERVER["PHP_SELF"].'?action=list&id='.$obj->rowid; - if ($limit) $url.='&limit='.urlencode($limit); - if ($page) $url.='&page='.urlencode($page); - if ($sortfield) $url.='&sortfield='.urlencode($sortfield); - if ($sortorder) $url.='&page='.urlencode($sortorder); + if ($limit) $url .= '&limit='.urlencode($limit); + if ($page) $url .= '&page='.urlencode($page); + if ($sortfield) $url .= '&sortfield='.urlencode($sortfield); + if ($sortorder) $url .= '&page='.urlencode($sortorder); //print ''.img_edit().''; //print '   '; print ''.img_delete().'   '; diff --git a/htdocs/admin/mrp.php b/htdocs/admin/mrp.php index a686422a21e..9c59b5cf6da 100644 --- a/htdocs/admin/mrp.php +++ b/htdocs/admin/mrp.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp.lib.php'; // Load translation files required by the page $langs->loadLangs(array('admin', 'errors', 'mrp', 'other')); -if (! $user->admin) accessforbidden(); +if (!$user->admin) accessforbidden(); $action = GETPOST('action', 'alpha'); $value = GETPOST('value', 'alpha'); @@ -48,14 +48,14 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if ($action == 'updateMask') { - $maskconstmrp=GETPOST('maskconstMo', 'alpha'); - $maskmrp=GETPOST('maskMo', 'alpha'); + $maskconstmrp = GETPOST('maskconstMo', 'alpha'); + $maskmrp = GETPOST('maskMo', 'alpha'); if ($maskconstmrp) $res = dolibarr_set_const($db, $maskconstmrp, $maskmrp, 'chaine', 0, '', $conf->entity); - if (! $res > 0) $error++; + if (!$res > 0) $error++; - if (! $error) + if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } @@ -67,20 +67,20 @@ if ($action == 'updateMask') elseif ($action == 'specimen') { - $modele=GETPOST('module', 'alpha'); + $modele = GETPOST('module', 'alpha'); $mo = new MO($db); $mrp->initAsSpecimen(); // Search template files - $file=''; $classname=''; $filefound=0; - $dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']); - foreach($dirmodels as $reldir) + $file = ''; $classname = ''; $filefound = 0; + $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); + foreach ($dirmodels as $reldir) { - $file=dol_buildpath($reldir."core/modules/mrp/doc/pdf_".$modele.".modules.php", 0); + $file = dol_buildpath($reldir."core/modules/mrp/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound=1; + $filefound = 1; $classname = "pdf_".$modele; break; } @@ -156,9 +156,9 @@ elseif ($action == 'set_MRP_MO_DRAFT_WATERMARK') $draft = GETPOST("MRP_MO_DRAFT_WATERMARK"); $res = dolibarr_set_const($db, "MRP_MO_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); - if (! $res > 0) $error++; + if (!$res > 0) $error++; - if (! $error) + if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } @@ -170,13 +170,13 @@ elseif ($action == 'set_MRP_MO_DRAFT_WATERMARK') elseif ($action == 'set_MRP_MO_FREE_TEXT') { - $freetext = GETPOST("MRP_MO_FREE_TEXT", 'none'); // No alpha here, we want exact string + $freetext = GETPOST("MRP_MO_FREE_TEXT", 'none'); // No alpha here, we want exact string $res = dolibarr_set_const($db, "MRP_MO_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); - if (! $res > 0) $error++; + if (!$res > 0) $error++; - if (! $error) + if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } @@ -191,13 +191,13 @@ elseif ($action == 'set_MRP_MO_FREE_TEXT') * View */ -$form=new Form($db); +$form = new Form($db); -$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']); +$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); llxHeader("", $langs->trans("MrpSetupPage")); -$linkback=''.$langs->trans("BackToModuleList").''; +$linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("MrpSetupPage"), $linkback, 'title_setup'); $head = mrpAdminPrepareHead(); @@ -230,18 +230,18 @@ foreach ($dirmodels as $reldir) $handle = opendir($dir); if (is_resource($handle)) { - while (($file = readdir($handle))!==false) + while (($file = readdir($handle)) !== false) { - if (substr($file, 0, 7) == 'mod_mo_' && substr($file, dol_strlen($file)-3, 3) == 'php') + if (substr($file, 0, 7) == 'mod_mo_' && substr($file, dol_strlen($file) - 3, 3) == 'php') { - $file = substr($file, 0, dol_strlen($file)-4); + $file = substr($file, 0, dol_strlen($file) - 4); require_once $dir.$file.'.php'; $module = new $file($db); // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; if ($module->isEnabled()) @@ -252,9 +252,9 @@ foreach ($dirmodels as $reldir) // Show example of numbering model print ''; - $tmp=$module->getExample(); + $tmp = $module->getExample(); if (preg_match('/^Error/', $tmp)) print '
'.$langs->trans($tmp).'
'; - elseif ($tmp=='NotConfigured') print $langs->trans($tmp); + elseif ($tmp == 'NotConfigured') print $langs->trans($tmp); else print $tmp; print ''."\n"; @@ -271,22 +271,22 @@ foreach ($dirmodels as $reldir) } print ''; - $mrp=new MO($db); + $mrp = new MO($db); $mrp->initAsSpecimen(); // Info - $htmltooltip=''; - $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; - $mrp->type=0; - $nextval=$module->getNextValue($mysoc, $mrp); + $htmltooltip = ''; + $htmltooltip .= ''.$langs->trans("Version").': '.$module->getVersion().'
'; + $mrp->type = 0; + $nextval = $module->getNextValue($mysoc, $mrp); if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval - $htmltooltip.=''.$langs->trans("NextValue").': '; + $htmltooltip .= ''.$langs->trans("NextValue").': '; if ($nextval) { - if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured') + if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') $nextval = $langs->trans($nextval); - $htmltooltip.=$nextval.'
'; + $htmltooltip .= $nextval.'
'; } else { - $htmltooltip.=$langs->trans($module->error).'
'; + $htmltooltip .= $langs->trans($module->error).'
'; } } @@ -314,14 +314,14 @@ print load_fiche_titre($langs->trans("MOsModelModule"), '', ''); // Load array def with activated templates $def = array(); $sql = "SELECT nom"; -$sql.= " FROM ".MAIN_DB_PREFIX."document_model"; -$sql.= " WHERE type = '".$type."'"; -$sql.= " AND entity = ".$conf->entity; -$resql=$db->query($sql); +$sql .= " FROM ".MAIN_DB_PREFIX."document_model"; +$sql .= " WHERE type = '".$type."'"; +$sql .= " AND entity = ".$conf->entity; +$resql = $db->query($sql); if ($resql) { $i = 0; - $num_rows=$db->num_rows($resql); + $num_rows = $db->num_rows($resql); while ($i < $num_rows) { $array = $db->fetch_array($resql); @@ -349,43 +349,43 @@ clearstatcache(); foreach ($dirmodels as $reldir) { - foreach (array('','/doc') as $valdir) + foreach (array('', '/doc') as $valdir) { $realpath = $reldir."core/modules/mrp".$valdir; $dir = dol_buildpath($realpath); if (is_dir($dir)) { - $handle=opendir($dir); + $handle = opendir($dir); if (is_resource($handle)) { - while (($file = readdir($handle))!==false) + while (($file = readdir($handle)) !== false) { - $filelist[]=$file; + $filelist[] = $file; } closedir($handle); arsort($filelist); - foreach($filelist as $file) + foreach ($filelist as $file) { if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { if (file_exists($dir.'/'.$file)) { - $name = substr($file, 4, dol_strlen($file) -16); - $classname = substr($file, 0, dol_strlen($file) -12); + $name = substr($file, 4, dol_strlen($file) - 16); + $classname = substr($file, 0, dol_strlen($file) - 12); require_once $dir.'/'.$file; $module = new $classname($db); - $modulequalified=1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; + $modulequalified = 1; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0; if ($modulequalified) { print ''; - print (empty($module->name)?$name:$module->name); + print (empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) print $module->info($langs); else print $module->description; @@ -420,11 +420,11 @@ foreach ($dirmodels as $reldir) print ''; // Info - $htmltooltip = ''.$langs->trans("Name").': '.$module->name; - $htmltooltip .= '
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); + $htmltooltip = ''.$langs->trans("Name").': '.$module->name; + $htmltooltip .= '
'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown")); if ($module->type == 'pdf') { - $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; + $htmltooltip .= '
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; } $htmltooltip .= '
'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file; @@ -474,18 +474,18 @@ print ''.$langs->trans("Value").''; print " \n"; print "\n"; -$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2); -$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); +$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2); +$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation"); $htmltext = ''.$langs->trans("AvailableVariables").':
'; -foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; -$htmltext.='
'; +foreach ($substitutionarray as $key => $val) $htmltext .= $key.'
'; +$htmltext .= ''; print ''; print ''; print ''; print ''; print $form->textwithpicto($langs->trans("FreeLegalTextOnMOs"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; -$variablename='MRP_MO_FREE_TEXT'; +$variablename = 'MRP_MO_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; @@ -493,7 +493,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); + $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); print $doleditor->Create(); } print ''; diff --git a/htdocs/admin/order_extrafields.php b/htdocs/admin/order_extrafields.php index eba9fd76ff6..2c72c55697f 100644 --- a/htdocs/admin/order_extrafields.php +++ b/htdocs/admin/order_extrafields.php @@ -41,13 +41,13 @@ $extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format -$tmptype2label=ExtraFields::$type2label; -$type2label=array(''); -foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val); +$tmptype2label = ExtraFields::$type2label; +$type2label = array(''); +foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val); -$action=GETPOST('action', 'alpha'); -$attrname=GETPOST('attrname', 'alpha'); -$elementtype='commande'; //Must be the $table_element of the class that manage extrafield +$action = GETPOST('action', 'alpha'); +$attrname = GETPOST('attrname', 'alpha'); +$elementtype = 'commande'; //Must be the $table_element of the class that manage extrafield if (!$user->admin) accessforbidden(); @@ -64,11 +64,11 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; * View */ -$textobject=$langs->transnoentitiesnoconv("Orders"); +$textobject = $langs->transnoentitiesnoconv("Orders"); llxHeader('', $langs->trans("OrdersSetup")); -$linkback=''.$langs->trans("BackToModuleList").''; +$linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("OrdersSetup"), $linkback, 'title_setup'); $head = order_admin_prepare_head(); @@ -108,7 +108,7 @@ if ($action == 'create') /* Edition of an optional field */ /* */ /* ************************************************************************** */ -if ($action == 'edit' && ! empty($attrname)) +if ($action == 'edit' && !empty($attrname)) { print "
"; print load_fiche_titre($langs->trans("FieldEdition", $attrname)); diff --git a/htdocs/admin/orderdet_extrafields.php b/htdocs/admin/orderdet_extrafields.php index 9204bbc251c..55732a40a51 100644 --- a/htdocs/admin/orderdet_extrafields.php +++ b/htdocs/admin/orderdet_extrafields.php @@ -42,13 +42,13 @@ $extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format -$tmptype2label=ExtraFields::$type2label; -$type2label=array(''); -foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val); +$tmptype2label = ExtraFields::$type2label; +$type2label = array(''); +foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val); -$action=GETPOST('action', 'alpha'); -$attrname=GETPOST('attrname', 'alpha'); -$elementtype='commandedet'; //Must be the $table_element of the class that manage extrafield +$action = GETPOST('action', 'alpha'); +$attrname = GETPOST('attrname', 'alpha'); +$elementtype = 'commandedet'; //Must be the $table_element of the class that manage extrafield if (!$user->admin) accessforbidden(); @@ -65,11 +65,11 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; * View */ -$textobject=$langs->transnoentitiesnoconv("Orders"); +$textobject = $langs->transnoentitiesnoconv("Orders"); llxHeader('', $langs->trans("OrdersSetup")); -$linkback=''.$langs->trans("BackToModuleList").''; +$linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("OrdersSetup"), $linkback, 'title_setup'); $head = order_admin_prepare_head(); @@ -109,7 +109,7 @@ if ($action == 'create') /* Edition of an optional field */ /* */ /* ************************************************************************** */ -if ($action == 'edit' && ! empty($attrname)) +if ($action == 'edit' && !empty($attrname)) { print "
"; print load_fiche_titre($langs->trans("FieldEdition", $attrname)); diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 51e5bd4b249..52717200bce 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -28,11 +28,11 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -if (! $user->admin) +if (!$user->admin) accessforbidden(); -$action=GETPOST('action', 'alpha'); -$confirm=GETPOST('confirm', 'alpha'); +$action = GETPOST('action', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); // Security check if ($user->socid > 0) @@ -42,10 +42,10 @@ if ($user->socid > 0) } // Load translation files required by the page -$langs->loadLangs(array("companies","admin","users","other")); +$langs->loadLangs(array("companies", "admin", "users", "other")); // Load variable for pagination -$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha'); $page = GETPOST('page', 'int'); @@ -53,8 +53,8 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (! $sortfield) $sortfield="dateevent"; -if (! $sortorder) $sortorder="DESC"; +if (!$sortfield) $sortfield = "dateevent"; +if (!$sortorder) $sortorder = "DESC"; $search_code = GETPOST("search_code", "alpha"); $search_ip = GETPOST("search_ip", "alpha"); @@ -63,24 +63,24 @@ $search_desc = GETPOST("search_desc", "alpha"); $search_ua = GETPOST("search_ua", "none"); $search_prefix_session = GETPOST("search_prefix_session", "none"); -if (GETPOST("date_startmonth") == '' || GETPOST("date_startmonth") > 0) $date_start=dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear")); -else $date_start=-1; -if (GETPOST("date_endmonth") == '' || GETPOST("date_endmonth") > 0) $date_end=dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear")); -else $date_end=-1; +if (GETPOST("date_startmonth") == '' || GETPOST("date_startmonth") > 0) $date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear")); +else $date_start = -1; +if (GETPOST("date_endmonth") == '' || GETPOST("date_endmonth") > 0) $date_end = dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear")); +else $date_end = -1; // checks:if date_start>date_end then date_end=date_start + 24 hours -if ($date_start > 0 && $date_end > 0 && $date_start > $date_end) $date_end=$date_start+86400; +if ($date_start > 0 && $date_end > 0 && $date_start > $date_end) $date_end = $date_start + 86400; $now = dol_now(); $nowarray = dol_getdate($now); if (empty($date_start)) // We define date_start and date_end { - $date_start=dol_get_first_day($nowarray['year'], $nowarray['mon'], false); + $date_start = dol_get_first_day($nowarray['year'], $nowarray['mon'], false); } if (empty($date_end)) { - $date_end=dol_mktime(23, 59, 59, $nowarray['mon'], $nowarray['mday'], $nowarray['year']); + $date_end = dol_mktime(23, 59, 59, $nowarray['mon'], $nowarray['mday'], $nowarray['year']); } // Set $date_startmonth... $tmp = dol_getdate($date_start); @@ -92,56 +92,56 @@ $date_endday = $tmp['mday']; $date_endmonth = $tmp['mon']; $date_endyear = $tmp['year']; -$arrayfields=array(); +$arrayfields = array(); /* * Actions */ -$now=dol_now(); +$now = dol_now(); // Purge search criteria 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 { - $date_start=-1; - $date_end=-1; - $search_code=''; - $search_ip=''; - $search_user=''; - $search_desc=''; - $search_ua=''; - $search_prefix_session=''; + $date_start = -1; + $date_end = -1; + $search_code = ''; + $search_ip = ''; + $search_user = ''; + $search_desc = ''; + $search_ua = ''; + $search_prefix_session = ''; } // Purge audit events if ($action == 'confirm_purge' && $confirm == 'yes' && $user->admin) { - $error=0; + $error = 0; $db->begin(); - $securityevents=new Events($db); + $securityevents = new Events($db); // Delete events $sql = "DELETE FROM ".MAIN_DB_PREFIX."events"; - $sql.= " WHERE entity = ".$conf->entity; + $sql .= " WHERE entity = ".$conf->entity; dol_syslog("listevents purge", LOG_DEBUG); $resql = $db->query($sql); - if (! $resql) + if (!$resql) { $error++; setEventMessages($db->lasterror(), null, 'errors'); } // Add event purge - $text=$langs->trans("SecurityEventsPurged"); - $securityevent=new Events($db); - $securityevent->type='SECURITY_EVENTS_PURGE'; - $securityevent->dateevent=$now; - $securityevent->description=$text; + $text = $langs->trans("SecurityEventsPurged"); + $securityevent = new Events($db); + $securityevent->type = 'SECURITY_EVENTS_PURGE'; + $securityevent->dateevent = $now; + $securityevent->description = $text; - $result=$securityevent->create($user); + $result = $securityevent->create($user); if ($result > 0) { $db->commit(); @@ -162,26 +162,26 @@ if ($action == 'confirm_purge' && $confirm == 'yes' && $user->admin) llxHeader('', $langs->trans("Audit")); -$form=new Form($db); +$form = new Form($db); -$userstatic=new User($db); -$usefilter=0; +$userstatic = new User($db); +$usefilter = 0; $sql = "SELECT e.rowid, e.type, e.ip, e.user_agent, e.dateevent,"; -$sql.= " e.fk_user, e.description, e.prefix_session,"; -$sql.= " u.login"; -$sql.= " FROM ".MAIN_DB_PREFIX."events as e"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = e.fk_user"; -$sql.= " WHERE e.entity IN (".getEntity('event').")"; -if ($date_start > 0) $sql.= " AND e.dateevent >= '".$db->idate($date_start)."'"; -if ($date_end > 0) $sql.= " AND e.dateevent <= '".$db->idate($date_end)."'"; -if ($search_code) { $usefilter++; $sql.=natural_search("e.type", $search_code, 0); } -if ($search_ip) { $usefilter++; $sql.=natural_search("e.ip", $search_ip, 0); } -if ($search_user) { $usefilter++; $sql.=natural_search("u.login", $search_user, 0); } -if ($search_desc) { $usefilter++; $sql.=natural_search("e.description", $search_desc, 0); } -if ($search_ua) { $usefilter++; $sql.=natural_search("e.user_agent", $search_ua, 0); } -if ($search_prefix_session) { $usefilter++; $sql.=natural_search("e.prefix_session", $search_prefix_session, 0); } -$sql.= $db->order($sortfield, $sortorder); +$sql .= " e.fk_user, e.description, e.prefix_session,"; +$sql .= " u.login"; +$sql .= " FROM ".MAIN_DB_PREFIX."events as e"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = e.fk_user"; +$sql .= " WHERE e.entity IN (".getEntity('event').")"; +if ($date_start > 0) $sql .= " AND e.dateevent >= '".$db->idate($date_start)."'"; +if ($date_end > 0) $sql .= " AND e.dateevent <= '".$db->idate($date_end)."'"; +if ($search_code) { $usefilter++; $sql .= natural_search("e.type", $search_code, 0); } +if ($search_ip) { $usefilter++; $sql .= natural_search("e.ip", $search_ip, 0); } +if ($search_user) { $usefilter++; $sql .= natural_search("u.login", $search_user, 0); } +if ($search_desc) { $usefilter++; $sql .= natural_search("e.description", $search_desc, 0); } +if ($search_ua) { $usefilter++; $sql .= natural_search("e.user_agent", $search_ua, 0); } +if ($search_prefix_session) { $usefilter++; $sql .= natural_search("e.prefix_session", $search_prefix_session, 0); } +$sql .= $db->order($sortfield, $sortorder); // Count total nb of records $nbtotalofrecords = ''; @@ -196,7 +196,7 @@ $nbtotalofrecords = ''; } }*/ -$sql.= $db->plimit($conf->liste_limit+1, $offset); +$sql .= $db->plimit($conf->liste_limit + 1, $offset); //print $sql; $result = $db->query($sql); if ($result) @@ -204,27 +204,27 @@ if ($result) $num = $db->num_rows($result); $i = 0; - $param=''; - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); - if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); - if ($search_code) $param.='&search_code='.urlencode($search_code); - if ($search_ip) $param.='&search_ip='.urlencode($search_ip); - if ($search_user) $param.='&search_user='.urlencode($search_user); - if ($search_desc) $param.='&search_desc='.urlencode($search_desc); - if ($search_ua) $param.='&search_ua='.urlencode($search_ua); - if ($search_prefix_sessiona) $param.='&search_prefix_session='.urlencode($search_prefix_session); - if ($date_startmonth) $param.= "&date_startmonth=".urlencode($date_startmonth); - if ($date_startday) $param.= "&date_startday=".urlencode($date_startday); - if ($date_startyear) $param.= "&date_startyear=".urlencode($date_startyear); - if ($date_endmonth) $param.= "&date_endmonth=".urlencode($date_endmonth); - if ($date_endday) $param.= "&date_endday=".urlencode($date_endday); - if ($date_endyear) $param.= "&date_endyear=".urlencode($date_endyear); + $param = ''; + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); + if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); + if ($search_code) $param .= '&search_code='.urlencode($search_code); + if ($search_ip) $param .= '&search_ip='.urlencode($search_ip); + if ($search_user) $param .= '&search_user='.urlencode($search_user); + if ($search_desc) $param .= '&search_desc='.urlencode($search_desc); + if ($search_ua) $param .= '&search_ua='.urlencode($search_ua); + if ($search_prefix_sessiona) $param .= '&search_prefix_session='.urlencode($search_prefix_session); + if ($date_startmonth) $param .= "&date_startmonth=".urlencode($date_startmonth); + if ($date_startday) $param .= "&date_startday=".urlencode($date_startday); + if ($date_startyear) $param .= "&date_startyear=".urlencode($date_startyear); + if ($date_endmonth) $param .= "&date_endmonth=".urlencode($date_endmonth); + if ($date_endday) $param .= "&date_endday=".urlencode($date_endday); + if ($date_endyear) $param .= "&date_endyear=".urlencode($date_endyear); $langs->load('withdrawals'); if ($num) { - $center=''.$langs->trans("Purge").''; + $center = ''.$langs->trans("Purge").''; } print ''; @@ -233,7 +233,7 @@ if ($result) if ($action == 'purge') { - $formquestion=array(); + $formquestion = array(); print $form->formconfirm($_SERVER["PHP_SELF"].'?noparam=noparam', $langs->trans('PurgeAuditEvents'), $langs->trans('ConfirmPurgeAuditEvents'), 'confirm_purge', $formquestion, 'no', 1); } @@ -262,14 +262,14 @@ if ($result) //print ''; print ''; - if (! empty($arrayfields['e.user_agent']['checked'])) + if (!empty($arrayfields['e.user_agent']['checked'])) { print ''; print ''; print ''; } - if (! empty($arrayfields['e.prefix_session']['checked'])) + if (!empty($arrayfields['e.prefix_session']['checked'])) { print ''; print ''; @@ -277,7 +277,7 @@ if ($result) } print ''; - $searchpicto=$form->showFilterAndCheckAddButtons(0); + $searchpicto = $form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; @@ -290,11 +290,11 @@ if ($result) print_liste_field_titre("IP", $_SERVER["PHP_SELF"], "e.ip", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("User", $_SERVER["PHP_SELF"], "u.login", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "e.description", "", $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['e.user_agent']['checked'])) + if (!empty($arrayfields['e.user_agent']['checked'])) { print_liste_field_titre("UserAgent", $_SERVER["PHP_SELF"], "e.user_agent", "", $param, '', $sortfield, $sortorder); } - if (! empty($arrayfields['e.prefix_session']['checked'])) + if (!empty($arrayfields['e.prefix_session']['checked'])) { print_liste_field_titre("PrefixSession", $_SERVER["PHP_SELF"], "e.prefix_session", "", $param, '', $sortfield, $sortorder); } @@ -322,8 +322,8 @@ if ($result) print ''; if ($obj->fk_user) { - $userstatic->id=$obj->fk_user; - $userstatic->login=$obj->login; + $userstatic->id = $obj->fk_user; + $userstatic->login = $obj->login; print $userstatic->getLoginUrl(1); } else print ' '; @@ -331,18 +331,18 @@ if ($result) // Description print ''; - $text=$langs->trans($obj->description); + $text = $langs->trans($obj->description); $reg = array(); if (preg_match('/\((.*)\)(.*)/i', $obj->description, $reg)) { - $val=explode(',', $reg[1]); - $text=$langs->trans($val[0], isset($val[1])?$val[1]:'', isset($val[2])?$val[2]:'', isset($val[3])?$val[3]:'', isset($val[4])?$val[4]:''); - if (! empty($reg[2])) $text.=$reg[2]; + $val = explode(',', $reg[1]); + $text = $langs->trans($val[0], isset($val[1]) ? $val[1] : '', isset($val[2]) ? $val[2] : '', isset($val[3]) ? $val[3] : '', isset($val[4]) ? $val[4] : ''); + if (!empty($reg[2])) $text .= $reg[2]; } print dol_escape_htmltag($text); print ''; - if (! empty($arrayfields['e.user_agent']['checked'])) + if (!empty($arrayfields['e.user_agent']['checked'])) { // User agent print ''; @@ -350,7 +350,7 @@ if ($result) print ''; } - if (! empty($arrayfields['e.prefix_session']['checked'])) + if (!empty($arrayfields['e.prefix_session']['checked'])) { // User agent print ''; @@ -360,8 +360,8 @@ if ($result) // More informations print ''; - $htmltext=''.$langs->trans("UserAgent").': '.($obj->user_agent ? dol_string_nohtmltag($obj->user_agent) : $langs->trans("Unknown")); - $htmltext.='
'.$langs->trans("PrefixSession").': '.($obj->prefix_session ? dol_string_nohtmltag($obj->prefix_session) : $langs->trans("Unknown")); + $htmltext = ''.$langs->trans("UserAgent").': '.($obj->user_agent ? dol_string_nohtmltag($obj->user_agent) : $langs->trans("Unknown")); + $htmltext .= '
'.$langs->trans("PrefixSession").': '.($obj->prefix_session ? dol_string_nohtmltag($obj->prefix_session) : $langs->trans("Unknown")); print $form->textwithpicto('', $htmltext); print ''; diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 0183ffb004a..ddfb5e78d17 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -747,7 +747,7 @@ class BOM extends CommonObject $label .= '
'; $label .= ''.$langs->trans('Ref').': '.$this->ref; if (isset($this->status)) { - $label.= '
' . $langs->trans("Status").": ".$this->getLibStatut(5); + $label .= '
'.$langs->trans("Status").": ".$this->getLibStatut(5); } $url = dol_buildpath('/bom/bom_card.php', 1).'?id='.$this->id; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 0d8fcaa7ff1..f75244dcf7d 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -272,7 +272,7 @@ class ActionComm extends CommonObject /** * @var int Id of linked object */ - public $fk_element; // Id of record + public $fk_element; // Id of record /** * @var int Id of record alternative for API @@ -302,7 +302,7 @@ class ActionComm extends CommonObject /** * @var array Actions */ - public $actions=array(); + public $actions = array(); /** * @var string Email msgid @@ -839,11 +839,11 @@ class ActionComm extends CommonObject public function fetch_userassigned($override = true) { // phpcs:enable - $sql ="SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency"; - $sql.=" FROM ".MAIN_DB_PREFIX."actioncomm_resources"; - $sql.=" WHERE element_type = 'user' AND fk_actioncomm = ".$this->id; + $sql = "SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency"; + $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm_resources"; + $sql .= " WHERE element_type = 'user' AND fk_actioncomm = ".$this->id; - $resql2=$this->db->query($sql); + $resql2 = $this->db->query($sql); if ($resql2) { $this->userassigned = array(); @@ -894,35 +894,35 @@ class ActionComm extends CommonObject { global $user; - $error=0; + $error = 0; $this->db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm"; - $sql.= " WHERE id=".$this->id; + $sql .= " WHERE id=".$this->id; dol_syslog(get_class($this)."::delete", LOG_DEBUG); - $res=$this->db->query($sql); + $res = $this->db->query($sql); if ($res < 0) { - $this->error=$this->db->lasterror(); + $this->error = $this->db->lasterror(); $error++; } - if (! $error) { + if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_resources"; - $sql.= " WHERE fk_actioncomm=".$this->id; + $sql .= " WHERE fk_actioncomm=".$this->id; dol_syslog(get_class($this)."::delete", LOG_DEBUG); - $res=$this->db->query($sql); + $res = $this->db->query($sql); if ($res < 0) { - $this->error=$this->db->lasterror(); + $this->error = $this->db->lasterror(); $error++; } } // Removed extrafields - if (! $error) { - $result=$this->deleteExtraFields(); + if (!$error) { + $result = $this->deleteExtraFields(); if ($result < 0) { $error++; @@ -1186,52 +1186,52 @@ class ActionComm extends CommonObject // phpcs:enable global $conf, $langs; - if(empty($load_state_board)) $sql = "SELECT a.id, a.datep as dp"; + if (empty($load_state_board)) $sql = "SELECT a.id, a.datep as dp"; else { - $this->nb=array(); + $this->nb = array(); $sql = "SELECT count(a.id) as nb"; } - $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; - if (! $user->rights->societe->client->voir && ! $user->socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; - $sql.= " WHERE 1 = 1"; - if(empty($load_state_board)) $sql.= " AND a.percent >= 0 AND a.percent < 100"; - $sql.= " AND a.entity IN (".getEntity('agenda').")"; - if (! $user->rights->societe->client->voir && ! $user->socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; - if ($user->socid) $sql.=" AND a.fk_soc = ".$user->socid; - if (! $user->rights->agenda->allactions->read) $sql.= " AND (a.fk_user_author = ".$user->id . " OR a.fk_user_action = ".$user->id . " OR a.fk_user_done = ".$user->id . ")"; + $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; + $sql .= " WHERE 1 = 1"; + if (empty($load_state_board)) $sql .= " AND a.percent >= 0 AND a.percent < 100"; + $sql .= " AND a.entity IN (".getEntity('agenda').")"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = ".$user->id.")"; + if ($user->socid) $sql .= " AND a.fk_soc = ".$user->socid; + if (!$user->rights->agenda->allactions->read) $sql .= " AND (a.fk_user_author = ".$user->id." OR a.fk_user_action = ".$user->id." OR a.fk_user_done = ".$user->id.")"; - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { - if(empty($load_state_board)) { + if (empty($load_state_board)) { $agenda_static = new ActionComm($this->db); $response = new WorkboardResponse(); - $response->warning_delay = $conf->agenda->warning_delay/60/60/24; + $response->warning_delay = $conf->agenda->warning_delay / 60 / 60 / 24; $response->label = $langs->trans("ActionsToDo"); $response->labelShort = $langs->trans("ActionsToDoShort"); $response->url = DOL_URL_ROOT.'/comm/action/list.php?actioncode=0&status=todo&mainmenu=agenda'; - if ($user->rights->agenda->allactions->read) $response->url.='&filtert=-1'; + if ($user->rights->agenda->allactions->read) $response->url .= '&filtert=-1'; $response->img = img_object('', "action", 'class="inline-block valigntextmiddle"'); } // This assignment in condition is not a bug. It allows walking the results. - while ($obj=$this->db->fetch_object($resql)) + while ($obj = $this->db->fetch_object($resql)) { - if(empty($load_state_board)) { + if (empty($load_state_board)) { $response->nbtodo++; $agenda_static->datep = $this->db->jdate($obj->dp); if ($agenda_static->hasDelay()) $response->nbtodolate++; - } else $this->nb["actionscomm"]=$obj->nb; + } else $this->nb["actionscomm"] = $obj->nb; } $this->db->free($resql); - if(empty($load_state_board)) return $response; + if (empty($load_state_board)) return $response; else return 1; } else { dol_print_error($this->db); - $this->error=$this->db->error(); + $this->error = $this->db->error(); return -1; } } @@ -1394,10 +1394,10 @@ class ActionComm extends CommonObject if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips $canread = 0; - if ($user->rights->agenda->myactions->read && $this->authorid == $user->id) $canread = 1; // Can read my event - if ($user->rights->agenda->myactions->read && array_key_exists($user->id, $this->userassigned)) $canread = 1; // Can read my event i am assigned - if ($user->rights->agenda->allactions->read) $canread = 1; // Can read all event of other - if (! $canread) + if ($user->rights->agenda->myactions->read && $this->authorid == $user->id) $canread = 1; // Can read my event + if ($user->rights->agenda->myactions->read && array_key_exists($user->id, $this->userassigned)) $canread = 1; // Can read my event i am assigned + if ($user->rights->agenda->allactions->read) $canread = 1; // Can read all event of other + if (!$canread) { $option = 'nolink'; } @@ -1529,12 +1529,12 @@ class ActionComm extends CommonObject public function setCategories($categories) { // Handle single category - if (! is_array($categories)) { + if (!is_array($categories)) { $categories = array($categories); } // Get current categories - include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $c = new Categorie($this->db); $existing = $c->containing($this->id, Categorie::TYPE_ACTIONCOMM, 'id'); @@ -1548,7 +1548,7 @@ class ActionComm extends CommonObject } // Process - foreach($to_del as $del) { + foreach ($to_del as $del) { if ($c->fetch($del) > 0) { $c->del_type($this, Categorie::TYPE_ACTIONCOMM); } @@ -1622,105 +1622,105 @@ class ActionComm extends CommonObject if ($buildfile) { // Build event array - $eventarray=array(); + $eventarray = array(); $sql = "SELECT a.id,"; - $sql.= " a.datep,"; // Start - $sql.= " a.datep2,"; // End - $sql.= " a.durationp,"; // deprecated - $sql.= " a.datec, a.tms as datem,"; - $sql.= " a.label, a.code, a.note, a.fk_action as type_id,"; - $sql.= " a.fk_soc,"; - $sql.= " a.fk_user_author, a.fk_user_mod,"; - $sql.= " a.fk_user_action,"; - $sql.= " a.fk_contact, a.percent as percentage,"; - $sql.= " a.fk_element, a.elementtype,"; - $sql.= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,"; - $sql.= " u.firstname, u.lastname, u.email,"; - $sql.= " s.nom as socname,"; - $sql.= " c.id as type_id, c.code as type_code, c.libelle as type_label"; - $sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a)"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; // Link to get author of event for export - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; + $sql .= " a.datep,"; // Start + $sql .= " a.datep2,"; // End + $sql .= " a.durationp,"; // deprecated + $sql .= " a.datec, a.tms as datem,"; + $sql .= " a.label, a.code, a.note, a.fk_action as type_id,"; + $sql .= " a.fk_soc,"; + $sql .= " a.fk_user_author, a.fk_user_mod,"; + $sql .= " a.fk_user_action,"; + $sql .= " a.fk_contact, a.percent as percentage,"; + $sql .= " a.fk_element, a.elementtype,"; + $sql .= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,"; + $sql .= " u.firstname, u.lastname, u.email,"; + $sql .= " s.nom as socname,"; + $sql .= " c.id as type_id, c.code as type_code, c.libelle as type_label"; + $sql .= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a)"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; // Link to get author of event for export + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; - $parameters=array('filters' => $filters); - $reshook=$hookmanager->executeHooks('printFieldListFrom', $parameters); // Note that $action and $object may have been modified by hook - $sql.=$hookmanager->resPrint; + $parameters = array('filters' => $filters); + $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters); // Note that $action and $object may have been modified by hook + $sql .= $hookmanager->resPrint; // We must filter on assignement table - if ($filters['logint']) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar"; - $sql.= " WHERE a.fk_action=c.id"; - $sql.= " AND a.entity IN (".getEntity('agenda').")"; + if ($filters['logint']) $sql .= ", ".MAIN_DB_PREFIX."actioncomm_resources as ar"; + $sql .= " WHERE a.fk_action=c.id"; + $sql .= " AND a.entity IN (".getEntity('agenda').")"; foreach ($filters as $key => $value) { - if ($key == 'notolderthan' && $value != '') $sql.=" AND a.datep >= '".$this->db->idate($now-($value*24*60*60))."'"; - if ($key == 'year') $sql.=" AND a.datep BETWEEN '".$this->db->idate(dol_get_first_day($value, 1))."' AND '".$this->db->idate(dol_get_last_day($value, 12))."'"; - if ($key == 'id') $sql.=" AND a.id=".(is_numeric($value)?$value:0); - if ($key == 'idfrom') $sql.=" AND a.id >= ".(is_numeric($value)?$value:0); - if ($key == 'idto') $sql.=" AND a.id <= ".(is_numeric($value)?$value:0); - if ($key == 'project') $sql.=" AND a.fk_project=".(is_numeric($value)?$value:0); - if ($key == 'actiontype') $sql.=" AND c.type = '".$this->db->escape($value)."'"; - if ($key == 'notactiontype') $sql.=" AND c.type <> '".$this->db->escape($value)."'"; + if ($key == 'notolderthan' && $value != '') $sql .= " AND a.datep >= '".$this->db->idate($now - ($value * 24 * 60 * 60))."'"; + if ($key == 'year') $sql .= " AND a.datep BETWEEN '".$this->db->idate(dol_get_first_day($value, 1))."' AND '".$this->db->idate(dol_get_last_day($value, 12))."'"; + if ($key == 'id') $sql .= " AND a.id=".(is_numeric($value) ? $value : 0); + if ($key == 'idfrom') $sql .= " AND a.id >= ".(is_numeric($value) ? $value : 0); + if ($key == 'idto') $sql .= " AND a.id <= ".(is_numeric($value) ? $value : 0); + if ($key == 'project') $sql .= " AND a.fk_project=".(is_numeric($value) ? $value : 0); + if ($key == 'actiontype') $sql .= " AND c.type = '".$this->db->escape($value)."'"; + if ($key == 'notactiontype') $sql .= " AND c.type <> '".$this->db->escape($value)."'"; // We must filter on assignement table - if ($key == 'logint') $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'"; + if ($key == 'logint') $sql .= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'"; if ($key == 'logina') { - $logina=$value; - $condition='='; + $logina = $value; + $condition = '='; if (preg_match('/^!/', $logina)) { - $logina=preg_replace('/^!/', '', $logina); - $condition='<>'; + $logina = preg_replace('/^!/', '', $logina); + $condition = '<>'; } - $userforfilter=new User($this->db); - $result=$userforfilter->fetch('', $logina); - if ($result > 0) $sql.= " AND a.fk_user_author ".$condition." ".$userforfilter->id; - elseif ($result < 0 || $condition == '=') $sql.= " AND a.fk_user_author = 0"; + $userforfilter = new User($this->db); + $result = $userforfilter->fetch('', $logina); + if ($result > 0) $sql .= " AND a.fk_user_author ".$condition." ".$userforfilter->id; + elseif ($result < 0 || $condition == '=') $sql .= " AND a.fk_user_author = 0"; } if ($key == 'logint') { - $logint=$value; - $condition='='; + $logint = $value; + $condition = '='; if (preg_match('/^!/', $logint)) { - $logint=preg_replace('/^!/', '', $logint); - $condition='<>'; + $logint = preg_replace('/^!/', '', $logint); + $condition = '<>'; } - $userforfilter=new User($this->db); - $result=$userforfilter->fetch('', $logint); - if ($result > 0) $sql.= " AND ar.fk_element = ".$userforfilter->id; - elseif ($result < 0 || $condition == '=') $sql.= " AND ar.fk_element = 0"; + $userforfilter = new User($this->db); + $result = $userforfilter->fetch('', $logint); + if ($result > 0) $sql .= " AND ar.fk_element = ".$userforfilter->id; + elseif ($result < 0 || $condition == '=') $sql .= " AND ar.fk_element = 0"; } } - $sql.= " AND a.datep IS NOT NULL"; // To exclude corrupted events and avoid errors in lightning/sunbird import + $sql .= " AND a.datep IS NOT NULL"; // To exclude corrupted events and avoid errors in lightning/sunbird import - $parameters=array('filters' => $filters); - $reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook - $sql.=$hookmanager->resPrint; + $parameters = array('filters' => $filters); + $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook + $sql .= $hookmanager->resPrint; - $sql.= " ORDER by datep"; + $sql .= " ORDER by datep"; //print $sql;exit; dol_syslog(get_class($this)."::build_exportfile select events", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { // Note: Output of sql request is encoded in $conf->file->character_set_client // This assignment in condition is not a bug. It allows walking the results. $diff = 0; - while ($obj=$this->db->fetch_object($resql)) + while ($obj = $this->db->fetch_object($resql)) { - $qualified=true; + $qualified = true; // 'eid','startdate','duration','enddate','title','summary','category','email','url','desc','author' - $event=array(); - $event['uid']='dolibarragenda-'.$this->db->database_name.'-'.$obj->id."@".$_SERVER["SERVER_NAME"]; - $event['type']=$type; - $datestart=$this->db->jdate($obj->datep)-(empty($conf->global->AGENDA_EXPORT_FIX_TZ)?0:($conf->global->AGENDA_EXPORT_FIX_TZ*3600)); + $event = array(); + $event['uid'] = 'dolibarragenda-'.$this->db->database_name.'-'.$obj->id."@".$_SERVER["SERVER_NAME"]; + $event['type'] = $type; + $datestart = $this->db->jdate($obj->datep) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); // fix for -> Warning: A non-numeric value encountered - if(is_numeric($this->db->jdate($obj->datep2))) + if (is_numeric($this->db->jdate($obj->datep2))) { $dateend = $this->db->jdate($obj->datep2) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); @@ -1731,28 +1731,28 @@ class ActionComm extends CommonObject $dateend = $datestart; } - $duration=($datestart && $dateend)?($dateend - $datestart):0; - $event['summary']=$obj->label.($obj->socname?" (".$obj->socname.")":""); - $event['desc']=$obj->note; - $event['startdate']=$datestart; - $event['enddate']=$dateend; // Not required with type 'journal' - $event['duration']=$duration; // Not required with type 'journal' - $event['author']=dolGetFirstLastname($obj->firstname, $obj->lastname); - $event['priority']=$obj->priority; - $event['fulldayevent']=$obj->fulldayevent; - $event['location']=$obj->location; - $event['transparency']=(($obj->transparency > 0)?'OPAQUE':'TRANSPARENT'); // OPAQUE (busy) or TRANSPARENT (not busy) - $event['punctual']=$obj->punctual; - $event['category']=$obj->type_label; - $event['email']=$obj->email; + $duration = ($datestart && $dateend) ? ($dateend - $datestart) : 0; + $event['summary'] = $obj->label.($obj->socname ? " (".$obj->socname.")" : ""); + $event['desc'] = $obj->note; + $event['startdate'] = $datestart; + $event['enddate'] = $dateend; // Not required with type 'journal' + $event['duration'] = $duration; // Not required with type 'journal' + $event['author'] = dolGetFirstLastname($obj->firstname, $obj->lastname); + $event['priority'] = $obj->priority; + $event['fulldayevent'] = $obj->fulldayevent; + $event['location'] = $obj->location; + $event['transparency'] = (($obj->transparency > 0) ? 'OPAQUE' : 'TRANSPARENT'); // OPAQUE (busy) or TRANSPARENT (not busy) + $event['punctual'] = $obj->punctual; + $event['category'] = $obj->type_label; + $event['email'] = $obj->email; // Define $urlwithroot - $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); - $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - $url=$urlwithroot.'/comm/action/card.php?id='.$obj->id; - $event['url']=$url; - $event['created']=$this->db->jdate($obj->datec)-(empty($conf->global->AGENDA_EXPORT_FIX_TZ)?0:($conf->global->AGENDA_EXPORT_FIX_TZ*3600)); - $event['modified']=$this->db->jdate($obj->datem)-(empty($conf->global->AGENDA_EXPORT_FIX_TZ)?0:($conf->global->AGENDA_EXPORT_FIX_TZ*3600)); + $url = $urlwithroot.'/comm/action/card.php?id='.$obj->id; + $event['url'] = $url; + $event['created'] = $this->db->jdate($obj->datec) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); + $event['modified'] = $this->db->jdate($obj->datem) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); // TODO: find a way to call "$this->fetch_userassigned();" without override "$this" properties $this->id = $obj->id; @@ -1760,25 +1760,25 @@ class ActionComm extends CommonObject $assignedUserArray = array(); - foreach($this->userassigned as $key => $value) + foreach ($this->userassigned as $key => $value) { $assignedUser = new User($this->db); $assignedUser->fetch($value['id']); - $assignedUserArray[$key]=$assignedUser; + $assignedUserArray[$key] = $assignedUser; } - $event['assignedUsers']=$assignedUserArray; + $event['assignedUsers'] = $assignedUserArray; if ($qualified && $datestart) { - $eventarray[]=$event; + $eventarray[] = $event; } $diff++; } - $parameters=array('filters' => $filters, 'eventarray' => &$eventarray); - $reshook=$hookmanager->executeHooks('addMoreEventsExport', $parameters); // Note that $action and $object may have been modified by hook + $parameters = array('filters' => $filters, 'eventarray' => &$eventarray); + $reshook = $hookmanager->executeHooks('addMoreEventsExport', $parameters); // Note that $action and $object may have been modified by hook if ($reshook > 0) { $eventarray = $hookmanager->resArray; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 268c3ecf1ed..31808d35991 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -757,29 +757,29 @@ if ($showbirthday) } } -if($conf->global->AGENDA_SHOW_HOLIDAYS) +if ($conf->global->AGENDA_SHOW_HOLIDAYS) { $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.statut, x.rowid, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.statut as status"; - $sql.= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u"; - $sql.= " WHERE u.rowid = x.fk_user"; - $sql.= " AND u.statut = '1'"; // Show only active users (0 = inactive user, 1 = active user) - $sql.= " AND (x.statut = '2' OR x.statut = '3')"; // Show only public leaves (2 = leave wait for approval, 3 = leave approved) + $sql .= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u"; + $sql .= " WHERE u.rowid = x.fk_user"; + $sql .= " AND u.statut = '1'"; // Show only active users (0 = inactive user, 1 = active user) + $sql .= " AND (x.statut = '2' OR x.statut = '3')"; // Show only public leaves (2 = leave wait for approval, 3 = leave approved) - if($action == 'show_day') + if ($action == 'show_day') { // Request only leaves for the current selected day - $sql.= " AND '".$year."-".$month."-".$day."' BETWEEN x.date_debut AND x.date_fin"; + $sql .= " AND '".$year."-".$month."-".$day."' BETWEEN x.date_debut AND x.date_fin"; } - elseif($action == 'show_week') + elseif ($action == 'show_week') { // TODO: Add filter to reduce database request } - elseif($action == 'show_month') + elseif ($action == 'show_month') { // TODO: Add filter to reduce database request } - $resql=$db->query($sql); + $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); @@ -803,22 +803,22 @@ if($conf->global->AGENDA_SHOW_HOLIDAYS) $event->date_start_in_calendar = $event->datep; $event->date_end_in_calendar = $event->datef; - if($obj->status == 3) + if ($obj->status == 3) { // Show no symbol for leave with state "leave approved" $event->percentage = -1; } - elseif($obj->status == 2) + elseif ($obj->status == 2) { // Show TO-DO symbol for leave with state "leave wait for approval" $event->percentage = 0; } - if($obj->halfday == 1) + if ($obj->halfday == 1) { $event->label = $obj->lastname.' ('.$langs->trans("Morning").')'; } - elseif($obj->halfday == -1) + elseif ($obj->halfday == -1) { $event->label = $obj->lastname.' ('.$langs->trans("Afternoon").')'; } @@ -836,7 +836,7 @@ if($conf->global->AGENDA_SHOW_HOLIDAYS) { $eventarray[$daykey][] = $event; - $daykey += 60*60*24; + $daykey += 60 * 60 * 24; } while ($daykey <= $event->date_end_in_calendar); @@ -1835,12 +1835,12 @@ function dol_color_minus($color, $minus, $minusunit = 16) function sort_events_by_date($a, $b) { // Sort holidays at first - if($a->type_code === 'HOLIDAY') + if ($a->type_code === 'HOLIDAY') { return -1; } - if($b->type_code === 'HOLIDAY') + if ($b->type_code === 'HOLIDAY') { return 1; } diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 6df7aaa55ba..3ac82178810 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -554,7 +554,7 @@ if ($resql) $actionstatic->type_picto = $obj->type_picto; $actionstatic->label = $obj->label; $actionstatic->location = $obj->location; - $actionstatic->note = dol_htmlentitiesbr($obj->note); // deprecated + $actionstatic->note = dol_htmlentitiesbr($obj->note); // deprecated $actionstatic->note_public = dol_htmlentitiesbr($obj->note); $actionstatic->fetchResources(); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 778f00fbf31..32c3d67a18b 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -810,7 +810,7 @@ class Propal extends CommonObject if (is_array($array_options) && count($array_options) > 0) { // We replace values in this->line->array_options only for entries defined into $array_options - foreach($array_options as $key => $value) { + foreach ($array_options as $key => $value) { $this->line->array_options[$key] = $array_options[$key]; } } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 1d8c5bb0f30..21b8c983d8e 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -164,7 +164,7 @@ class Commande extends CommonOrder */ public $availability; - public $demand_reason_id; // Source reason. Why we receive order (after a phone campaign, ...) + public $demand_reason_id; // Source reason. Why we receive order (after a phone campaign, ...) public $demand_reason_code; /** * @var int Date of order @@ -343,11 +343,11 @@ class Commande extends CommonOrder */ public function valid($user, $idwarehouse = 0, $notrigger = 0) { - global $conf,$langs; + global $conf, $langs; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $error=0; + $error = 0; // Protection if ($this->statut == self::STATUS_VALIDATED) @@ -388,31 +388,31 @@ class Commande extends CommonOrder // Validate $sql = "UPDATE ".MAIN_DB_PREFIX."commande"; - $sql.= " SET ref = '".$this->db->escape($num)."',"; - $sql.= " fk_statut = ".self::STATUS_VALIDATED.","; - $sql.= " date_valid='".$this->db->idate($now)."',"; - $sql.= " fk_user_valid = ".$user->id; - $sql.= " WHERE rowid = ".$this->id; + $sql .= " SET ref = '".$this->db->escape($num)."',"; + $sql .= " fk_statut = ".self::STATUS_VALIDATED.","; + $sql .= " date_valid='".$this->db->idate($now)."',"; + $sql .= " fk_user_valid = ".$user->id; + $sql .= " WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::valid()", LOG_DEBUG); - $resql=$this->db->query($sql); - if (! $resql) + $resql = $this->db->query($sql); + if (!$resql) { dol_print_error($this->db); - $this->error=$this->db->lasterror(); + $this->error = $this->db->lasterror(); $error++; } - if (! $error) + if (!$error) { // If stock is incremented on validate order, we must increment it - if ($result >= 0 && ! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) + if ($result >= 0 && !empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) { require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; $langs->load("agenda"); // Loop on each line - $cpt=count($this->lines); + $cpt = count($this->lines); for ($i = 0; $i < $cpt; $i++) { if ($this->lines[$i]->fk_product > 0) @@ -448,17 +448,17 @@ class Commande extends CommonOrder if (preg_match('/^[\(]?PROV/i', $this->ref)) { // Now we rename also files into index - $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref)+1).")), filepath = 'commande/".$this->db->escape($this->newref)."'"; - $sql.= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'commande/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref) + 1).")), filepath = 'commande/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'commande/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; $resql = $this->db->query($sql); - if (! $resql) { $error++; $this->error = $this->db->lasterror(); } + if (!$resql) { $error++; $this->error = $this->db->lasterror(); } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); $newref = dol_sanitizeFileName($num); $dirsource = $conf->commande->multidir_output[$this->entity].'/'.$oldref; $dirdest = $conf->commande->multidir_output[$this->entity].'/'.$newref; - if (! $error && file_exists($dirsource)) + if (!$error && file_exists($dirsource)) { dol_syslog(get_class($this)."::valid() rename dir ".$dirsource." into ".$dirdest); @@ -466,13 +466,13 @@ class Commande extends CommonOrder { dol_syslog("Rename ok"); // Rename docs starting with $oldref with $newref - $listoffiles=dol_dir_list($conf->commande->multidir_output[$this->entity].'/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/')); - foreach($listoffiles as $fileentry) + $listoffiles = dol_dir_list($conf->commande->multidir_output[$this->entity].'/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/')); + foreach ($listoffiles as $fileentry) { - $dirsource=$fileentry['name']; - $dirdest=preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource); - $dirsource=$fileentry['path'].'/'.$dirsource; - $dirdest=$fileentry['path'].'/'.$dirdest; + $dirsource = $fileentry['name']; + $dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource); + $dirsource = $fileentry['path'].'/'.$dirsource; + $dirdest = $fileentry['path'].'/'.$dirdest; @rename($dirsource, $dirdest); } } @@ -661,34 +661,34 @@ class Commande extends CommonOrder { global $conf; - $error=0; + $error = 0; - if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer)) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate))) + if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->commande->creer)) + || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->commande->order_advance->validate))) { $this->db->begin(); - $now=dol_now(); + $now = dol_now(); $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; - $sql.= ' SET fk_statut = '.self::STATUS_CLOSED.','; - $sql.= ' fk_user_cloture = '.$user->id.','; - $sql.= " date_cloture = '".$this->db->idate($now)."'"; - $sql.= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT; + $sql .= ' SET fk_statut = '.self::STATUS_CLOSED.','; + $sql .= ' fk_user_cloture = '.$user->id.','; + $sql .= " date_cloture = '".$this->db->idate($now)."'"; + $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT; if ($this->db->query($sql)) { - if (! $notrigger) + if (!$notrigger) { // Call trigger - $result=$this->call_trigger('ORDER_CLOSE', $user); + $result = $this->call_trigger('ORDER_CLOSE', $user); if ($result < 0) $error++; // End call triggers } - if (! $error) + if (!$error) { - $this->statut=self::STATUS_CLOSED; + $this->statut = self::STATUS_CLOSED; $this->db->commit(); return 1; @@ -835,88 +835,88 @@ class Commande extends CommonOrder } $soc = new Societe($this->db); - $result=$soc->fetch($this->socid); + $result = $soc->fetch($this->socid); if ($result < 0) { - $this->error="Failed to fetch company"; + $this->error = "Failed to fetch company"; dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); return -2; } - if (! empty($conf->global->COMMANDE_REQUIRE_SOURCE) && $this->source < 0) + if (!empty($conf->global->COMMANDE_REQUIRE_SOURCE) && $this->source < 0) { - $this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Source")); + $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Source")); dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); return -1; } - $now=dol_now(); + $now = dol_now(); $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande ("; - $sql.= " ref, fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note_private, note_public, ref_ext, ref_client, ref_int"; - $sql.= ", model_pdf, fk_cond_reglement, fk_mode_reglement, fk_account, fk_availability, fk_input_reason, date_livraison, fk_delivery_address"; - $sql.= ", fk_shipping_method"; - $sql.= ", fk_warehouse"; - $sql.= ", remise_absolue, remise_percent"; - $sql.= ", fk_incoterms, location_incoterms"; - $sql.= ", entity, module_source, pos_source"; - $sql.= ", fk_multicurrency"; - $sql.= ", multicurrency_code"; - $sql.= ", multicurrency_tx"; - $sql.= ")"; - $sql.= " VALUES ('(PROV)', ".$this->socid.", '".$this->db->idate($now)."', ".$user->id; - $sql.= ", ".($this->fk_project>0?$this->fk_project:"null"); - $sql.= ", '".$this->db->idate($date)."'"; - $sql.= ", ".($this->source>=0 && $this->source != '' ?$this->db->escape($this->source):'null'); - $sql.= ", '".$this->db->escape($this->note_private)."'"; - $sql.= ", '".$this->db->escape($this->note_public)."'"; - $sql.= ", ".($this->ref_ext?"'".$this->db->escape($this->ref_ext)."'":"null"); - $sql.= ", ".($this->ref_client?"'".$this->db->escape($this->ref_client)."'":"null"); - $sql.= ", ".($this->ref_int?"'".$this->db->escape($this->ref_int)."'":"null"); - $sql.= ", '".$this->db->escape($this->modelpdf)."'"; - $sql.= ", ".($this->cond_reglement_id>0?$this->cond_reglement_id:"null"); - $sql.= ", ".($this->mode_reglement_id>0?$this->mode_reglement_id:"null"); - $sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL'); - $sql.= ", ".($this->availability_id>0?$this->availability_id:"null"); - $sql.= ", ".($this->demand_reason_id>0?$this->demand_reason_id:"null"); - $sql.= ", ".($this->date_livraison?"'".$this->db->idate($this->date_livraison)."'":"null"); - $sql.= ", ".($this->fk_delivery_address>0?$this->fk_delivery_address:'NULL'); - $sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:'NULL'); - $sql.= ", ".($this->warehouse_id>0?$this->warehouse_id:'NULL'); - $sql.= ", ".($this->remise_absolue>0?$this->db->escape($this->remise_absolue):'NULL'); - $sql.= ", ".($this->remise_percent>0?$this->db->escape($this->remise_percent):0); - $sql.= ", ".(int) $this->fk_incoterms; - $sql.= ", '".$this->db->escape($this->location_incoterms)."'"; - $sql.= ", ".setEntity($this); - $sql.= ", ".($this->module_source ? "'".$this->db->escape($this->module_source)."'" : "null"); - $sql.= ", ".($this->pos_source != '' ? "'".$this->db->escape($this->pos_source)."'" : "null"); - $sql.= ", ".(int) $this->fk_multicurrency; - $sql.= ", '".$this->db->escape($this->multicurrency_code)."'"; - $sql.= ", ".(double) $this->multicurrency_tx; - $sql.= ")"; + $sql .= " ref, fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note_private, note_public, ref_ext, ref_client, ref_int"; + $sql .= ", model_pdf, fk_cond_reglement, fk_mode_reglement, fk_account, fk_availability, fk_input_reason, date_livraison, fk_delivery_address"; + $sql .= ", fk_shipping_method"; + $sql .= ", fk_warehouse"; + $sql .= ", remise_absolue, remise_percent"; + $sql .= ", fk_incoterms, location_incoterms"; + $sql .= ", entity, module_source, pos_source"; + $sql .= ", fk_multicurrency"; + $sql .= ", multicurrency_code"; + $sql .= ", multicurrency_tx"; + $sql .= ")"; + $sql .= " VALUES ('(PROV)', ".$this->socid.", '".$this->db->idate($now)."', ".$user->id; + $sql .= ", ".($this->fk_project > 0 ? $this->fk_project : "null"); + $sql .= ", '".$this->db->idate($date)."'"; + $sql .= ", ".($this->source >= 0 && $this->source != '' ? $this->db->escape($this->source) : 'null'); + $sql .= ", '".$this->db->escape($this->note_private)."'"; + $sql .= ", '".$this->db->escape($this->note_public)."'"; + $sql .= ", ".($this->ref_ext ? "'".$this->db->escape($this->ref_ext)."'" : "null"); + $sql .= ", ".($this->ref_client ? "'".$this->db->escape($this->ref_client)."'" : "null"); + $sql .= ", ".($this->ref_int ? "'".$this->db->escape($this->ref_int)."'" : "null"); + $sql .= ", '".$this->db->escape($this->modelpdf)."'"; + $sql .= ", ".($this->cond_reglement_id > 0 ? $this->cond_reglement_id : "null"); + $sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : "null"); + $sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL'); + $sql .= ", ".($this->availability_id > 0 ? $this->availability_id : "null"); + $sql .= ", ".($this->demand_reason_id > 0 ? $this->demand_reason_id : "null"); + $sql .= ", ".($this->date_livraison ? "'".$this->db->idate($this->date_livraison)."'" : "null"); + $sql .= ", ".($this->fk_delivery_address > 0 ? $this->fk_delivery_address : 'NULL'); + $sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : 'NULL'); + $sql .= ", ".($this->warehouse_id > 0 ? $this->warehouse_id : 'NULL'); + $sql .= ", ".($this->remise_absolue > 0 ? $this->db->escape($this->remise_absolue) : 'NULL'); + $sql .= ", ".($this->remise_percent > 0 ? $this->db->escape($this->remise_percent) : 0); + $sql .= ", ".(int) $this->fk_incoterms; + $sql .= ", '".$this->db->escape($this->location_incoterms)."'"; + $sql .= ", ".setEntity($this); + $sql .= ", ".($this->module_source ? "'".$this->db->escape($this->module_source)."'" : "null"); + $sql .= ", ".($this->pos_source != '' ? "'".$this->db->escape($this->pos_source)."'" : "null"); + $sql .= ", ".(int) $this->fk_multicurrency; + $sql .= ", '".$this->db->escape($this->multicurrency_code)."'"; + $sql .= ", ".(double) $this->multicurrency_tx; + $sql .= ")"; dol_syslog(get_class($this)."::create", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'commande'); if ($this->id) { - $fk_parent_line=0; - $num=count($this->lines); + $fk_parent_line = 0; + $num = count($this->lines); /* * Insert products details into db */ - for ($i=0;$i<$num;$i++) + for ($i = 0; $i < $num; $i++) { $line = $this->lines[$i]; // Test and convert into object this->lines[$i]. When coming from REST API, we may still have an array //if (! is_object($line)) $line=json_decode(json_encode($line), false); // convert recursively array into object. - if (! is_object($line)) $line = (object) $line; + if (!is_object($line)) $line = (object) $line; // Reset fk_parent_line for no child products and special product if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) { @@ -1499,69 +1499,69 @@ class Commande extends CommonOrder } // Insert line - $this->line=new OrderLine($this->db); + $this->line = new OrderLine($this->db); $this->line->context = $this->context; - $this->line->fk_commande=$this->id; - $this->line->label=$label; - $this->line->desc=$desc; - $this->line->qty=$qty; + $this->line->fk_commande = $this->id; + $this->line->label = $label; + $this->line->desc = $desc; + $this->line->qty = $qty; - $this->line->vat_src_code=$vat_src_code; - $this->line->tva_tx=$txtva; - $this->line->localtax1_tx=($total_localtax1?$localtaxes_type[1]:0); - $this->line->localtax2_tx=($total_localtax2?$localtaxes_type[3]:0); - $this->line->localtax1_type=$localtaxes_type[0]; - $this->line->localtax2_type=$localtaxes_type[2]; - $this->line->fk_product=$fk_product; - $this->line->product_type=$product_type; - $this->line->fk_remise_except=$fk_remise_except; - $this->line->remise_percent=$remise_percent; - $this->line->subprice=$pu_ht; - $this->line->rang=$ranktouse; - $this->line->info_bits=$info_bits; - $this->line->total_ht=$total_ht; - $this->line->total_tva=$total_tva; - $this->line->total_localtax1=$total_localtax1; - $this->line->total_localtax2=$total_localtax2; - $this->line->total_ttc=$total_ttc; - $this->line->special_code=$special_code; - $this->line->origin=$origin; - $this->line->origin_id=$origin_id; - $this->line->fk_parent_line=$fk_parent_line; - $this->line->fk_unit=$fk_unit; + $this->line->vat_src_code = $vat_src_code; + $this->line->tva_tx = $txtva; + $this->line->localtax1_tx = ($total_localtax1 ? $localtaxes_type[1] : 0); + $this->line->localtax2_tx = ($total_localtax2 ? $localtaxes_type[3] : 0); + $this->line->localtax1_type = $localtaxes_type[0]; + $this->line->localtax2_type = $localtaxes_type[2]; + $this->line->fk_product = $fk_product; + $this->line->product_type = $product_type; + $this->line->fk_remise_except = $fk_remise_except; + $this->line->remise_percent = $remise_percent; + $this->line->subprice = $pu_ht; + $this->line->rang = $ranktouse; + $this->line->info_bits = $info_bits; + $this->line->total_ht = $total_ht; + $this->line->total_tva = $total_tva; + $this->line->total_localtax1 = $total_localtax1; + $this->line->total_localtax2 = $total_localtax2; + $this->line->total_ttc = $total_ttc; + $this->line->special_code = $special_code; + $this->line->origin = $origin; + $this->line->origin_id = $origin_id; + $this->line->fk_parent_line = $fk_parent_line; + $this->line->fk_unit = $fk_unit; - $this->line->date_start=$date_start; - $this->line->date_end=$date_end; + $this->line->date_start = $date_start; + $this->line->date_end = $date_end; $this->line->fk_fournprice = $fk_fournprice; $this->line->pa_ht = $pa_ht; // Multicurrency - $this->line->fk_multicurrency = $this->fk_multicurrency; - $this->line->multicurrency_code = $this->multicurrency_code; + $this->line->fk_multicurrency = $this->fk_multicurrency; + $this->line->multicurrency_code = $this->multicurrency_code; $this->line->multicurrency_subprice = $pu_ht_devise; $this->line->multicurrency_total_ht = $multicurrency_total_ht; $this->line->multicurrency_total_tva = $multicurrency_total_tva; $this->line->multicurrency_total_ttc = $multicurrency_total_ttc; // TODO Ne plus utiliser - $this->line->price=$price; - $this->line->remise=$remise; + $this->line->price = $price; + $this->line->remise = $remise; - if (is_array($array_options) && count($array_options)>0) { - $this->line->array_options=$array_options; + if (is_array($array_options) && count($array_options) > 0) { + $this->line->array_options = $array_options; } - $result=$this->line->insert($user); + $result = $this->line->insert($user); if ($result > 0) { // Reorder if child line - if (! empty($fk_parent_line)) $this->line_order(true, 'DESC'); + if (!empty($fk_parent_line)) $this->line_order(true, 'DESC'); // Mise a jour informations denormalisees au niveau de la commande meme - $result=$this->update_price(1, 'auto', 0, $mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode. + $result = $this->update_price(1, 'auto', 0, $mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode. if ($result > 0) { $this->db->commit(); @@ -1695,35 +1695,35 @@ class Commande extends CommonOrder if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1; $sql = 'SELECT c.rowid, c.entity, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_statut'; - $sql.= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason'; - $sql.= ', c.fk_account'; - $sql.= ', c.date_commande, c.date_valid, c.tms'; - $sql.= ', c.date_livraison'; - $sql.= ', c.fk_shipping_method'; - $sql.= ', c.fk_warehouse'; - $sql.= ', c.fk_projet as fk_project, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as billed'; - $sql.= ', c.note_private, c.note_public, c.ref_client, c.ref_ext, c.ref_int, c.model_pdf, c.last_main_doc, c.fk_delivery_address, c.extraparams'; - $sql.= ', c.fk_incoterms, c.location_incoterms'; - $sql.= ", c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva, c.multicurrency_total_ttc"; - $sql.= ", c.module_source, c.pos_source"; - $sql.= ", i.libelle as label_incoterms"; - $sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; - $sql.= ', cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle, cr.libelle_facture as cond_reglement_libelle_doc'; - $sql.= ', ca.code as availability_code, ca.label as availability_label'; - $sql.= ', dr.code as demand_reason_code'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'commande as c'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON c.fk_cond_reglement = cr.rowid'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON c.fk_mode_reglement = p.id'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON c.fk_availability = ca.rowid'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON c.fk_input_reason = dr.rowid'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid'; + $sql .= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason'; + $sql .= ', c.fk_account'; + $sql .= ', c.date_commande, c.date_valid, c.tms'; + $sql .= ', c.date_livraison'; + $sql .= ', c.fk_shipping_method'; + $sql .= ', c.fk_warehouse'; + $sql .= ', c.fk_projet as fk_project, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as billed'; + $sql .= ', c.note_private, c.note_public, c.ref_client, c.ref_ext, c.ref_int, c.model_pdf, c.last_main_doc, c.fk_delivery_address, c.extraparams'; + $sql .= ', c.fk_incoterms, c.location_incoterms'; + $sql .= ", c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva, c.multicurrency_total_ttc"; + $sql .= ", c.module_source, c.pos_source"; + $sql .= ", i.libelle as label_incoterms"; + $sql .= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; + $sql .= ', cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle, cr.libelle_facture as cond_reglement_libelle_doc'; + $sql .= ', ca.code as availability_code, ca.label as availability_label'; + $sql .= ', dr.code as demand_reason_code'; + $sql .= ' FROM '.MAIN_DB_PREFIX.'commande as c'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON c.fk_cond_reglement = cr.rowid'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON c.fk_mode_reglement = p.id'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON c.fk_availability = ca.rowid'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON c.fk_input_reason = dr.rowid'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid'; - if ($id) $sql.= " WHERE c.rowid=".$id; - else $sql.= " WHERE c.entity IN (".getEntity('commande').")"; // Dont't use entity if you use rowid + if ($id) $sql .= " WHERE c.rowid=".$id; + else $sql .= " WHERE c.entity IN (".getEntity('commande').")"; // Dont't use entity if you use rowid - if ($ref) $sql.= " AND c.ref='".$this->db->escape($ref)."'"; - if ($ref_ext) $sql.= " AND c.ref_ext='".$this->db->escape($ref_ext)."'"; - if ($ref_int) $sql.= " AND c.ref_int='".$this->db->escape($ref_int)."'"; + if ($ref) $sql .= " AND c.ref='".$this->db->escape($ref)."'"; + if ($ref_ext) $sql .= " AND c.ref_ext='".$this->db->escape($ref_ext)."'"; + if ($ref_int) $sql .= " AND c.ref_int='".$this->db->escape($ref_int)."'"; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result = $this->db->query($sql); @@ -2017,7 +2017,7 @@ class Commande extends CommonOrder $line->fetch_optionals(); // multilangs - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($objp->fk_product) && ! empty($loadalsotranslation)) { + if (!empty($conf->global->MAIN_MULTILANGS) && !empty($objp->fk_product) && !empty($loadalsotranslation)) { $line = new Product($this->db); $line->fetch($objp->fk_product); $line->getMultiLangs(); @@ -2860,44 +2860,44 @@ class Commande extends CommonOrder $this->db->begin(); $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET facture = 1'; - $sql.= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT; + $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT; dol_syslog(get_class($this)."::classifyBilled", LOG_DEBUG); if ($this->db->query($sql)) { - if (! $error) + if (!$error) { - $this->oldcopy= clone $this; - $this->billed=1; + $this->oldcopy = clone $this; + $this->billed = 1; } - if (! $notrigger && empty($error)) + if (!$notrigger && empty($error)) { // Call trigger - $result=$this->call_trigger('ORDER_CLASSIFY_BILLED', $user); + $result = $this->call_trigger('ORDER_CLASSIFY_BILLED', $user); if ($result < 0) $error++; // End call triggers } - if (! $error) + if (!$error) { $this->db->commit(); return 1; } else { - foreach($this->errors as $errmsg) + foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::classifyBilled ".$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); } $this->db->rollback(); - return -1*$error; + return -1 * $error; } } else { - $this->error=$this->db->error(); + $this->error = $this->db->error(); $this->db->rollback(); return -1; } @@ -3100,18 +3100,18 @@ class Commande extends CommonOrder $this->line->context = $this->context; // Reorder if fk_parent_line change - if (! empty($fk_parent_line) && ! empty($staticline->fk_parent_line) && $fk_parent_line != $staticline->fk_parent_line) + if (!empty($fk_parent_line) && !empty($staticline->fk_parent_line) && $fk_parent_line != $staticline->fk_parent_line) { $rangmax = $this->line_max($fk_parent_line); $this->line->rang = $rangmax + 1; } - $this->line->id=$rowid; - $this->line->label=$label; - $this->line->desc=$desc; - $this->line->qty=$qty; + $this->line->id = $rowid; + $this->line->label = $label; + $this->line->desc = $desc; + $this->line->qty = $qty; - $this->line->vat_src_code = $vat_src_code; + $this->line->vat_src_code = $vat_src_code; $this->line->tva_tx = $txtva; $this->line->localtax1_tx = $txlocaltax1; $this->line->localtax2_tx = $txlocaltax2; @@ -3148,7 +3148,7 @@ class Commande extends CommonOrder if (is_array($array_options) && count($array_options) > 0) { // We replace values in this->line->array_options only for entries defined into $array_options - foreach($array_options as $key => $value) { + foreach ($array_options as $key => $value) { $this->line->array_options[$key] = $array_options[$key]; } } @@ -3347,30 +3347,30 @@ class Commande extends CommonOrder } } - if (! $error) + if (!$error) { // Delete object $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commande WHERE rowid = ".$this->id; - if (! $this->db->query($sql) ) + if (!$this->db->query($sql)) { $error++; - $this->errors[]=$this->db->lasterror(); + $this->errors[] = $this->db->lasterror(); } } - if (! $error) + if (!$error) { // Remove directory with files $comref = dol_sanitizeFileName($this->ref); if ($conf->commande->multidir_output[$this->entity] && !empty($this->ref)) { - $dir = $conf->commande->multidir_output[$this->entity] . "/" . $comref ; - $file = $conf->commande->multidir_output[$this->entity] . "/" . $comref . "/" . $comref . ".pdf"; + $dir = $conf->commande->multidir_output[$this->entity]."/".$comref; + $file = $conf->commande->multidir_output[$this->entity]."/".$comref."/".$comref.".pdf"; if (file_exists($file)) // We must delete all files before deleting directory { dol_delete_preview($this); - if (! dol_delete_file($file, 0, 0, 0, $this)) // For triggers + if (!dol_delete_file($file, 0, 0, 0, $this)) // For triggers { $this->db->rollback(); return 0; @@ -3420,34 +3420,34 @@ class Commande extends CommonOrder $clause = " WHERE"; $sql = "SELECT c.rowid, c.date_creation as datec, c.date_commande, c.date_livraison as delivery_date, c.fk_statut, c.total_ht"; - $sql.= " FROM ".MAIN_DB_PREFIX."commande as c"; + $sql .= " FROM ".MAIN_DB_PREFIX."commande as c"; if (!$user->rights->societe->client->voir && !$user->socid) { - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc"; - $sql.= " WHERE sc.fk_user = " .$user->id; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc"; + $sql .= " WHERE sc.fk_user = ".$user->id; $clause = " AND"; } - $sql.= $clause." c.entity IN (".getEntity('commande').")"; + $sql .= $clause." c.entity IN (".getEntity('commande').")"; //$sql.= " AND c.fk_statut IN (1,2,3) AND c.facture = 0"; - $sql.= " AND ((c.fk_statut IN (".self::STATUS_VALIDATED.",".self::STATUS_SHIPMENTONPROCESS.")) OR (c.fk_statut = ".self::STATUS_CLOSED." AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected - if ($user->socid) $sql.=" AND c.fk_soc = ".$user->socid; + $sql .= " AND ((c.fk_statut IN (".self::STATUS_VALIDATED.",".self::STATUS_SHIPMENTONPROCESS.")) OR (c.fk_statut = ".self::STATUS_CLOSED." AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected + if ($user->socid) $sql .= " AND c.fk_soc = ".$user->socid; - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $response = new WorkboardResponse(); - $response->warning_delay=$conf->commande->client->warning_delay/60/60/24; - $response->label=$langs->trans("OrdersToProcess"); + $response->warning_delay = $conf->commande->client->warning_delay / 60 / 60 / 24; + $response->label = $langs->trans("OrdersToProcess"); $response->labelShort = $langs->trans("Opened"); - $response->url=DOL_URL_ROOT.'/commande/list.php?viewstatut=-3&mainmenu=commercial&leftmenu=orders'; - $response->img=img_object('', "order"); + $response->url = DOL_URL_ROOT.'/commande/list.php?viewstatut=-3&mainmenu=commercial&leftmenu=orders'; + $response->img = img_object('', "order"); $generic_commande = new Commande($this->db); - while ($obj=$this->db->fetch_object($resql)) + while ($obj = $this->db->fetch_object($resql)) { $response->nbtodo++; - $response->total+= $obj->total_ht; + $response->total += $obj->total_ht; $generic_commande->statut = $obj->fk_statut; $generic_commande->date_commande = $this->db->jdate($obj->date_commande); @@ -3509,47 +3509,47 @@ class Commande extends CommonOrder global $langs, $conf; $billedtext = ''; - if (empty($donotshowbilled)) $billedtext .= ($billed?' - '.$langs->trans("Billed"):''); + if (empty($donotshowbilled)) $billedtext .= ($billed ? ' - '.$langs->trans("Billed") : ''); - if ($status==self::STATUS_CANCELED){ + if ($status == self::STATUS_CANCELED) { $labelStatus = $langs->trans('StatusOrderCanceled'); $labelStatusShort = $langs->trans('StatusOrderCanceledShort'); - $statusType='status5'; + $statusType = 'status5'; } - elseif ($status==self::STATUS_DRAFT){ + elseif ($status == self::STATUS_DRAFT) { $labelStatus = $langs->trans('StatusOrderDraft'); $labelStatusShort = $langs->trans('StatusOrderDraftShort'); - $statusType='status0'; + $statusType = 'status0'; } - elseif ($status==self::STATUS_VALIDATED){ + elseif ($status == self::STATUS_VALIDATED) { $labelStatus = $langs->trans('StatusOrderValidated').$billedtext; $labelStatusShort = $langs->trans('StatusOrderValidatedShort').$billedtext; - $statusType='status1'; + $statusType = 'status1'; } - elseif ($status==self::STATUS_SHIPMENTONPROCESS){ + elseif ($status == self::STATUS_SHIPMENTONPROCESS) { $labelStatus = $langs->trans('StatusOrderSentShort').$billedtext; $labelStatusShort = $langs->trans('StatusOrderSentShort').$billedtext; - $statusType='status3'; + $statusType = 'status3'; } - elseif ($status==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){ + elseif ($status == self::STATUS_CLOSED && (!$billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) { $labelStatus = $langs->trans('StatusOrderToBill'); $labelStatusShort = $langs->trans('StatusOrderToBillShort'); - $statusType='status4'; + $statusType = 'status4'; } - elseif ($status==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){ + elseif ($status == self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) { $labelStatus = $langs->trans('StatusOrderProcessed').$billedtext; $labelStatusShort = $langs->trans('StatusOrderProcessed').$billedtext; - $statusType='status6'; + $statusType = 'status6'; } - elseif ($status==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){ + elseif ($status == self::STATUS_CLOSED && (!empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) { $labelStatus = $langs->trans('StatusOrderDelivered'); $labelStatusShort = $langs->trans('StatusOrderDelivered'); - $statusType='status6'; + $statusType = 'status6'; } - else{ + else { $labelStatus = $langs->trans('Unknown'); $labelStatusShort = ''; - $statusType=''; + $statusType = ''; $mode = 0; } @@ -3818,26 +3818,26 @@ class Commande extends CommonOrder // phpcs:enable global $user; - $this->nb=array(); + $this->nb = array(); $clause = "WHERE"; $sql = "SELECT count(co.rowid) as nb"; - $sql.= " FROM ".MAIN_DB_PREFIX."commande as co"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON co.fk_soc = s.rowid"; + $sql .= " FROM ".MAIN_DB_PREFIX."commande as co"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON co.fk_soc = s.rowid"; if (!$user->rights->societe->client->voir && !$user->socid) { - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; - $sql.= " WHERE sc.fk_user = " .$user->id; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; + $sql .= " WHERE sc.fk_user = ".$user->id; $clause = "AND"; } - $sql.= " ".$clause." co.entity IN (".getEntity('commande').")"; + $sql .= " ".$clause." co.entity IN (".getEntity('commande').")"; - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { - while ($obj=$this->db->fetch_object($resql)) + while ($obj = $this->db->fetch_object($resql)) { - $this->nb["orders"]=$obj->nb; + $this->nb["orders"] = $obj->nb; } $this->db->free($resql); return 1; @@ -3873,16 +3873,16 @@ class Commande extends CommonOrder */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { - global $conf,$langs; + global $conf, $langs; $langs->load("orders"); - if (! dol_strlen($modele)) { + if (!dol_strlen($modele)) { $modele = 'einstein'; if ($this->modelpdf) { $modele = $this->modelpdf; - } elseif (! empty($conf->global->COMMANDE_ADDON_PDF)) { + } elseif (!empty($conf->global->COMMANDE_ADDON_PDF)) { $modele = $conf->global->COMMANDE_ADDON_PDF; } } @@ -4113,13 +4113,13 @@ class OrderLine extends CommonOrderLine { global $conf, $langs; - $error=0; + $error = 0; // check if order line is not in a shipment line before deleting $sqlCheckShipmentLine = "SELECT"; $sqlCheckShipmentLine .= " ed.rowid"; - $sqlCheckShipmentLine .= " FROM " . MAIN_DB_PREFIX . "expeditiondet ed"; - $sqlCheckShipmentLine .= " WHERE ed.fk_origin_line = " . $this->rowid; + $sqlCheckShipmentLine .= " FROM ".MAIN_DB_PREFIX."expeditiondet ed"; + $sqlCheckShipmentLine .= " WHERE ed.fk_origin_line = ".$this->rowid; $resqlCheckShipmentLine = $this->db->query($sqlCheckShipmentLine); if (!$resqlCheckShipmentLine) { @@ -4132,13 +4132,13 @@ class OrderLine extends CommonOrderLine if ($num > 0) { $error++; $objCheckShipmentLine = $this->db->fetch_object($resqlCheckShipmentLine); - $this->error = $langs->trans('ErrorRecordAlreadyExists') . ' : ' . $langs->trans('ShipmentLine') . ' ' . $objCheckShipmentLine->rowid; + $this->error = $langs->trans('ErrorRecordAlreadyExists').' : '.$langs->trans('ShipmentLine').' '.$objCheckShipmentLine->rowid; $this->errors[] = $this->error; } $this->db->free($resqlCheckShipmentLine); } if ($error) { - dol_syslog(__METHOD__ . 'Error ; ' . $this->error, LOG_ERR); + dol_syslog(__METHOD__.'Error ; '.$this->error, LOG_ERR); return -1; } @@ -4147,14 +4147,14 @@ class OrderLine extends CommonOrderLine $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE rowid=".$this->rowid; dol_syslog("OrderLine::delete", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { // Remove extrafields - if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used + if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used { - $this->id=$this->rowid; - $result=$this->deleteExtraFields(); + $this->id = $this->rowid; + $result = $this->deleteExtraFields(); if ($result < 0) { $error++; @@ -4243,73 +4243,73 @@ class OrderLine extends CommonOrderLine // Insertion dans base de la ligne $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commandedet'; - $sql.= ' (fk_commande, fk_parent_line, label, description, qty, '; - $sql.= ' vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,'; - $sql.= ' fk_product, product_type, remise_percent, subprice, price, remise, fk_remise_except,'; - $sql.= ' special_code, rang, fk_product_fournisseur_price, buy_price_ht,'; - $sql.= ' info_bits, total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, date_start, date_end,'; - $sql.= ' fk_unit'; - $sql.= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc'; - $sql.= ')'; - $sql.= " VALUES (".$this->fk_commande.","; - $sql.= " ".($this->fk_parent_line>0?"'".$this->db->escape($this->fk_parent_line)."'":"null").","; - $sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").","; - $sql.= " '".$this->db->escape($this->desc)."',"; - $sql.= " '".price2num($this->qty)."',"; - $sql.= " ".(empty($this->vat_src_code)?"''":"'".$this->db->escape($this->vat_src_code)."'").","; - $sql.= " '".price2num($this->tva_tx)."',"; - $sql.= " '".price2num($this->localtax1_tx)."',"; - $sql.= " '".price2num($this->localtax2_tx)."',"; - $sql.= " '".$this->db->escape($this->localtax1_type)."',"; - $sql.= " '".$this->db->escape($this->localtax2_type)."',"; - $sql.= ' '.(! empty($this->fk_product)?$this->fk_product:"null").','; - $sql.= " '".$this->db->escape($this->product_type)."',"; - $sql.= " '".price2num($this->remise_percent)."',"; - $sql.= " ".(price2num($this->subprice)!==''?price2num($this->subprice):"null").","; - $sql.= " ".($this->price!=''?"'".price2num($this->price)."'":"null").","; - $sql.= " '".price2num($this->remise)."',"; - $sql.= ' '.(! empty($this->fk_remise_except)?$this->fk_remise_except:"null").','; - $sql.= ' '.$this->special_code.','; - $sql.= ' '.$this->rang.','; - $sql.= ' '.(! empty($this->fk_fournprice)?$this->fk_fournprice:"null").','; - $sql.= ' '.price2num($this->pa_ht).','; - $sql.= " '".$this->db->escape($this->info_bits)."',"; - $sql.= " ".price2num($this->total_ht).","; - $sql.= " ".price2num($this->total_tva).","; - $sql.= " ".price2num($this->total_localtax1).","; - $sql.= " ".price2num($this->total_localtax2).","; - $sql.= " ".price2num($this->total_ttc).","; - $sql.= " ".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null").','; - $sql.= " ".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null").','; - $sql.= ' '.(!$this->fk_unit ? 'NULL' : $this->fk_unit); - $sql.= ", ".(! empty($this->fk_multicurrency) ? $this->fk_multicurrency : 'NULL'); - $sql.= ", '".$this->db->escape($this->multicurrency_code)."'"; - $sql.= ", ".$this->multicurrency_subprice; - $sql.= ", ".$this->multicurrency_total_ht; - $sql.= ", ".$this->multicurrency_total_tva; - $sql.= ", ".$this->multicurrency_total_ttc; - $sql.= ')'; + $sql .= ' (fk_commande, fk_parent_line, label, description, qty, '; + $sql .= ' vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,'; + $sql .= ' fk_product, product_type, remise_percent, subprice, price, remise, fk_remise_except,'; + $sql .= ' special_code, rang, fk_product_fournisseur_price, buy_price_ht,'; + $sql .= ' info_bits, total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, date_start, date_end,'; + $sql .= ' fk_unit'; + $sql .= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc'; + $sql .= ')'; + $sql .= " VALUES (".$this->fk_commande.","; + $sql .= " ".($this->fk_parent_line > 0 ? "'".$this->db->escape($this->fk_parent_line)."'" : "null").","; + $sql .= " ".(!empty($this->label) ? "'".$this->db->escape($this->label)."'" : "null").","; + $sql .= " '".$this->db->escape($this->desc)."',"; + $sql .= " '".price2num($this->qty)."',"; + $sql .= " ".(empty($this->vat_src_code) ? "''" : "'".$this->db->escape($this->vat_src_code)."'").","; + $sql .= " '".price2num($this->tva_tx)."',"; + $sql .= " '".price2num($this->localtax1_tx)."',"; + $sql .= " '".price2num($this->localtax2_tx)."',"; + $sql .= " '".$this->db->escape($this->localtax1_type)."',"; + $sql .= " '".$this->db->escape($this->localtax2_type)."',"; + $sql .= ' '.(!empty($this->fk_product) ? $this->fk_product : "null").','; + $sql .= " '".$this->db->escape($this->product_type)."',"; + $sql .= " '".price2num($this->remise_percent)."',"; + $sql .= " ".(price2num($this->subprice) !== '' ?price2num($this->subprice) : "null").","; + $sql .= " ".($this->price != '' ? "'".price2num($this->price)."'" : "null").","; + $sql .= " '".price2num($this->remise)."',"; + $sql .= ' '.(!empty($this->fk_remise_except) ? $this->fk_remise_except : "null").','; + $sql .= ' '.$this->special_code.','; + $sql .= ' '.$this->rang.','; + $sql .= ' '.(!empty($this->fk_fournprice) ? $this->fk_fournprice : "null").','; + $sql .= ' '.price2num($this->pa_ht).','; + $sql .= " '".$this->db->escape($this->info_bits)."',"; + $sql .= " ".price2num($this->total_ht).","; + $sql .= " ".price2num($this->total_tva).","; + $sql .= " ".price2num($this->total_localtax1).","; + $sql .= " ".price2num($this->total_localtax2).","; + $sql .= " ".price2num($this->total_ttc).","; + $sql .= " ".(!empty($this->date_start) ? "'".$this->db->idate($this->date_start)."'" : "null").','; + $sql .= " ".(!empty($this->date_end) ? "'".$this->db->idate($this->date_end)."'" : "null").','; + $sql .= ' '.(!$this->fk_unit ? 'NULL' : $this->fk_unit); + $sql .= ", ".(!empty($this->fk_multicurrency) ? $this->fk_multicurrency : 'NULL'); + $sql .= ", '".$this->db->escape($this->multicurrency_code)."'"; + $sql .= ", ".$this->multicurrency_subprice; + $sql .= ", ".$this->multicurrency_total_ht; + $sql .= ", ".$this->multicurrency_total_tva; + $sql .= ", ".$this->multicurrency_total_ttc; + $sql .= ')'; dol_syslog(get_class($this)."::insert", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { - $this->id=$this->db->last_insert_id(MAIN_DB_PREFIX.'commandedet'); + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'commandedet'); $this->rowid = $this->id; if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { - $result=$this->insertExtraFields(); + $result = $this->insertExtraFields(); if ($result < 0) { $error++; } } - if (! $error && ! $notrigger) + if (!$error && !$notrigger) { // Call trigger - $result=$this->call_trigger('LINEORDER_INSERT', $user); + $result = $this->call_trigger('LINEORDER_INSERT', $user); if ($result < 0) $error++; // End call triggers } diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 507bc24e803..0fa53f6c314 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -75,7 +75,7 @@ $search_user = GETPOST('search_user', 'int'); $search_sale = GETPOST('search_sale', 'int'); $search_total_ht = GETPOST('search_total_ht', 'alpha'); $search_total_ttc = GETPOST('search_total_ttc', 'alpha'); -$search_login=GETPOST('search_login', 'alpha'); +$search_login = GETPOST('search_login', 'alpha'); $search_categ_cus = trim(GETPOST("search_categ_cus", 'int')); $optioncss = GETPOST('optioncss', 'alpha'); $billed = GETPOST('billed', 'int'); @@ -197,7 +197,7 @@ if (empty($reshook)) $search_total_ht = ''; $search_total_vat = ''; $search_total_ttc = ''; - $search_login=''; + $search_login = ''; $search_dateorder_start = ''; $search_dateorder_end = ''; $search_datedelivery_start = ''; @@ -249,11 +249,11 @@ if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; $sql .= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,'; $sql .= " typent.code as typent_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; -$sql.= ' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client, c.fk_user_author,'; +$sql .= ' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client, c.fk_user_author,'; $sql .= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,'; $sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,'; $sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,"; -$sql.= " u.login"; +$sql .= " u.login"; if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc"; // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) @@ -272,7 +272,7 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count if ($sall || $search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commandedet as pd ON c.rowid=pd.fk_commande'; if ($search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = c.fk_projet"; -$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON c.fk_user_author = u.rowid'; +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON c.fk_user_author = u.rowid'; // We'll need this table joined to the select in order to filter by sale if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -424,7 +424,7 @@ if ($resql) if ($search_total_ht != '') $param .= '&search_total_ht='.urlencode($search_total_ht); if ($search_total_vat != '') $param .= '&search_total_vat='.urlencode($search_total_vat); if ($search_total_ttc != '') $param .= '&search_total_ttc='.urlencode($search_total_ttc); - if ($search_login) $param.='&search_login='.urlencode($search_login); + if ($search_login) $param .= '&search_login='.urlencode($search_login); if ($search_project_ref >= 0) $param .= "&search_project_ref=".urlencode($search_project_ref); if ($search_town != '') $param .= '&search_town='.urlencode($search_town); if ($search_zip != '') $param .= '&search_zip='.urlencode($search_zip); @@ -697,7 +697,7 @@ if ($resql) print ''; print ''; } - if (! empty($arrayfields['u.login']['checked'])) + if (!empty($arrayfields['u.login']['checked'])) { // Author print ''; @@ -775,7 +775,7 @@ if ($resql) if (!empty($arrayfields['c.total_ht']['checked'])) print_liste_field_titre($arrayfields['c.total_ht']['label'], $_SERVER["PHP_SELF"], 'c.total_ht', '', $param, '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['c.total_vat']['checked'])) print_liste_field_titre($arrayfields['c.total_vat']['label'], $_SERVER["PHP_SELF"], 'c.tva', '', $param, '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['c.total_ttc']['checked'])) print_liste_field_titre($arrayfields['c.total_ttc']['label'], $_SERVER["PHP_SELF"], 'c.total_ttc', '', $param, '', $sortfield, $sortorder, 'right '); - if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); + if (!empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; @@ -1097,17 +1097,17 @@ if ($resql) $totalarray['val']['c.total_ttc'] += $obj->total_ttc; } - $userstatic->id=$obj->fk_user_author; - $userstatic->login=$obj->login; + $userstatic->id = $obj->fk_user_author; + $userstatic->login = $obj->login; // Author - if (! empty($arrayfields['u.login']['checked'])) + if (!empty($arrayfields['u.login']['checked'])) { print ''; if ($userstatic->id) print $userstatic->getLoginUrl(1); else print ' '; print "\n"; - if (! $i) $totalarray['nbfield']++; + if (!$i) $totalarray['nbfield']++; } // Extra fields diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php index e8aea86681c..8cd74f1cccf 100644 --- a/htdocs/compta/cashcontrol/report.php +++ b/htdocs/compta/cashcontrol/report.php @@ -39,15 +39,15 @@ $langs->load("bills"); $id = GETPOST('id', 'int'); -$_GET['optioncss']="print"; -$cashcontrol= new CashControl($db); +$_GET['optioncss'] = "print"; +$cashcontrol = new CashControl($db); $cashcontrol->fetch($id); //$limit = GETPOST('limit')?GETPOST('limit', 'int'):$conf->liste_limit; -$sortorder='ASC'; -$sortfield='b.datev,b.dateo,b.rowid'; +$sortorder = 'ASC'; +$sortfield = 'b.datev,b.dateo,b.rowid'; -$arrayfields=array( +$arrayfields = array( 'b.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), 'b.dateo'=>array('label'=>$langs->trans("DateOperationShort"), 'checked'=>1), 'b.num_chq'=>array('label'=>$langs->trans("Number"), 'checked'=>1), @@ -99,12 +99,12 @@ $sql.=" OR b.fk_account=".$conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE; $sql.=")"; */ $sql = "SELECT f.rowid as facid, f.ref, f.datef as do, pf.amount as amount, b.fk_account as bankid, cp.code"; -$sql.= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."c_paiement as cp, ".MAIN_DB_PREFIX."bank as b"; -$sql.= " WHERE pf.fk_facture = f.rowid AND p.rowid = pf.fk_paiement AND cp.id = p.fk_paiement AND p.fk_bank = b.rowid"; -$sql.= " AND f.module_source = '".$db->escape($posmodule)."'"; -$sql.= " AND f.pos_source = '".$db->escape($terminalid)."'"; -$sql.= " AND f.paye = 1"; -$sql.= " AND p.entity IN (".getEntity('facture').")"; +$sql .= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."c_paiement as cp, ".MAIN_DB_PREFIX."bank as b"; +$sql .= " WHERE pf.fk_facture = f.rowid AND p.rowid = pf.fk_paiement AND cp.id = p.fk_paiement AND p.fk_bank = b.rowid"; +$sql .= " AND f.module_source = '".$db->escape($posmodule)."'"; +$sql .= " AND f.pos_source = '".$db->escape($terminalid)."'"; +$sql .= " AND f.paye = 1"; +$sql .= " AND p.entity IN (".getEntity('facture').")"; /*if ($key == 'cash') $sql.=" AND cp.code = 'LIQ'"; elseif ($key == 'cheque') $sql.=" AND cp.code = 'CHQ'"; elseif ($key == 'card') $sql.=" AND cp.code = 'CB'"; @@ -113,9 +113,9 @@ else dol_print_error('Value for key = '.$key.' not supported'); exit; }*/ -if ($syear && ! $smonth) $sql.= " AND datef BETWEEN '".$db->idate(dol_get_first_day($syear, 1))."' AND '".$db->idate(dol_get_last_day($syear, 12))."'"; -elseif ($syear && $smonth && ! $sday) $sql.= " AND datef BETWEEN '".$db->idate(dol_get_first_day($syear, $smonth))."' AND '".$db->idate(dol_get_last_day($syear, $smonth))."'"; -elseif ($syear && $smonth && $sday) $sql.= " AND datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $smonth, $sday, $syear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $smonth, $sday, $syear))."'"; +if ($syear && !$smonth) $sql .= " AND datef BETWEEN '".$db->idate(dol_get_first_day($syear, 1))."' AND '".$db->idate(dol_get_last_day($syear, 12))."'"; +elseif ($syear && $smonth && !$sday) $sql .= " AND datef BETWEEN '".$db->idate(dol_get_first_day($syear, $smonth))."' AND '".$db->idate(dol_get_last_day($syear, $smonth))."'"; +elseif ($syear && $smonth && $sday) $sql .= " AND datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $smonth, $sday, $syear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $smonth, $sday, $syear))."'"; else dol_print_error('', 'Year not defined'); $resql = $db->query($sql); @@ -125,7 +125,7 @@ if ($resql) $i = 0; print "

"; - if ($cashcontrol->status==2) print $langs->trans("CashControl")." ".$cashcontrol->id; + if ($cashcontrol->status == 2) print $langs->trans("CashControl")." ".$cashcontrol->id; else print $langs->trans("CashControl")." - ".$langs->trans("Draft"); print "
".$langs->trans("DateCreationShort").": ".dol_print_date($cashcontrol->date_creation, 'dayhour')."

"; @@ -154,7 +154,7 @@ if ($resql) // Loop on each record $sign = 1; - $cash=$bank=$cheque=$other=0; + $cash = $bank = $cheque = $other = 0; $totalarray = array(); $cachebankaccount = array(); @@ -167,7 +167,7 @@ if ($resql) { $bankaccounttmp = new Account($db); $bankaccounttmp->fetch($objp->bankid); - $cachebankaccount[$objp->bankid]=$bankaccounttmp; + $cachebankaccount[$objp->bankid] = $bankaccounttmp; $bankaccount = $bankaccounttmp; } else @@ -192,21 +192,21 @@ if ($resql) print ''; print $invoicetmp->getNomUrl(1); print ''; - if (! $i) $totalarray['nbfield']++; + if (!$i) $totalarray['nbfield']++; // Date ope print ''; print ''.dol_print_date($db->jdate($objp->do), "day").""; print "\n"; - if (! $i) $totalarray['nbfield']++; + if (!$i) $totalarray['nbfield']++; // Bank account print ''; print $bankaccount->getNomUrl(1); - if ($cashcontrol->posmodule=="takepos"){ + if ($cashcontrol->posmodule == "takepos") { $var1 = 'CASHDESK_ID_BANKACCOUNT_CASH'.$cashcontrol->posnumber; } - else{ + else { $var1 = 'CASHDESK_ID_BANKACCOUNT_CASH'; } if ($objp->code == 'CHQ') { @@ -220,14 +220,14 @@ if ($resql) else $other += $objp->amount; } print "\n"; - if (! $i) $totalarray['nbfield']++; + if (!$i) $totalarray['nbfield']++; // Type print ''; print $objp->code; if (empty($amountpertype[$objp->code])) $amountpertype[$objp->code] = 0; print "\n"; - if (! $i) $totalarray['nbfield']++; + if (!$i) $totalarray['nbfield']++; // Debit print ''; @@ -238,8 +238,8 @@ if ($resql) $amountpertype[$objp->code] += $objp->amount; } print "\n"; - if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totaldebfield'; + if (!$i) $totalarray['nbfield']++; + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totaldebfield'; // Credit print ''; @@ -250,8 +250,8 @@ if ($resql) $amountpertype[$objp->code] -= $objp->amount; } print "\n"; - if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totalcredfield'; + if (!$i) $totalarray['nbfield']++; + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalcredfield'; print ""; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 15200582ced..7b7306ef6a8 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -298,14 +298,14 @@ if (empty($reshook)) // Note: Other solution if you want to add a negative line on invoice, is to create a discount for customer and consumme it (but this is possible on standard invoice only). $array_of_pu_ht_per_vat_rate = array(); $array_of_pu_ht_devise_per_vat_rate = array(); - foreach($object->lines as $line) { + foreach ($object->lines as $line) { if (empty($array_of_pu_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code])) $array_of_pu_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] = 0; if (empty($array_of_pu_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code])) $array_of_pu_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] = 0; $array_of_pu_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] += $line->subprice; $array_of_pu_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] += $line->multicurrency_subprice; } //var_dump($array_of_pu_ht_per_vat_rate);exit; - foreach($array_of_pu_ht_per_vat_rate as $vatrate => $tmpvalue) + foreach ($array_of_pu_ht_per_vat_rate as $vatrate => $tmpvalue) { $pu_ht = $array_of_pu_ht_per_vat_rate[$vatrate]; $pu_ht_devise = $array_of_pu_ht_devise_per_vat_rate[$vatrate]; @@ -818,11 +818,11 @@ if (empty($reshook)) } // If some payments were already done, we change the amount to pay using same prorate - if (! empty($conf->global->INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED)) { - $alreadypaid = $object->getSommePaiement(); // This can be not 0 if we allow to create credit to reuse from credit notes partially refunded. + if (!empty($conf->global->INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED)) { + $alreadypaid = $object->getSommePaiement(); // This can be not 0 if we allow to create credit to reuse from credit notes partially refunded. if ($alreadypaid && abs($alreadypaid) < abs($object->total_ttc)) { $ratio = abs(($object->total_ttc - $alreadypaid) / $object->total_ttc); - foreach($amount_ht as $vatrate => $val) { + foreach ($amount_ht as $vatrate => $val) { $amount_ht[$vatrate] = price2num($amount_ht[$vatrate] * $ratio, 'MU'); $amount_tva[$vatrate] = price2num($amount_tva[$vatrate] * $ratio, 'MU'); $amount_ttc[$vatrate] = price2num($amount_ttc[$vatrate] * $ratio, 'MU'); @@ -3903,7 +3903,7 @@ elseif ($id > 0 || !empty($ref)) $morehtmlref = '
'; // Ref invoice - if ($object->status == $object::STATUS_DRAFT && ! $mysoc->isInEEC() && ! empty($conf->global->INVOICE_ALLOW_FREE_REF)) { + if ($object->status == $object::STATUS_DRAFT && !$mysoc->isInEEC() && !empty($conf->global->INVOICE_ALLOW_FREE_REF)) { $morehtmlref .= $form->editfieldkey("Ref", 'ref', $object->ref, $object, $usercancreate, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("Ref", 'ref', $object->ref, $object, $usercancreate, 'string', '', null, null, '', 1); $morehtmlref .= '
'; @@ -5095,7 +5095,7 @@ elseif ($id > 0 || !empty($ref)) } // For credit note if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0 && $usercancreate - && (! empty($conf->global->INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED) || $object->getSommePaiement() == 0) + && (!empty($conf->global->INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED) || $object->getSommePaiement() == 0) ) { print ''.$langs->trans('ConvertToReduc').''; } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index f877a353003..b94e9373dda 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1272,7 +1272,7 @@ class Facture extends CommonInvoice $this->availability_id = $object->availability_id; $this->demand_reason_id = $object->demand_reason_id; $this->date_livraison = $object->date_livraison; - $this->fk_delivery_address = $object->fk_delivery_address; // deprecated + $this->fk_delivery_address = $object->fk_delivery_address; // deprecated $this->contact_id = $object->contactid; $this->ref_client = $object->ref_client; @@ -1688,7 +1688,7 @@ class Facture extends CommonInvoice $line->special_code = $objp->special_code; $line->fk_parent_line = $objp->fk_parent_line; $line->situation_percent = $objp->situation_percent; - $line->fk_prev_id = $objp->fk_prev_id; + $line->fk_prev_id = $objp->fk_prev_id; $line->fk_unit = $objp->fk_unit; // Accountancy @@ -3231,7 +3231,7 @@ class Facture extends CommonInvoice $this->line->rang = $rangmax + 1; } - $this->line->id = $rowid; + $this->line->id = $rowid; $this->line->rowid = $rowid; $this->line->label = $label; $this->line->desc = $desc; @@ -3272,7 +3272,7 @@ class Facture extends CommonInvoice if (is_array($array_options) && count($array_options) > 0) { // We replace values in this->line->array_options only for entries defined into $array_options - foreach($array_options as $key => $value) { + foreach ($array_options as $key => $value) { $this->line->array_options[$key] = $array_options[$key]; } } diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index fdb4284e909..d998554b533 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -362,14 +362,14 @@ if ($id > 0 || $ref) $urladd = "&id=".$id; - print '' . "\n"; - print ''; - print ''; - if (! empty($page)) { - print ''; + print ''."\n"; + print ''; + print ''; + if (!empty($page)) { + print ''; } - if (! empty($limit)) { - print ''; + if (!empty($limit)) { + print ''; } print_barre_liste($langs->trans("Lines"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit); diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 9fad5db2a68..d1b6361cc34 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -40,19 +40,19 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies', 'bills')); // Security check -if ($user->socid) $socid=$user->socid; +if ($user->socid) $socid = $user->socid; $result = restrictedArea($user, 'prelevement', '', '', 'bons'); // Get supervariables $action = GETPOST('action', 'alpha'); -$mode = GETPOST('mode', 'alpha')?GETPOST('mode', 'alpha'):'real'; +$mode = GETPOST('mode', 'alpha') ?GETPOST('mode', 'alpha') : 'real'; $format = GETPOST('format', 'aZ09'); -$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $page = GETPOST("page", 'int'); if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; -$hookmanager->initHooks(array('directdebitcreatecard','globalcard')); +$hookmanager->initHooks(array('directdebitcreatecard', 'globalcard')); /* @@ -68,7 +68,7 @@ if (empty($reshook)) // Change customer bank information to withdraw if ($action == 'modify') { - for ($i = 1 ; $i < 9 ; $i++) + for ($i = 1; $i < 9; $i++) { dolibarr_set_const($db, GETPOST("nom$i"), GETPOST("value$i"), 'chaine', 0, '', $conf->entity); } @@ -77,7 +77,7 @@ if (empty($reshook)) { // $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty $bprev = new BonPrelevement($db); - $executiondate = dol_mktime(0, 0, 0, GETPOST('remonth'), (GETPOST('reday')+$conf->global->PRELEVEMENT_ADDDAYS), GETPOST('reyear')); + $executiondate = dol_mktime(0, 0, 0, GETPOST('remonth'), (GETPOST('reday') + $conf->global->PRELEVEMENT_ADDDAYS), GETPOST('reyear')); $result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format, $executiondate); if ($result < 0) @@ -86,12 +86,12 @@ if (empty($reshook)) } elseif ($result == 0) { - $mesg=$langs->trans("NoInvoiceCouldBeWithdrawed", $format); + $mesg = $langs->trans("NoInvoiceCouldBeWithdrawed", $format); setEventMessages($mesg, null, 'errors'); - $mesg.='
'."\n"; - foreach($bprev->invoice_in_error as $key => $val) + $mesg .= '
'."\n"; + foreach ($bprev->invoice_in_error as $key => $val) { - $mesg.=''.$val."
\n"; + $mesg .= ''.$val."
\n"; } } else @@ -108,8 +108,8 @@ if (empty($reshook)) $form = new Form($db); -$thirdpartystatic=new Societe($db); -$invoicestatic=new Facture($db); +$thirdpartystatic = new Societe($db); +$invoicestatic = new Facture($db); $bprev = new BonPrelevement($db); llxHeader('', $langs->trans("NewStandingOrder")); @@ -134,10 +134,10 @@ print load_fiche_titre($langs->trans("NewStandingOrder")); dol_fiche_head(); -$nb=$bprev->NbFactureAPrelever(); -$nb1=$bprev->NbFactureAPrelever(1); -$nb11=$bprev->NbFactureAPrelever(1, 1); -$pricetowithdraw=$bprev->SommeAPrelever(); +$nb = $bprev->NbFactureAPrelever(); +$nb1 = $bprev->NbFactureAPrelever(1); +$nb11 = $bprev->NbFactureAPrelever(1, 1); +$pricetowithdraw = $bprev->SommeAPrelever(); if ($nb < 0 || $nb1 < 0 || $nb11 < 0) { dol_print_error($bprev->error); @@ -162,17 +162,17 @@ if ($mesg) print $mesg; print "
\n"; -print ''; -print ''; +print ''; +print ''; if ($nb) { if ($pricetowithdraw) { print $langs->trans('ExecutionDate').' '; print $form->selectDate(); if ($mysoc->isInEEC()) { print ''; - print ''; + print ''; } else { - print '' . $langs->trans("CreateAll") . "\n"; + print ''.$langs->trans("CreateAll")."\n"; } } else @@ -205,20 +205,20 @@ print '
'; */ $sql = "SELECT f.ref, f.rowid, f.total_ttc, s.nom as name, s.rowid as socid,"; -$sql.= " pfd.date_demande, pfd.amount"; -$sql.= " FROM ".MAIN_DB_PREFIX."facture as f,"; -$sql.= " ".MAIN_DB_PREFIX."societe as s,"; -$sql.= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; -$sql.= " WHERE s.rowid = f.fk_soc"; -$sql.= " AND f.entity IN (".getEntity('invoice').")"; +$sql .= " pfd.date_demande, pfd.amount"; +$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,"; +$sql .= " ".MAIN_DB_PREFIX."societe as s,"; +$sql .= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; +$sql .= " WHERE s.rowid = f.fk_soc"; +$sql .= " AND f.entity IN (".getEntity('invoice').")"; if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) { - $sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; + $sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; } -$sql.= " AND f.total_ttc > 0"; -$sql.= " AND pfd.traite = 0"; -$sql.= " AND pfd.fk_facture = f.rowid"; -if ($socid > 0) $sql.= " AND f.fk_soc = ".$socid; +$sql .= " AND f.total_ttc > 0"; +$sql .= " AND pfd.traite = 0"; +$sql .= " AND pfd.fk_facture = f.rowid"; +if ($socid > 0) $sql .= " AND f.fk_soc = ".$socid; $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) @@ -232,24 +232,24 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) } } -$sql.= $db->plimit($limit+1, $offset); +$sql .= $db->plimit($limit + 1, $offset); -$resql=$db->query($sql); +$resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; - $param=''; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); - if($socid) $param .= '&socid='.urlencode($socid); - if($option) $param .= "&option=".urlencode($option); + $param = ''; + if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); + if ($socid) $param .= '&socid='.urlencode($socid); + if ($option) $param .= "&option=".urlencode($option); print ''; print ''; print ''; - if (! empty($limit)) { - print ''; + if (!empty($limit)) { + print ''; } print_barre_liste($langs->trans("InvoiceWaitingWithdraw"), $page, $_SERVER['PHP_SELF'], $param, '', '', '', $num, $nbtotalofrecords, 'invoicing', 0, '', '', $limit); @@ -266,7 +266,7 @@ if ($resql) if ($num) { - require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; + require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; $bac = new CompanyBankAccount($db); while ($i < $num && $i < $limit) @@ -275,8 +275,8 @@ if ($resql) print ''; print ''; - $invoicestatic->id=$obj->rowid; - $invoicestatic->ref=$obj->ref; + $invoicestatic->id = $obj->rowid; + $invoicestatic->ref = $obj->ref; print $invoicestatic->getNomUrl(1, 'withdraw'); print ''; // Thirdparty diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index 80dbe3e02da..61c457c9b17 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -36,18 +36,18 @@ $langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies')); // Security check $socid = GETPOST('socid', 'int'); $status = GETPOST('status', 'int'); -if ($user->socid) $socid=$user->socid; +if ($user->socid) $socid = $user->socid; $result = restrictedArea($user, 'prelevement', '', '', 'bons'); -$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'myobjectlist'; // To manage different context of search -$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page -$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search +$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $search_facture = GETPOST('search_facture', 'alpha'); $search_societe = trim(GETPOST('search_societe', 'alpha')); // Load variable for pagination -$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); $page = GETPOST("page", 'int'); @@ -55,8 +55,8 @@ if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST( $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (! $sortorder) $sortorder="DESC"; -if (! $sortfield) $sortfield="f.ref"; +if (!$sortorder) $sortorder = "DESC"; +if (!$sortfield) $sortfield = "f.ref"; $massactionbutton = ''; @@ -96,34 +96,34 @@ else llxHeader('', $title); -$thirdpartystatic=new Societe($db); -$invoicestatic=new Facture($db); +$thirdpartystatic = new Societe($db); +$invoicestatic = new Facture($db); // List of requests -$sql= "SELECT f.ref, f.rowid, f.total_ttc,"; -$sql.= " s.nom as name, s.rowid as socid,"; -$sql.= " pfd.date_demande as date_demande,"; -$sql.= " pfd.fk_user_demande"; -$sql.= " FROM ".MAIN_DB_PREFIX."facture as f,"; -$sql.= " ".MAIN_DB_PREFIX."societe as s,"; -$sql.= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; -if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -$sql.= " WHERE s.rowid = f.fk_soc"; -$sql.= " AND f.entity IN (".getEntity('invoice').")"; -if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; -if ($socid) $sql.= " AND f.fk_soc = ".$socid; -if (!$status) $sql.= " AND pfd.traite = 0"; -if ($status) $sql.= " AND pfd.traite = ".$status; -$sql.= " AND f.total_ttc > 0"; +$sql = "SELECT f.ref, f.rowid, f.total_ttc,"; +$sql .= " s.nom as name, s.rowid as socid,"; +$sql .= " pfd.date_demande as date_demande,"; +$sql .= " pfd.fk_user_demande"; +$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,"; +$sql .= " ".MAIN_DB_PREFIX."societe as s,"; +$sql .= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; +if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +$sql .= " WHERE s.rowid = f.fk_soc"; +$sql .= " AND f.entity IN (".getEntity('invoice').")"; +if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; +if ($socid) $sql .= " AND f.fk_soc = ".$socid; +if (!$status) $sql .= " AND pfd.traite = 0"; +if ($status) $sql .= " AND pfd.traite = ".$status; +$sql .= " AND f.total_ttc > 0"; if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) { - $sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; + $sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; } -$sql.= " AND pfd.fk_facture = f.rowid"; -if ($search_facture) $sql.= natural_search("f.ref", $search_facture); -if ($search_societe) $sql.= natural_search("s.nom", $search_societe); -$sql.=$db->order($sortfield, $sortorder); +$sql .= " AND pfd.fk_facture = f.rowid"; +if ($search_facture) $sql .= natural_search("f.ref", $search_facture); +if ($search_societe) $sql .= natural_search("s.nom", $search_societe); +$sql .= $db->order($sortfield, $sortorder); // Count total nb of records @@ -145,10 +145,10 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) } else { - $sql.= $db->plimit($limit+1, $offset); + $sql .= $db->plimit($limit + 1, $offset); - $resql=$db->query($sql); - if (! $resql) + $resql = $db->query($sql); + if (!$resql) { dol_print_error($db); exit; @@ -201,20 +201,20 @@ $i = 0; while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); - if (empty($obj)) break; // Should not happen + if (empty($obj)) break; // Should not happen print ''; // Ref facture print ''; - $invoicestatic->id=$obj->rowid; - $invoicestatic->ref=$obj->ref; + $invoicestatic->id = $obj->rowid; + $invoicestatic->ref = $obj->ref; print $invoicestatic->getNomUrl(1, 'withdraw'); print ''; print ''; - $thirdpartystatic->id=$obj->socid; - $thirdpartystatic->name=$obj->name; + $thirdpartystatic->id = $obj->socid; + $thirdpartystatic->name = $obj->name; print $thirdpartystatic->getNomUrl(1, 'customer'); print ''; diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 29c7a1f2aab..c5e142ca7ca 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -30,26 +30,26 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php' require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -if (! empty($conf->projet->enabled)) +if (!empty($conf->projet->enabled)) { include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } -if (! empty($conf->accounting->enabled)) { - include_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; +if (!empty($conf->accounting->enabled)) { + include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; } // Load translation files required by the page $langs->loadLangs(array('compta', 'bills', 'banks')); -$id=GETPOST('id', 'int'); -$action=GETPOST('action', 'aZ09'); -$confirm=GETPOST('confirm'); +$id = GETPOST('id', 'int'); +$action = GETPOST('action', 'aZ09'); +$confirm = GETPOST('confirm'); $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); // Security check $socid = GETPOST('socid', 'int'); -if ($user->socid) $socid=$user->socid; +if ($user->socid) $socid = $user->socid; $result = restrictedArea($user, 'tax', $id, 'chargesociales', 'charges'); $object = new ChargeSociales($db); @@ -159,44 +159,44 @@ if ($action == 'add' && $user->rights->tax->charges->creer) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors'); $action = 'create'; } - elseif (! is_numeric($amount)) + elseif (!is_numeric($amount)) { setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentities("Amount")), null, 'errors'); $action = 'create'; } else { - $object->type = $actioncode; - $object->label = GETPOST('label', 'alpha'); - $object->date_ech = $dateech; + $object->type = $actioncode; + $object->label = GETPOST('label', 'alpha'); + $object->date_ech = $dateech; $object->periode = $dateperiod; $object->amount = $amount; - $object->mode_reglement_id = GETPOST('mode_reglement_id'); + $object->mode_reglement_id = GETPOST('mode_reglement_id'); $object->fk_account = GETPOST('fk_account', 'int'); $object->fk_project = GETPOST('fk_project'); - $id=$object->create($user); + $id = $object->create($user); if ($id <= 0) { setEventMessages($object->error, $object->errors, 'errors'); - $action='create'; + $action = 'create'; } } } -if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->creer) +if ($action == 'update' && !$_POST["cancel"] && $user->rights->tax->charges->creer) { - $dateech=dol_mktime(GETPOST('echhour'), GETPOST('echmin'), GETPOST('echsec'), GETPOST('echmonth'), GETPOST('echday'), GETPOST('echyear')); - $dateperiod=dol_mktime(GETPOST('periodhour'), GETPOST('periodmin'), GETPOST('periodsec'), GETPOST('periodmonth'), GETPOST('periodday'), GETPOST('periodyear')); - $amount=price2num(GETPOST('amount')); + $dateech = dol_mktime(GETPOST('echhour'), GETPOST('echmin'), GETPOST('echsec'), GETPOST('echmonth'), GETPOST('echday'), GETPOST('echyear')); + $dateperiod = dol_mktime(GETPOST('periodhour'), GETPOST('periodmin'), GETPOST('periodsec'), GETPOST('periodmonth'), GETPOST('periodday'), GETPOST('periodyear')); + $amount = price2num(GETPOST('amount')); - if (! $dateech) + if (!$dateech) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors'); $action = 'edit'; } - elseif (! $dateperiod) + elseif (!$dateperiod) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Period")), null, 'errors'); $action = 'edit'; @@ -444,14 +444,14 @@ if ($id > 0) if ($action == 'paid') { - $text=$langs->trans('ConfirmPaySocialContribution'); + $text = $langs->trans('ConfirmPaySocialContribution'); print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans('PaySocialContribution'), $text, "confirm_paid", '', '', 2); } // Confirmation of the removal of the Social Contribution if ($action == 'delete') { - $text=$langs->trans('ConfirmDeleteSocialContribution'); + $text = $langs->trans('ConfirmDeleteSocialContribution'); print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('DeleteSocialContribution'), $text, 'confirm_delete', '', '', 2); } @@ -463,48 +463,48 @@ if ($id > 0) dol_fiche_head($head, 'card', $langs->trans("SocialContribution"), -1, 'bill'); - $morehtmlref='
'; + $morehtmlref = '
'; // Ref customer - $morehtmlref.=$form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1); + $morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1); // Project - if (! empty($conf->projet->enabled)) + if (!empty($conf->projet->enabled)) { $langs->load("projects"); - $morehtmlref.='
'.$langs->trans('Project') . ' '; + $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->tax->charges->creer) { if ($action != 'classify') { - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.=''; + $morehtmlref .= '
'; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= $formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref .= ''; + $morehtmlref .= '
'; } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); } } else { - if (! empty($object->fk_project)) { + if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref.=''; - $morehtmlref.=$proj->ref; - $morehtmlref.=''; + $morehtmlref .= ''; + $morehtmlref .= $proj->ref; + $morehtmlref .= ''; } else { - $morehtmlref.=''; + $morehtmlref .= ''; } } } - $morehtmlref.='
'; + $morehtmlref .= '
'; - $linkback = '' . $langs->trans("BackToList") . ''; + $linkback = ''.$langs->trans("BackToList").''; - $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status + $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index bf2d04515bf..f6ff04ebe54 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -132,41 +132,41 @@ class ChargeSociales extends CommonObject public function fetch($id, $ref = '') { $sql = "SELECT cs.rowid, cs.date_ech"; - $sql.= ", cs.libelle as label, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode, cs.import_key"; - $sql.= ", cs.fk_account, cs.fk_mode_reglement"; - $sql.= ", c.libelle"; - $sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; - $sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id"; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON cs.fk_mode_reglement = p.id'; - $sql.= ' WHERE cs.entity IN ('.getEntity('tax').')'; - if ($ref) $sql.= " AND cs.rowid = ".$ref; - else $sql.= " AND cs.rowid = ".$id; + $sql .= ", cs.libelle as label, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode, cs.import_key"; + $sql .= ", cs.fk_account, cs.fk_mode_reglement"; + $sql .= ", c.libelle"; + $sql .= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; + $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as cs"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id"; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON cs.fk_mode_reglement = p.id'; + $sql .= ' WHERE cs.entity IN ('.getEntity('tax').')'; + if ($ref) $sql .= " AND cs.rowid = ".$ref; + else $sql .= " AND cs.rowid = ".$id; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { 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->date_ech = $this->db->jdate($obj->date_ech); + $this->date_ech = $this->db->jdate($obj->date_ech); $this->lib = $obj->label; $this->label = $obj->label; $this->type = $obj->fk_type; $this->type_label = $obj->libelle; $this->fk_account = $obj->fk_account; - $this->mode_reglement_id = $obj->fk_mode_reglement; - $this->mode_reglement_code = $obj->mode_reglement_code; - $this->mode_reglement = $obj->mode_reglement_libelle; - $this->amount = $obj->amount; - $this->fk_project = $obj->fk_project; - $this->paye = $obj->paye; - $this->periode = $this->db->jdate($obj->periode); - $this->import_key = $this->import_key; + $this->mode_reglement_id = $obj->fk_mode_reglement; + $this->mode_reglement_code = $obj->mode_reglement_code; + $this->mode_reglement = $obj->mode_reglement_libelle; + $this->amount = $obj->amount; + $this->fk_project = $obj->fk_project; + $this->paye = $obj->paye; + $this->periode = $this->db->jdate($obj->periode); + $this->import_key = $this->import_key; $this->db->free($resql); @@ -497,7 +497,7 @@ class ChargeSociales extends CommonObject global $langs; // Load translation files required by the page - $langs->loadLangs(array("customers","bills")); + $langs->loadLangs(array("customers", "bills")); // We reinit status array to force to redefine them because label may change according to properties values. $this->labelStatus = array(); @@ -548,41 +548,41 @@ class ChargeSociales extends CommonObject if ($option !== 'nolink') { // Add param to save lastsearch_values or not - $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); - if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; - if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; + $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; + if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; } - if (empty($this->ref)) $this->ref=$this->label; + if (empty($this->ref)) $this->ref = $this->label; $label = ''.$langs->trans("ShowSocialContribution").''; - if (! empty($this->ref)) - $label .= '
'.$langs->trans('Ref') . ': ' . $this->ref; - if (! empty($this->label)) - $label .= '
'.$langs->trans('Label') . ': ' . $this->label; - if (! empty($this->type_label)) - $label .= '
'.$langs->trans('Type') . ': ' . $this->type_label; + if (!empty($this->ref)) + $label .= '
'.$langs->trans('Ref').': '.$this->ref; + if (!empty($this->label)) + $label .= '
'.$langs->trans('Label').': '.$this->label; + if (!empty($this->type_label)) + $label .= '
'.$langs->trans('Type').': '.$this->type_label; - $linkclose=''; + $linkclose = ''; if (empty($notooltip) && $user->rights->facture->lire) { - if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - $label=$langs->trans("ShowSocialContribution"); - $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + $label = $langs->trans("ShowSocialContribution"); + $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose.=' class="classfortooltip"'; + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="classfortooltip"'; } - $linkstart=''; - $linkend=''; + $linkstart = ''; + $linkend = ''; $result .= $linkstart; - if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); - if ($withpicto != 2) $result.= ($maxlen?dol_trunc($this->ref, $maxlen):$this->ref); + if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + if ($withpicto != 2) $result .= ($maxlen ?dol_trunc($this->ref, $maxlen) : $this->ref); $result .= $linkend; return $result; diff --git a/htdocs/compta/tva/document.php b/htdocs/compta/tva/document.php index 6c1816589f4..7f860491a8d 100644 --- a/htdocs/compta/tva/document.php +++ b/htdocs/compta/tva/document.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/vat.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -if (! empty($conf->projet->enabled)) +if (!empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; @@ -48,7 +48,7 @@ $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); // Security check -if ($user->socid) $socid=$user->socid; +if ($user->socid) $socid = $user->socid; $result = restrictedArea($user, 'tax', '', 'vat', 'charges'); @@ -63,22 +63,22 @@ if (empty($page) || $page == -1) { $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (! $sortorder) $sortorder="ASC"; -if (! $sortfield) $sortfield="name"; +if (!$sortorder) $sortorder = "ASC"; +if (!$sortfield) $sortfield = "name"; $object = new Tva($db); if ($id > 0) $object->fetch($id); $upload_dir = $conf->tax->dir_output.'/'.dol_sanitizeFileName($object->ref); -$modulepart='tax'; +$modulepart = 'tax'; /* * Actions */ -include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; +include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; if ($action == 'setlib' && $user->rights->tax->charges->creer) { @@ -94,29 +94,29 @@ if ($action == 'setlib' && $user->rights->tax->charges->creer) */ $form = new Form($db); -if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } +if (!empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } -$title = $langs->trans("VATPayment") . ' - ' . $langs->trans("Documents"); -$help_url='EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:Módulo Impuestos y cargas sociales (IVA, impuestos)'; +$title = $langs->trans("VATPayment").' - '.$langs->trans("Documents"); +$help_url = 'EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:Módulo Impuestos y cargas sociales (IVA, impuestos)'; llxHeader("", $title, $help_url); if ($object->id) { - $alreadypayed=$object->getSommePaiement(); + $alreadypayed = $object->getSommePaiement(); - $head=vat_prepare_head($object); + $head = vat_prepare_head($object); dol_fiche_head($head, 'documents', $langs->trans("VATPayment"), -1, 'bill'); - $morehtmlref='
'; + $morehtmlref = '
'; // Label of social contribution - $morehtmlref.=$form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1); - $morehtmlref.='
'; + $morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1); + $morehtmlref .= '
'; - $linkback = '' . $langs->trans("BackToList") . ''; + $linkback = ''.$langs->trans("BackToList").''; - $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status + $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); @@ -124,11 +124,11 @@ if ($object->id) print '
'; // Build file list - $filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1); - $totalsize=0; - foreach($filearray as $key => $file) + $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); + $totalsize = 0; + foreach ($filearray as $key => $file) { - $totalsize+=$file['size']; + $totalsize += $file['size']; } @@ -147,8 +147,8 @@ if ($object->id) $modulepart = 'tax'; $permission = $user->rights->tax->charges->creer; $permtoedit = $user->rights->fournisseur->facture->creer; - $param = '&id=' . $object->id; - include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; + $param = '&id='.$object->id; + include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index c80dda1da91..1fc63769af3 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -724,7 +724,7 @@ if (empty($reshook)) if (is_array($array_options) && count($array_options) > 0) { // We replace values in this->line->array_options only for entries defined into $array_options - foreach($array_options as $key => $value) { + foreach ($array_options as $key => $value) { $objectline->array_options[$key] = $array_options[$key]; } } diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index aba614f3c74..ecf12e11484 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -901,7 +901,7 @@ class Contrat extends CommonObject $line->fk_user_author = $objp->fk_user_author; $line->fk_user_ouverture = $objp->fk_user_ouverture; - $line->fk_user_cloture = $objp->fk_user_cloture; + $line->fk_user_cloture = $objp->fk_user_cloture; $line->fk_unit = $objp->fk_unit; $line->ref = $objp->product_ref; // deprecated @@ -1807,7 +1807,7 @@ class Contrat extends CommonObject $contractline->fetch_optionals(); // We replace values in $contractline->array_options only for entries defined into $array_options - foreach($array_options as $key => $value) { + foreach ($array_options as $key => $value) { $contractline->array_options[$key] = $array_options[$key]; } diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 29501ddee88..952a286d773 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -86,36 +86,36 @@ $extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label('contratdet'); -$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); +$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); // Security check $contratid = GETPOST('id', 'int'); -if (! empty($user->socid)) $socid=$user->socid; +if (!empty($user->socid)) $socid = $user->socid; $result = restrictedArea($user, 'contrat', $contratid); if ($search_status != '') { - $tmp=explode('&', $search_status); - $mode=$tmp[0]; - if (empty($tmp[1])) $filter=''; + $tmp = explode('&', $search_status); + $mode = $tmp[0]; + if (empty($tmp[1])) $filter = ''; else { - if ($tmp[1] == 'filter=notexpired') $filter='notexpired'; - if ($tmp[1] == 'filter=expired') $filter='expired'; + if ($tmp[1] == 'filter=notexpired') $filter = 'notexpired'; + if ($tmp[1] == 'filter=expired') $filter = 'expired'; } } else { $search_status = $mode; - if ($filter == 'expired') $search_status.='&filter=expired'; - if ($filter == 'notexpired') $search_status.='&filter=notexpired'; + if ($filter == 'expired') $search_status .= '&filter=expired'; + if ($filter == 'notexpired') $search_status .= '&filter=notexpired'; } -$staticcontrat=new Contrat($db); -$staticcontratligne=new ContratLigne($db); -$companystatic=new Societe($db); +$staticcontrat = new Contrat($db); +$staticcontratligne = new ContratLigne($db); +$companystatic = new Societe($db); -$arrayfields=array( +$arrayfields = array( 'c.ref'=>array('label'=>$langs->trans("Contract"), 'checked'=>1, 'position'=>80), 'p.description'=>array('label'=>$langs->trans("Service"), 'checked'=>1, 'position'=>80), 'cd.qty'=>array('label'=>$langs->trans("Qty"), 'checked'=>0, 'position'=>100), @@ -198,71 +198,71 @@ if (empty($reshook)) * View */ -$now=dol_now(); +$now = dol_now(); -$form=new Form($db); +$form = new Form($db); $sql = "SELECT c.rowid as cid, c.ref, c.statut as cstatut,"; -$sql.= " s.rowid as socid, s.nom as name, s.email, s.client, s.fournisseur,"; -$sql.= " cd.rowid, cd.description, cd.statut,"; -$sql.= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype, p.entity as pentity,"; +$sql .= " s.rowid as socid, s.nom as name, s.email, s.client, s.fournisseur,"; +$sql .= " cd.rowid, cd.description, cd.statut,"; +$sql .= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype, p.entity as pentity,"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " sc.fk_soc, sc.fk_user,"; -$sql.= " cd.date_ouverture_prevue,"; -$sql.= " cd.date_ouverture,"; -$sql.= " cd.date_fin_validite,"; -$sql.= " cd.date_cloture,"; -$sql.= " cd.qty,"; -$sql.= " cd.total_ht,"; -$sql.= " cd.total_tva,"; -$sql.= " cd.tva_tx,"; -$sql.= " cd.subprice,"; +$sql .= " cd.date_ouverture_prevue,"; +$sql .= " cd.date_ouverture,"; +$sql .= " cd.date_fin_validite,"; +$sql .= " cd.date_cloture,"; +$sql .= " cd.qty,"; +$sql .= " cd.total_ht,"; +$sql .= " cd.total_tva,"; +$sql .= " cd.tva_tx,"; +$sql .= " cd.subprice,"; //$sql.= " cd.date_c as date_creation,"; -$sql.= " cd.tms as date_update"; +$sql .= " cd.tms as date_update"; // Add fields from extrafields -if (! empty($extrafields->attributes[$object->table_element]['label'])) { - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); +if (!empty($extrafields->attributes[$object->table_element]['label'])) { + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); } // Add fields from hooks -$parameters=array(); -$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook -$sql.=$hookmanager->resPrint; -$sql.= " FROM ".MAIN_DB_PREFIX."contrat as c,"; -$sql.= " ".MAIN_DB_PREFIX."societe as s,"; +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; +$sql .= " FROM ".MAIN_DB_PREFIX."contrat as c,"; +$sql .= " ".MAIN_DB_PREFIX."societe as s,"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,"; -$sql.= " ".MAIN_DB_PREFIX."contratdet as cd"; -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (cd.rowid = ef.fk_object)"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; -if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=cd.fk_product'; -$sql.= " WHERE c.entity = ".$conf->entity; -$sql.= " AND c.rowid = cd.fk_contrat"; -if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$search_product_category; -$sql.= " AND c.fk_soc = s.rowid"; -if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; -if ($mode == "0") $sql.= " AND cd.statut = 0"; -if ($mode == "4") $sql.= " AND cd.statut = 4"; -if ($mode == "5") $sql.= " AND cd.statut = 5"; -if ($filter == "expired") $sql.= " AND cd.date_fin_validite < '".$db->idate($now)."'"; -if ($filter == "notexpired") $sql.= " AND cd.date_fin_validite >= '".$db->idate($now)."'"; -if ($search_name) $sql.= " AND s.nom LIKE '%".$db->escape($search_name)."%'"; -if ($search_contract) $sql.= " AND c.ref LIKE '%".$db->escape($search_contract)."%' "; -if ($search_service) $sql.= " AND (p.ref LIKE '%".$db->escape($search_service)."%' OR p.description LIKE '%".$db->escape($search_service)."%' OR cd.description LIKE '%".$db->escape($search_service)."%')"; -if ($socid > 0) $sql.= " AND s.rowid = ".$socid; -$filter_dateouvertureprevue=dol_mktime(0, 0, 0, $opouvertureprevuemonth, $opouvertureprevueday, $opouvertureprevueyear); +$sql .= " ".MAIN_DB_PREFIX."contratdet as cd"; +if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (cd.rowid = ef.fk_object)"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; +if ($search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=cd.fk_product'; +$sql .= " WHERE c.entity = ".$conf->entity; +$sql .= " AND c.rowid = cd.fk_contrat"; +if ($search_product_category > 0) $sql .= " AND cp.fk_categorie = ".$search_product_category; +$sql .= " AND c.fk_soc = s.rowid"; +if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; +if ($mode == "0") $sql .= " AND cd.statut = 0"; +if ($mode == "4") $sql .= " AND cd.statut = 4"; +if ($mode == "5") $sql .= " AND cd.statut = 5"; +if ($filter == "expired") $sql .= " AND cd.date_fin_validite < '".$db->idate($now)."'"; +if ($filter == "notexpired") $sql .= " AND cd.date_fin_validite >= '".$db->idate($now)."'"; +if ($search_name) $sql .= " AND s.nom LIKE '%".$db->escape($search_name)."%'"; +if ($search_contract) $sql .= " AND c.ref LIKE '%".$db->escape($search_contract)."%' "; +if ($search_service) $sql .= " AND (p.ref LIKE '%".$db->escape($search_service)."%' OR p.description LIKE '%".$db->escape($search_service)."%' OR cd.description LIKE '%".$db->escape($search_service)."%')"; +if ($socid > 0) $sql .= " AND s.rowid = ".$socid; +$filter_dateouvertureprevue = dol_mktime(0, 0, 0, $opouvertureprevuemonth, $opouvertureprevueday, $opouvertureprevueyear); if ($filter_dateouvertureprevue != '' && $filter_opouvertureprevue == -1) $filter_opouvertureprevue = '='; -$filter_date1=dol_mktime(0, 0, 0, $op1month, $op1day, $op1year); +$filter_date1 = dol_mktime(0, 0, 0, $op1month, $op1day, $op1year); if ($filter_date1 != '' && $filter_op1 == -1) $filter_op1 = '='; -$filter_date2=dol_mktime(0, 0, 0, $op2month, $op2day, $op2year); +$filter_date2 = dol_mktime(0, 0, 0, $op2month, $op2day, $op2year); if ($filter_date2 != '' && $filter_op2 == -1) $filter_op2 = '='; -$filter_datecloture=dol_mktime(0, 0, 0, $opcloturemonth, $opclotureday, $opclotureyear); +$filter_datecloture = dol_mktime(0, 0, 0, $opcloturemonth, $opclotureday, $opclotureyear); if ($filter_datecloture != '' && $filter_opcloture == -1) $filter_opcloture = '='; -if (! empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1 && $filter_dateouvertureprevue != '') $sql.= " AND cd.date_ouverture_prevue ".$filter_opouvertureprevue." '".$db->idate($filter_dateouvertureprevue)."'"; -if (! empty($filter_op1) && $filter_op1 != -1 && $filter_date1 != '') $sql.= " AND cd.date_ouverture ".$filter_op1." '".$db->idate($filter_date1)."'"; -if (! empty($filter_op2) && $filter_op2 != -1 && $filter_date2 != '') $sql.= " AND cd.date_fin_validite ".$filter_op2." '".$db->idate($filter_date2)."'"; -if (! empty($filter_opcloture) && $filter_opcloture != -1 && $filter_datecloture != '') $sql.= " AND cd.date_cloture ".$filter_opcloture." '".$db->idate($filter_datecloture)."'"; +if (!empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1 && $filter_dateouvertureprevue != '') $sql .= " AND cd.date_ouverture_prevue ".$filter_opouvertureprevue." '".$db->idate($filter_dateouvertureprevue)."'"; +if (!empty($filter_op1) && $filter_op1 != -1 && $filter_date1 != '') $sql .= " AND cd.date_ouverture ".$filter_op1." '".$db->idate($filter_date1)."'"; +if (!empty($filter_op2) && $filter_op2 != -1 && $filter_date2 != '') $sql .= " AND cd.date_fin_validite ".$filter_op2." '".$db->idate($filter_date2)."'"; +if (!empty($filter_opcloture) && $filter_opcloture != -1 && $filter_datecloture != '') $sql .= " AND cd.date_cloture ".$filter_opcloture." '".$db->idate($filter_datecloture)."'"; // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; $sql .= $db->order($sortfield, $sortorder); @@ -594,120 +594,120 @@ while ($i < min($num, $limit)) if ($obj->type == 1) print img_object($obj->description, 'service').' '.dol_trunc($obj->description, 24); } print ''; - if (! $i) $totalarray['nbfield']++; + if (!$i) $totalarray['nbfield']++; } - if (! empty($arrayfields['cd.qty']['checked'])) + if (!empty($arrayfields['cd.qty']['checked'])) { print ''; print $obj->qty; print ''; - if (! $i) $totalarray['nbfield']++; + if (!$i) $totalarray['nbfield']++; } - if (! empty($arrayfields['cd.total_ht']['checked'])) + if (!empty($arrayfields['cd.total_ht']['checked'])) { print ''; print price($obj->total_ht); print ''; - if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['pos'][$totalarray['nbfield']]='cd.total_ht'; + if (!$i) $totalarray['nbfield']++; + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'cd.total_ht'; $totalarray['val']['cd.total_ht'] += $obj->total_ht; } - if (! empty($arrayfields['cd.total_tva']['checked'])) + if (!empty($arrayfields['cd.total_tva']['checked'])) { print ''; print price($obj->total_tva); print ''; - if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['pos'][$totalarray['nbfield']]='cd.total_tva'; + if (!$i) $totalarray['nbfield']++; + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'cd.total_tva'; $totalarray['val']['cd.total_tva'] += $obj->total_tva; } - if (! empty($arrayfields['cd.tva_tx']['checked'])) + if (!empty($arrayfields['cd.tva_tx']['checked'])) { print ''; print price2num($obj->tva_tx).'%'; print ''; - if (! $i) $totalarray['nbfield']++; + if (!$i) $totalarray['nbfield']++; } - if (! empty($arrayfields['cd.subprice']['checked'])) + if (!empty($arrayfields['cd.subprice']['checked'])) { print ''; print price($obj->subprice); print ''; - if (! $i) $totalarray['nbfield']++; + if (!$i) $totalarray['nbfield']++; } // Third party - if (! empty($arrayfields['s.nom']['checked'])) + if (!empty($arrayfields['s.nom']['checked'])) { print ''; print $companystatic->getNomUrl(1, 'customer', 28); print ''; - if (! $i) $totalarray['nbfield']++; + if (!$i) $totalarray['nbfield']++; } // Start date - if (! empty($arrayfields['cd.date_ouverture_prevue']['checked'])) + if (!empty($arrayfields['cd.date_ouverture_prevue']['checked'])) { print ''; - print ($obj->date_ouverture_prevue?dol_print_date($db->jdate($obj->date_ouverture_prevue), 'dayhour'):' '); + print ($obj->date_ouverture_prevue ?dol_print_date($db->jdate($obj->date_ouverture_prevue), 'dayhour') : ' '); if ($db->jdate($obj->date_ouverture_prevue) && ($db->jdate($obj->date_ouverture_prevue) < ($now - $conf->contrat->services->inactifs->warning_delay)) && $obj->statut == 0) print ' '.img_picto($langs->trans("Late"), "warning"); else print '    '; print ''; - if (! $i) $totalarray['nbfield']++; + if (!$i) $totalarray['nbfield']++; } - if (! empty($arrayfields['cd.date_ouverture']['checked'])) + if (!empty($arrayfields['cd.date_ouverture']['checked'])) { - print ''.($obj->date_ouverture?dol_print_date($db->jdate($obj->date_ouverture), 'dayhour'):' ').''; - if (! $i) $totalarray['nbfield']++; + print ''.($obj->date_ouverture ?dol_print_date($db->jdate($obj->date_ouverture), 'dayhour') : ' ').''; + if (!$i) $totalarray['nbfield']++; } // End date - if (! empty($arrayfields['cd.date_fin_validite']['checked'])) + if (!empty($arrayfields['cd.date_fin_validite']['checked'])) { - print ''.($obj->date_fin_validite?dol_print_date($db->jdate($obj->date_fin_validite), 'dayhour'):' '); + print ''.($obj->date_fin_validite ?dol_print_date($db->jdate($obj->date_fin_validite), 'dayhour') : ' '); if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5) { - $warning_delay=$conf->contrat->services->expires->warning_delay / 3600 / 24; + $warning_delay = $conf->contrat->services->expires->warning_delay / 3600 / 24; $textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days"); print img_warning($textlate); } else print '    '; print ''; - if (! $i) $totalarray['nbfield']++; + if (!$i) $totalarray['nbfield']++; } // Close date (real end date) - if (! empty($arrayfields['cd.date_cloture']['checked'])) + if (!empty($arrayfields['cd.date_cloture']['checked'])) { print ''.dol_print_date($db->jdate($obj->date_cloture), 'dayhour').''; - if (! $i) $totalarray['nbfield']++; + if (!$i) $totalarray['nbfield']++; } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); - $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation - if (! empty($arrayfields['cd.datec']['checked'])) + if (!empty($arrayfields['cd.datec']['checked'])) { print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; - if (! $i) $totalarray['nbfield']++; + if (!$i) $totalarray['nbfield']++; } // Date modification - if (! empty($arrayfields['cd.tms']['checked'])) + if (!empty($arrayfields['cd.tms']['checked'])) { print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); print ''; - if (! $i) $totalarray['nbfield']++; + if (!$i) $totalarray['nbfield']++; } // Status - if (! empty($arrayfields['status']['checked'])) + if (!empty($arrayfields['status']['checked'])) { print ''; if ($obj->cstatut == 0) @@ -717,21 +717,21 @@ while ($i < min($num, $limit)) } else { - print $staticcontratligne->LibStatut($obj->statut, 5, ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now)?1:0); + print $staticcontratligne->LibStatut($obj->statut, 5, ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now) ? 1 : 0); } print ''; - if (! $i) $totalarray['nbfield']++; + if (!$i) $totalarray['nbfield']++; } // Action column print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { - $selected=0; - if (in_array($obj->rowid, $arrayofselected)) $selected=1; - print ''; + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) $selected = 1; + print ''; } print ''; - if (! $i) $totalarray['nbfield']++; + if (!$i) $totalarray['nbfield']++; print "\n"; $i++; diff --git a/htdocs/core/actions_setmoduleoptions.inc.php b/htdocs/core/actions_setmoduleoptions.inc.php index d3f1d48064d..9ade3c148a4 100644 --- a/htdocs/core/actions_setmoduleoptions.inc.php +++ b/htdocs/core/actions_setmoduleoptions.inc.php @@ -31,22 +31,22 @@ if ($action == 'update' && is_array($arrayofparameters)) { $db->begin(); - $ok=true; - foreach($arrayofparameters as $key => $val) + $ok = true; + foreach ($arrayofparameters as $key => $val) { // Modify constant only if key was posted (avoid resetting key to the null value) if (GETPOSTISSET($key)) { - $result=dolibarr_set_const($db, $key, GETPOST($key, 'alpha'), 'chaine', 0, '', $conf->entity); + $result = dolibarr_set_const($db, $key, GETPOST($key, 'alpha'), 'chaine', 0, '', $conf->entity); if ($result < 0) { - $ok=false; + $ok = false; break; } } } - if (! $error) + if (!$error) { $db->commit(); if (empty($nomessageinupdate)) setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); @@ -66,16 +66,16 @@ if ($action == 'setModuleOptions') // Process common param fields if (is_array($_POST)) { - foreach($_POST as $key => $val) + foreach ($_POST as $key => $val) { if (preg_match('/^param(\d*)$/', $key, $reg)) // Works for POST['param'], POST['param1'], POST['param2'], ... { - $param=GETPOST("param".$reg[1], 'alpha'); - $value=GETPOST("value".$reg[1], 'alpha'); + $param = GETPOST("param".$reg[1], 'alpha'); + $value = GETPOST("value".$reg[1], 'alpha'); if ($param) { $res = dolibarr_set_const($db, $param, $value, 'chaine', 0, '', $conf->entity); - if (! $res > 0) $error++; + if (!$res > 0) $error++; } } } @@ -85,19 +85,19 @@ if ($action == 'setModuleOptions') if (GETPOST('upload', 'alpha') && GETPOST('keyforuploaddir', 'aZ09')) { include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $keyforuploaddir=GETPOST('keyforuploaddir', 'aZ09'); - $listofdir=explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->$keyforuploaddir))); - foreach($listofdir as $key=>$tmpdir) + $keyforuploaddir = GETPOST('keyforuploaddir', 'aZ09'); + $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->$keyforuploaddir))); + foreach ($listofdir as $key=>$tmpdir) { - $tmpdir=trim($tmpdir); - $tmpdir=preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); - if (! $tmpdir) { + $tmpdir = trim($tmpdir); + $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); + if (!$tmpdir) { unset($listofdir[$key]); continue; } - if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); + if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); else { - $upload_dir=$tmpdir; + $upload_dir = $tmpdir; } } if ($upload_dir) @@ -107,7 +107,7 @@ if ($action == 'setModuleOptions') } } - if (! $error) + if (!$error) { $db->commit(); if (empty($nomessageinsetmoduleoptions)) setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index 883dec19981..ab9dc42fca9 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -33,9 +33,9 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; */ class box_factures_imp extends ModeleBoxes { - public $boxcode="oldestunpaidcustomerbills"; - public $boximg="object_bill"; - public $boxlabel="BoxOldestUnpaidCustomerBills"; + public $boxcode = "oldestunpaidcustomerbills"; + public $boximg = "object_bill"; + public $boxlabel = "BoxOldestUnpaidCustomerBills"; public $depends = array("facture"); /** @@ -61,7 +61,7 @@ class box_factures_imp extends ModeleBoxes $this->db = $db; - $this->hidden = ! ($user->rights->facture->lire); + $this->hidden = !($user->rights->facture->lire); } /** @@ -74,7 +74,7 @@ class box_factures_imp extends ModeleBoxes { global $conf, $user, $langs; - $this->max=$max; + $this->max = $max; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; @@ -89,37 +89,37 @@ class box_factures_imp extends ModeleBoxes if ($user->rights->facture->lire) { $sql = "SELECT s.nom as name, s.rowid as socid, s.email,"; - $sql.= " s.code_client,"; - $sql.= " s.logo,"; - $sql.= " f.ref, f.date_lim_reglement as datelimite,"; - $sql.= " f.type,"; - $sql.= " f.amount, f.datef as df,"; - $sql.= " f.total as total_ht,"; - $sql.= " f.tva as total_tva,"; - $sql.= " f.total_ttc,"; - $sql.= " f.paye, f.fk_statut, f.rowid as facid"; - $sql.= ", sum(pf.amount) as am"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= ", ".MAIN_DB_PREFIX."facture as f"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture "; - $sql.= " WHERE f.fk_soc = s.rowid"; - $sql.= " AND f.entity IN (".getEntity('invoice').")"; - $sql.= " AND f.paye = 0"; - $sql.= " AND fk_statut = 1"; - if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if($user->socid) $sql.= " AND s.rowid = ".$user->socid; - $sql.= " GROUP BY s.nom, s.rowid, s.email, s.code_client, s.logo, f.ref, f.date_lim_reglement,"; - $sql.= " f.type, f.amount, f.datef, f.total, f.tva, f.total_ttc, f.paye, f.fk_statut, f.rowid"; + $sql .= " s.code_client,"; + $sql .= " s.logo,"; + $sql .= " f.ref, f.date_lim_reglement as datelimite,"; + $sql .= " f.type,"; + $sql .= " f.amount, f.datef as df,"; + $sql .= " f.total as total_ht,"; + $sql .= " f.tva as total_tva,"; + $sql .= " f.total_ttc,"; + $sql .= " f.paye, f.fk_statut, f.rowid as facid"; + $sql .= ", sum(pf.amount) as am"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql .= ", ".MAIN_DB_PREFIX."facture as f"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture "; + $sql .= " WHERE f.fk_soc = s.rowid"; + $sql .= " AND f.entity IN (".getEntity('invoice').")"; + $sql .= " AND f.paye = 0"; + $sql .= " AND fk_statut = 1"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; + if ($user->socid) $sql .= " AND s.rowid = ".$user->socid; + $sql .= " GROUP BY s.nom, s.rowid, s.email, s.code_client, s.logo, f.ref, f.date_lim_reglement,"; + $sql .= " f.type, f.amount, f.datef, f.total, f.tva, f.total_ttc, f.paye, f.fk_statut, f.rowid"; //$sql.= " ORDER BY f.datef DESC, f.ref DESC "; - $sql.= " ORDER BY datelimite ASC, f.ref ASC "; - $sql.= $this->db->plimit($max, 0); + $sql .= " ORDER BY datelimite ASC, f.ref ASC "; + $sql .= $this->db->plimit($max, 0); $result = $this->db->query($sql); if ($result) { $num = $this->db->num_rows($result); - $now=dol_now(); + $now = dol_now(); $line = 0; $l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateDue')).': %s)'; @@ -127,7 +127,7 @@ class box_factures_imp extends ModeleBoxes while ($line < $num) { $objp = $this->db->fetch_object($result); - $datelimite=$this->db->jdate($objp->datelimite); + $datelimite = $this->db->jdate($objp->datelimite); $facturestatic->id = $objp->facid; $facturestatic->ref = $objp->ref; $facturestatic->type = $objp->type; @@ -144,7 +144,7 @@ class box_factures_imp extends ModeleBoxes $societestatic->code_client = $objp->code_client; $societestatic->logo = $objp->logo; - $late=''; + $late = ''; if ($facturestatic->hasDelay()) { $late = img_warning(sprintf($l_due_date, dol_print_date($datelimite, 'day'))); } @@ -180,7 +180,7 @@ class box_factures_imp extends ModeleBoxes $line++; } - if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center"','text'=>$langs->trans("NoUnpaidCustomerBills")); + if ($num == 0) $this->info_box_contents[$line][0] = array('td' => 'class="center"', 'text'=>$langs->trans("NoUnpaidCustomerBills")); $this->db->free($result); } diff --git a/htdocs/core/boxes/box_services_expired.php b/htdocs/core/boxes/box_services_expired.php index 295c358caf0..94b4764eeae 100644 --- a/htdocs/core/boxes/box_services_expired.php +++ b/htdocs/core/boxes/box_services_expired.php @@ -94,7 +94,7 @@ class box_services_expired extends ModeleBoxes if ($user->socid) $sql .= ' AND c.fk_soc = '.$user->socid; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; $sql .= " GROUP BY c.rowid, c.ref, c.statut, c.date_contrat, c.ref_customer, c.ref_supplier, s.nom, s.rowid"; - $sql.= ", s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur"; + $sql .= ", s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur"; $sql .= " ORDER BY date_line ASC"; $sql .= $this->db->plimit($max, 0); diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 32ac5d2365c..06b6ec2d949 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -226,7 +226,7 @@ class DolEditor }); } }, - disableNativeSpellChecker: '.(empty($conf->global->CKEDITOR_NATIVE_SPELLCHECKER)?'true':'false'); + disableNativeSpellChecker: '.(empty($conf->global->CKEDITOR_NATIVE_SPELLCHECKER) ? 'true' : 'false'); if ($this->uselocalbrowser) { diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index f32621f93ac..4425e43cda2 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -101,7 +101,7 @@ * */ -require_once DOL_DOCUMENT_ROOT .'/includes/mike42/escpos-php/autoload.php'; +require_once DOL_DOCUMENT_ROOT.'/includes/mike42/escpos-php/autoload.php'; use Mike42\Escpos\PrintConnectors\FilePrintConnector; use Mike42\Escpos\PrintConnectors\NetworkPrintConnector; use Mike42\Escpos\PrintConnectors\WindowsPrintConnector; @@ -137,7 +137,7 @@ class dolReceiptPrinter extends Printer /** * @var string Error code (or message) */ - public $error=''; + public $error = ''; /** * @var string[] Error codes (or messages) @@ -151,7 +151,7 @@ class dolReceiptPrinter extends Printer */ public function __construct($db) { - $this->db=$db; + $this->db = $db; $this->tags = array( 'dol_line_feed', 'dol_line_feed_reverse', @@ -251,8 +251,8 @@ class dolReceiptPrinter extends Printer $line = 0; $obj = array(); $sql = 'SELECT rowid, name, fk_type, fk_profile, parameter'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'printer_receipt'; - $sql.= ' WHERE entity = '.$conf->entity; + $sql .= ' FROM '.MAIN_DB_PREFIX.'printer_receipt'; + $sql .= ' WHERE entity = '.$conf->entity; $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); @@ -319,8 +319,8 @@ class dolReceiptPrinter extends Printer $line = 0; $obj = array(); $sql = 'SELECT rowid, name, template'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'printer_receipt_template'; - $sql.= ' WHERE entity = '.$conf->entity; + $sql .= ' FROM '.MAIN_DB_PREFIX.'printer_receipt_template'; + $sql .= ' WHERE entity = '.$conf->entity; $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); @@ -399,10 +399,10 @@ class dolReceiptPrinter extends Printer global $conf; $error = 0; $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'printer_receipt'; - $sql.= ' (name, fk_type, fk_profile, parameter, entity)'; - $sql.= ' VALUES ("'.$this->db->escape($name).'", '.$type.', '.$profile.', "'.$this->db->escape($parameter).'", '.$conf->entity.')'; + $sql .= ' (name, fk_type, fk_profile, parameter, entity)'; + $sql .= ' VALUES ("'.$this->db->escape($name).'", '.$type.', '.$profile.', "'.$this->db->escape($parameter).'", '.$conf->entity.')'; $resql = $this->db->query($sql); - if (! $resql) { + if (!$resql) { $error++; $this->errors[] = $this->db->lasterror; } @@ -424,13 +424,13 @@ class dolReceiptPrinter extends Printer global $conf; $error = 0; $sql = 'UPDATE '.MAIN_DB_PREFIX.'printer_receipt'; - $sql.= ' SET name="'.$this->db->escape($name).'"'; - $sql.= ', fk_type='.$type; - $sql.= ', fk_profile='.$profile; - $sql.= ', parameter="'.$this->db->escape($parameter).'"'; - $sql.= ' WHERE rowid='.$printerid; + $sql .= ' SET name="'.$this->db->escape($name).'"'; + $sql .= ', fk_type='.$type; + $sql .= ', fk_profile='.$profile; + $sql .= ', parameter="'.$this->db->escape($parameter).'"'; + $sql .= ' WHERE rowid='.$printerid; $resql = $this->db->query($sql); - if (! $resql) { + if (!$resql) { $error++; $this->errors[] = $this->db->lasterror; } @@ -448,9 +448,9 @@ class dolReceiptPrinter extends Printer global $conf; $error = 0; $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'printer_receipt'; - $sql.= ' WHERE rowid='.$printerid; + $sql .= ' WHERE rowid='.$printerid; $resql = $this->db->query($sql); - if (! $resql) { + if (!$resql) { $error++; $this->errors[] = $this->db->lasterror; } @@ -469,10 +469,10 @@ class dolReceiptPrinter extends Printer global $conf; $error = 0; $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'printer_receipt_template'; - $sql.= ' (name, template, entity) VALUES ("'.$this->db->escape($name).'"'; - $sql.= ', "'.$this->db->escape($template).'", '.$conf->entity.')'; + $sql .= ' (name, template, entity) VALUES ("'.$this->db->escape($name).'"'; + $sql .= ', "'.$this->db->escape($template).'", '.$conf->entity.')'; $resql = $this->db->query($sql); - if (! $resql) { + if (!$resql) { $error++; $this->errors[] = $this->db->lasterror; } @@ -493,11 +493,11 @@ class dolReceiptPrinter extends Printer global $conf; $error = 0; $sql = 'UPDATE '.MAIN_DB_PREFIX.'printer_receipt_template'; - $sql.= ' SET name="'.$this->db->escape($name).'"'; - $sql.= ', template="'.$this->db->escape($template).'"'; - $sql.= ' WHERE rowid='.$templateid; + $sql .= ' SET name="'.$this->db->escape($name).'"'; + $sql .= ', template="'.$this->db->escape($template).'"'; + $sql .= ' WHERE rowid='.$templateid; $resql = $this->db->query($sql); - if (! $resql) { + if (!$resql) { $error++; $this->errors[] = $this->db->lasterror; } @@ -515,10 +515,10 @@ class dolReceiptPrinter extends Printer { global $conf; $error = 0; - $img = EscposImage::load(DOL_DOCUMENT_ROOT .'/theme/common/dolibarr_logo_bw.png'); + $img = EscposImage::load(DOL_DOCUMENT_ROOT.'/theme/common/dolibarr_logo_bw.png'); //$this->profile = CapabilityProfile::load("TM-T88IV"); $ret = $this->initPrinter($printerid); - if ($ret>0) { + if ($ret > 0) { setEventMessages($this->error, $this->errors, 'errors'); } else { try { @@ -532,7 +532,7 @@ class dolReceiptPrinter extends Printer $this->printer->cut(); // If is DummyPrintConnector send to log to debugging - if($this->printer->connector instanceof DummyPrintConnector) + if ($this->printer->connector instanceof DummyPrintConnector) { $data = $this->printer->connector-> getData(); dol_syslog($data); @@ -609,11 +609,11 @@ class dolReceiptPrinter extends Printer $level = 0; $nbcharactbyline = 48; $ret = $this->initPrinter($printerid); - if ($ret>0) { + if ($ret > 0) { setEventMessages($this->error, $this->errors, 'errors'); } else { $nboflines = count($vals); - for ($tplline=0; $tplline < $nboflines; $tplline++) { + for ($tplline = 0; $tplline < $nboflines; $tplline++) { //var_dump($vals[$tplline]['value']); switch ($vals[$tplline]['tag']) { case 'DOL_PRINT_TEXT': @@ -622,7 +622,7 @@ class dolReceiptPrinter extends Printer case 'DOL_PRINT_OBJECT_LINES': foreach ($object->lines as $line) { //var_dump($line); - $spacestoadd = $nbcharactbyline - strlen($line->ref)- strlen($line->qty) - 10 - 1; + $spacestoadd = $nbcharactbyline - strlen($line->ref) - strlen($line->qty) - 10 - 1; $spaces = str_repeat(' ', $spacestoadd); $this->printer->text($line->ref.$spaces.$line->qty.' '.str_pad(price($line->total_ttc), 10, ' ', STR_PAD_LEFT)."\n"); $this->printer->text(strip_tags(htmlspecialchars_decode($line->desc))."\n"); @@ -634,10 +634,10 @@ class dolReceiptPrinter extends Printer foreach ($object->lines as $line) { $vatarray[$line->tva_tx] += $line->total_tva; } - foreach($vatarray as $vatkey => $vatvalue) { - $spacestoadd = $nbcharactbyline - strlen($vatkey)- 12; + foreach ($vatarray as $vatkey => $vatvalue) { + $spacestoadd = $nbcharactbyline - strlen($vatkey) - 12; $spaces = str_repeat(' ', $spacestoadd); - $this->printer->text($spaces. $vatkey.'% '.str_pad(price($vatvalue), 10, ' ', STR_PAD_LEFT)."\n"); + $this->printer->text($spaces.$vatkey.'% '.str_pad(price($vatvalue), 10, ' ', STR_PAD_LEFT)."\n"); } break; case 'DOL_PRINT_OBJECT_TOTAL': @@ -686,11 +686,11 @@ class dolReceiptPrinter extends Printer } break; case 'DOL_PRINT_LOGO': - $img = EscposImage::load(DOL_DATA_ROOT .'/mycompany/logos/'.$mysoc->logo); + $img = EscposImage::load(DOL_DATA_ROOT.'/mycompany/logos/'.$mysoc->logo); $this->printer->graphics($img); break; case 'DOL_PRINT_LOGO_OLD': - $img = EscposImage::load(DOL_DATA_ROOT .'/mycompany/logos/'.$mysoc->logo); + $img = EscposImage::load(DOL_DATA_ROOT.'/mycompany/logos/'.$mysoc->logo); $this->printer->bitImage($img); break; case 'DOL_PRINT_QRCODE': @@ -721,7 +721,7 @@ class dolReceiptPrinter extends Printer } } // If is DummyPrintConnector send to log to debugging - if($this->printer->connector instanceof DummyPrintConnector) + if ($this->printer->connector instanceof DummyPrintConnector) { $data = $this->printer->connector->getData(); dol_syslog($data); @@ -743,9 +743,9 @@ class dolReceiptPrinter extends Printer global $conf; $error = 0; $sql = 'SELECT template'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'printer_receipt_template'; - $sql.= ' WHERE rowid='.$templateid; - $sql.= ' AND entity = '.$conf->entity; + $sql .= ' FROM '.MAIN_DB_PREFIX.'printer_receipt_template'; + $sql .= ' WHERE rowid='.$templateid; + $sql .= ' AND entity = '.$conf->entity; $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_array($resql); @@ -773,11 +773,11 @@ class dolReceiptPrinter extends Printer public function initPrinter($printerid) { global $conf; - $error=0; + $error = 0; $sql = 'SELECT rowid, name, fk_type, fk_profile, parameter'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'printer_receipt'; - $sql.= ' WHERE rowid = '.$printerid; - $sql.= ' AND entity = '.$conf->entity; + $sql .= ' FROM '.MAIN_DB_PREFIX.'printer_receipt'; + $sql .= ' WHERE rowid = '.$printerid; + $sql .= ' AND entity = '.$conf->entity; $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_array($resql); @@ -789,7 +789,7 @@ class dolReceiptPrinter extends Printer $error++; $this->errors[] = 'PrinterDontExist'; } - if (! $error) { + if (!$error) { $parameter = $obj['parameter']; try { switch ($obj['fk_type']) { diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 816dde6a619..e4716947822 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -232,24 +232,24 @@ class ExtraFields if (empty($attrname)) return -1; if (empty($label)) return -1; - if ($elementtype == 'thirdparty') $elementtype='societe'; - if ($elementtype == 'contact') $elementtype='socpeople'; + if ($elementtype == 'thirdparty') $elementtype = 'societe'; + if ($elementtype == 'contact') $elementtype = 'socpeople'; // Create field into database except for separator type which is not stored in database if ($type != 'separate') { - $result=$this->create($attrname, $type, $size, $elementtype, $unique, $required, $default_value, $param, $perms, $list, $computed, $help); + $result = $this->create($attrname, $type, $size, $elementtype, $unique, $required, $default_value, $param, $perms, $list, $computed, $help); } - $err1=$this->errno; + $err1 = $this->errno; if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate') { // Add declaration of field into table - $result2=$this->create_label($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $help, $default_value, $computed, $entity, $langfile, $enabled, $totalizable); - $err2=$this->errno; + $result2 = $this->create_label($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $help, $default_value, $computed, $entity, $langfile, $enabled, $totalizable); + $err2 = $this->errno; if ($result2 > 0 || ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS')) { - $this->error=''; - $this->errno=0; + $this->error = ''; + $this->errno = 0; return 1; } else return -2; @@ -402,56 +402,56 @@ class ExtraFields } else { - $params=''; + $params = ''; } $sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields("; - $sql.= " name,"; - $sql.= " label,"; - $sql.= " type,"; - $sql.= " pos,"; - $sql.= " size,"; - $sql.= " entity,"; - $sql.= " elementtype,"; - $sql.= " fieldunique,"; - $sql.= " fieldrequired,"; - $sql.= " param,"; - $sql.= " alwayseditable,"; - $sql.= " perms,"; - $sql.= " langs,"; - $sql.= " list,"; - $sql.= " fielddefault,"; - $sql.= " fieldcomputed,"; - $sql.= " fk_user_author,"; - $sql.= " fk_user_modif,"; - $sql.= " datec,"; - $sql.= " enabled,"; - $sql.= " help,"; - $sql.= " totalizable"; - $sql.= " )"; - $sql.= " VALUES('".$attrname."',"; - $sql.= " '".$this->db->escape($label)."',"; - $sql.= " '".$this->db->escape($type)."',"; - $sql.= " ".$pos.","; - $sql.= " '".$this->db->escape($size)."',"; - $sql.= " ".($entity===''?$conf->entity:$entity).","; - $sql.= " '".$this->db->escape($elementtype)."',"; - $sql.= " ".$unique.","; - $sql.= " ".$required.","; - $sql.= " '".$this->db->escape($params)."',"; - $sql.= " ".$alwayseditable.","; - $sql.= " ".($perms?"'".$this->db->escape($perms)."'":"null").","; - $sql.= " ".($langfile?"'".$this->db->escape($langfile)."'":"null").","; - $sql.= " '".$this->db->escape($list)."',"; - $sql.= " ".($default?"'".$this->db->escape($default)."'":"null").","; - $sql.= " ".($computed?"'".$this->db->escape($computed)."'":"null").","; - $sql .= " " . (is_object($user) ? $user->id : 0). ","; - $sql .= " " . (is_object($user) ? $user->id : 0). ","; - $sql .= "'" . $this->db->idate(dol_now()) . "',"; - $sql.= " ".($enabled?"'".$this->db->escape($enabled)."'":"1").","; - $sql.= " ".($help?"'".$this->db->escape($help)."'":"null").","; - $sql.= " ".($totalizable?'1':'0'); - $sql.=')'; + $sql .= " name,"; + $sql .= " label,"; + $sql .= " type,"; + $sql .= " pos,"; + $sql .= " size,"; + $sql .= " entity,"; + $sql .= " elementtype,"; + $sql .= " fieldunique,"; + $sql .= " fieldrequired,"; + $sql .= " param,"; + $sql .= " alwayseditable,"; + $sql .= " perms,"; + $sql .= " langs,"; + $sql .= " list,"; + $sql .= " fielddefault,"; + $sql .= " fieldcomputed,"; + $sql .= " fk_user_author,"; + $sql .= " fk_user_modif,"; + $sql .= " datec,"; + $sql .= " enabled,"; + $sql .= " help,"; + $sql .= " totalizable"; + $sql .= " )"; + $sql .= " VALUES('".$attrname."',"; + $sql .= " '".$this->db->escape($label)."',"; + $sql .= " '".$this->db->escape($type)."',"; + $sql .= " ".$pos.","; + $sql .= " '".$this->db->escape($size)."',"; + $sql .= " ".($entity === '' ? $conf->entity : $entity).","; + $sql .= " '".$this->db->escape($elementtype)."',"; + $sql .= " ".$unique.","; + $sql .= " ".$required.","; + $sql .= " '".$this->db->escape($params)."',"; + $sql .= " ".$alwayseditable.","; + $sql .= " ".($perms ? "'".$this->db->escape($perms)."'" : "null").","; + $sql .= " ".($langfile ? "'".$this->db->escape($langfile)."'" : "null").","; + $sql .= " '".$this->db->escape($list)."',"; + $sql .= " ".($default ? "'".$this->db->escape($default)."'" : "null").","; + $sql .= " ".($computed ? "'".$this->db->escape($computed)."'" : "null").","; + $sql .= " ".(is_object($user) ? $user->id : 0).","; + $sql .= " ".(is_object($user) ? $user->id : 0).","; + $sql .= "'".$this->db->idate(dol_now())."',"; + $sql .= " ".($enabled ? "'".$this->db->escape($enabled)."'" : "1").","; + $sql .= " ".($help ? "'".$this->db->escape($help)."'" : "null").","; + $sql .= " ".($totalizable ? '1' : '0'); + $sql .= ')'; dol_syslog(get_class($this)."::create_label", LOG_DEBUG); if ($this->db->query($sql)) @@ -896,55 +896,55 @@ class ExtraFields // We can add this attribute to object. TODO Remove this and return $this->attributes[$elementtype]['label'] if ($tab->type != 'separate') { - $array_name_label[$tab->name]=$tab->label; + $array_name_label[$tab->name] = $tab->label; } // Old usage - $this->attribute_type[$tab->name]=$tab->type; - $this->attribute_label[$tab->name]=$tab->label; - $this->attribute_size[$tab->name]=$tab->size; - $this->attribute_elementtype[$tab->name]=$tab->elementtype; - $this->attribute_default[$tab->name]=$tab->fielddefault; - $this->attribute_computed[$tab->name]=$tab->fieldcomputed; - $this->attribute_unique[$tab->name]=$tab->fieldunique; - $this->attribute_required[$tab->name]=$tab->fieldrequired; - $this->attribute_param[$tab->name]=($tab->param ? unserialize($tab->param) : ''); - $this->attribute_pos[$tab->name]=$tab->pos; - $this->attribute_alwayseditable[$tab->name]=$tab->alwayseditable; - $this->attribute_perms[$tab->name]=(strlen($tab->perms) == 0 ? 1 : $tab->perms); - $this->attribute_langfile[$tab->name]=$tab->langs; - $this->attribute_list[$tab->name]=$tab->list; - $this->attribute_totalizable[$tab->name]=$tab->totalizable; - $this->attribute_entityid[$tab->name]=$tab->entity; + $this->attribute_type[$tab->name] = $tab->type; + $this->attribute_label[$tab->name] = $tab->label; + $this->attribute_size[$tab->name] = $tab->size; + $this->attribute_elementtype[$tab->name] = $tab->elementtype; + $this->attribute_default[$tab->name] = $tab->fielddefault; + $this->attribute_computed[$tab->name] = $tab->fieldcomputed; + $this->attribute_unique[$tab->name] = $tab->fieldunique; + $this->attribute_required[$tab->name] = $tab->fieldrequired; + $this->attribute_param[$tab->name] = ($tab->param ? unserialize($tab->param) : ''); + $this->attribute_pos[$tab->name] = $tab->pos; + $this->attribute_alwayseditable[$tab->name] = $tab->alwayseditable; + $this->attribute_perms[$tab->name] = (strlen($tab->perms) == 0 ? 1 : $tab->perms); + $this->attribute_langfile[$tab->name] = $tab->langs; + $this->attribute_list[$tab->name] = $tab->list; + $this->attribute_totalizable[$tab->name] = $tab->totalizable; + $this->attribute_entityid[$tab->name] = $tab->entity; // New usage - $this->attributes[$tab->elementtype]['type'][$tab->name]=$tab->type; - $this->attributes[$tab->elementtype]['label'][$tab->name]=$tab->label; - $this->attributes[$tab->elementtype]['size'][$tab->name]=$tab->size; - $this->attributes[$tab->elementtype]['elementtype'][$tab->name]=$tab->elementtype; - $this->attributes[$tab->elementtype]['default'][$tab->name]=$tab->fielddefault; - $this->attributes[$tab->elementtype]['computed'][$tab->name]=$tab->fieldcomputed; - $this->attributes[$tab->elementtype]['unique'][$tab->name]=$tab->fieldunique; - $this->attributes[$tab->elementtype]['required'][$tab->name]=$tab->fieldrequired; - $this->attributes[$tab->elementtype]['param'][$tab->name]=($tab->param ? unserialize($tab->param) : ''); - $this->attributes[$tab->elementtype]['pos'][$tab->name]=$tab->pos; - $this->attributes[$tab->elementtype]['alwayseditable'][$tab->name]=$tab->alwayseditable; - $this->attributes[$tab->elementtype]['perms'][$tab->name]=(strlen($tab->perms) == 0 ? 1 : $tab->perms); - $this->attributes[$tab->elementtype]['langfile'][$tab->name]=$tab->langs; - $this->attributes[$tab->elementtype]['list'][$tab->name]=$tab->list; - $this->attributes[$tab->elementtype]['totalizable'][$tab->name]=$tab->totalizable; - $this->attributes[$tab->elementtype]['entityid'][$tab->name]=$tab->entity; - $this->attributes[$tab->elementtype]['enabled'][$tab->name]=$tab->enabled; - $this->attributes[$tab->elementtype]['help'][$tab->name]=$tab->help; + $this->attributes[$tab->elementtype]['type'][$tab->name] = $tab->type; + $this->attributes[$tab->elementtype]['label'][$tab->name] = $tab->label; + $this->attributes[$tab->elementtype]['size'][$tab->name] = $tab->size; + $this->attributes[$tab->elementtype]['elementtype'][$tab->name] = $tab->elementtype; + $this->attributes[$tab->elementtype]['default'][$tab->name] = $tab->fielddefault; + $this->attributes[$tab->elementtype]['computed'][$tab->name] = $tab->fieldcomputed; + $this->attributes[$tab->elementtype]['unique'][$tab->name] = $tab->fieldunique; + $this->attributes[$tab->elementtype]['required'][$tab->name] = $tab->fieldrequired; + $this->attributes[$tab->elementtype]['param'][$tab->name] = ($tab->param ? unserialize($tab->param) : ''); + $this->attributes[$tab->elementtype]['pos'][$tab->name] = $tab->pos; + $this->attributes[$tab->elementtype]['alwayseditable'][$tab->name] = $tab->alwayseditable; + $this->attributes[$tab->elementtype]['perms'][$tab->name] = (strlen($tab->perms) == 0 ? 1 : $tab->perms); + $this->attributes[$tab->elementtype]['langfile'][$tab->name] = $tab->langs; + $this->attributes[$tab->elementtype]['list'][$tab->name] = $tab->list; + $this->attributes[$tab->elementtype]['totalizable'][$tab->name] = $tab->totalizable; + $this->attributes[$tab->elementtype]['entityid'][$tab->name] = $tab->entity; + $this->attributes[$tab->elementtype]['enabled'][$tab->name] = $tab->enabled; + $this->attributes[$tab->elementtype]['help'][$tab->name] = $tab->help; - $this->attributes[$tab->elementtype]['loaded']=1; + $this->attributes[$tab->elementtype]['loaded'] = 1; } } - if ($elementtype) $this->attributes[$elementtype]['loaded']=1; // If nothing found, we also save tag 'loaded' + if ($elementtype) $this->attributes[$elementtype]['loaded'] = 1; // If nothing found, we also save tag 'loaded' } else { - $this->error=$this->db->lasterror(); + $this->error = $this->db->lasterror(); dol_syslog(get_class($this)."::fetch_name_optionals_label ".$this->error, LOG_ERR); } @@ -1594,60 +1594,60 @@ class ExtraFields */ public function showOutputField($key, $value, $moreparam = '', $extrafieldsobjectkey = '') { - global $conf,$langs; + global $conf, $langs; - if (! empty($extrafieldsobjectkey)) + if (!empty($extrafieldsobjectkey)) { - $label=$this->attributes[$extrafieldsobjectkey]['label'][$key]; - $type=$this->attributes[$extrafieldsobjectkey]['type'][$key]; - $size=$this->attributes[$extrafieldsobjectkey]['size'][$key]; - $default=$this->attributes[$extrafieldsobjectkey]['default'][$key]; - $computed=$this->attributes[$extrafieldsobjectkey]['computed'][$key]; - $unique=$this->attributes[$extrafieldsobjectkey]['unique'][$key]; - $required=$this->attributes[$extrafieldsobjectkey]['required'][$key]; - $param=$this->attributes[$extrafieldsobjectkey]['param'][$key]; - $perms=dol_eval($this->attributes[$extrafieldsobjectkey]['perms'][$key], 1); - $langfile=$this->attributes[$extrafieldsobjectkey]['langfile'][$key]; - $list=dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1); - $help=$this->attributes[$extrafieldsobjectkey]['help'][$key]; - $hidden=(empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) + $label = $this->attributes[$extrafieldsobjectkey]['label'][$key]; + $type = $this->attributes[$extrafieldsobjectkey]['type'][$key]; + $size = $this->attributes[$extrafieldsobjectkey]['size'][$key]; + $default = $this->attributes[$extrafieldsobjectkey]['default'][$key]; + $computed = $this->attributes[$extrafieldsobjectkey]['computed'][$key]; + $unique = $this->attributes[$extrafieldsobjectkey]['unique'][$key]; + $required = $this->attributes[$extrafieldsobjectkey]['required'][$key]; + $param = $this->attributes[$extrafieldsobjectkey]['param'][$key]; + $perms = dol_eval($this->attributes[$extrafieldsobjectkey]['perms'][$key], 1); + $langfile = $this->attributes[$extrafieldsobjectkey]['langfile'][$key]; + $list = dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1); + $help = $this->attributes[$extrafieldsobjectkey]['help'][$key]; + $hidden = (empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) } else // Old usage { //dol_syslog("Warning: parameter 'extrafieldsobjectkey' is missing", LOG_WARNING); - $label=$this->attribute_label[$key]; - $type=$this->attribute_type[$key]; - $size=$this->attribute_size[$key]; - $default=$this->attribute_default[$key]; - $computed=$this->attribute_computed[$key]; - $unique=$this->attribute_unique[$key]; - $required=$this->attribute_required[$key]; - $param=$this->attribute_param[$key]; - $perms=dol_eval($this->attribute_perms[$key], 1); - $langfile=$this->attribute_langfile[$key]; - $list=dol_eval($this->attribute_list[$key], 1); - $help=''; // Not supported with old syntax - $hidden=(empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) + $label = $this->attribute_label[$key]; + $type = $this->attribute_type[$key]; + $size = $this->attribute_size[$key]; + $default = $this->attribute_default[$key]; + $computed = $this->attribute_computed[$key]; + $unique = $this->attribute_unique[$key]; + $required = $this->attribute_required[$key]; + $param = $this->attribute_param[$key]; + $perms = dol_eval($this->attribute_perms[$key], 1); + $langfile = $this->attribute_langfile[$key]; + $list = dol_eval($this->attribute_list[$key], 1); + $help = ''; // Not supported with old syntax + $hidden = (empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) } - if ($hidden) return ''; // This is a protection. If field is hidden, we should just not call this method. + if ($hidden) return ''; // This is a protection. If field is hidden, we should just not call this method. //if ($computed) $value = // $value is already calculated into $value before calling this method - $showsize=0; + $showsize = 0; if ($type == 'date') { - $showsize=10; - $value=dol_print_date($value, 'day'); + $showsize = 10; + $value = dol_print_date($value, 'day'); } elseif ($type == 'datetime') { - $showsize=19; - $value=dol_print_date($value, 'dayhour'); + $showsize = 19; + $value = dol_print_date($value, 'dayhour'); } elseif ($type == 'int') { - $showsize=10; + $showsize = 10; } elseif ($type == 'double') { @@ -1802,20 +1802,20 @@ class ExtraFields $keyList .= implode(', ', $fields_label); } - $sql = 'SELECT ' . $keyList; - $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0]; + $sql = 'SELECT '.$keyList; + $sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0]; if (strpos($InfoFieldList[4], 'extra') !== false) { $sql .= ' as main'; } // $sql.= " WHERE ".$selectkey."='".$this->db->escape($value)."'"; // $sql.= ' AND entity = '.$conf->entity; - dol_syslog(get_class($this) . ':showOutputField:$type=chkbxlst', LOG_DEBUG); + dol_syslog(get_class($this).':showOutputField:$type=chkbxlst', LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $value = ''; // value was used, so now we reste it to use it to build final output - $toprint=array(); - while ( $obj = $this->db->fetch_object($resql) ) { + $toprint = array(); + while ($obj = $this->db->fetch_object($resql)) { // Several field into label (eq table:code|libelle:rowid) $fields_label = explode('|', $InfoFieldList[1]); if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) { @@ -2068,35 +2068,35 @@ class ExtraFields { // Clean parameters // TODO GMT date in memory must be GMT so we should add gm=true in parameters - $value_key=dol_mktime(0, 0, 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]); + $value_key = dol_mktime(0, 0, 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]); } elseif (in_array($key_type, array('datetime'))) { // Clean parameters // TODO GMT date in memory must be GMT so we should add gm=true in parameters - $value_key=dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]); + $value_key = dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]); } - elseif (in_array($key_type, array('checkbox','chkbxlst'))) + elseif (in_array($key_type, array('checkbox', 'chkbxlst'))) { - $value_arr=GETPOST("options_".$key, 'array'); // check if an array + $value_arr = GETPOST("options_".$key, 'array'); // check if an array if (!empty($value_arr)) { - $value_key=implode($value_arr, ','); - }else { - $value_key=''; + $value_key = implode($value_arr, ','); + } else { + $value_key = ''; } } - elseif (in_array($key_type, array('price','double'))) + elseif (in_array($key_type, array('price', 'double'))) { - $value_arr=GETPOST("options_".$key, 'alpha'); - $value_key=price2num($value_arr); + $value_arr = GETPOST("options_".$key, 'alpha'); + $value_key = price2num($value_arr); } else { - $value_key=GETPOST("options_".$key); + $value_key = GETPOST("options_".$key); if (in_array($key_type, array('link')) && $value_key == '-1') $value_key = ''; } - $object->array_options["options_".$key]=$value_key; + $object->array_options["options_".$key] = $value_key; } if ($nofillrequired) { @@ -2149,13 +2149,13 @@ class ExtraFields if (in_array($key_type, array('date', 'datetime'))) { - if (! GETPOSTISSET($keysuffix."options_".$key.$keyprefix)."year") continue; // Value was not provided, we should not set it. + if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)."year") continue; // Value was not provided, we should not set it. // Clean parameters $value_key = dol_mktime(GETPOST($keysuffix."options_".$key.$keyprefix."hour", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."min", 'int'), 0, GETPOST($keysuffix."options_".$key.$keyprefix."month", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."day", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."year", 'int')); } elseif (in_array($key_type, array('checkbox', 'chkbxlst'))) { - if (! GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it. + if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it. $value_arr = GETPOST($keysuffix."options_".$key.$keyprefix); // Make sure we get an array even if there's only one checkbox $value_arr = (array) $value_arr; @@ -2163,13 +2163,13 @@ class ExtraFields } elseif (in_array($key_type, array('price', 'double', 'int'))) { - if (! GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it. + if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it. $value_arr = GETPOST($keysuffix."options_".$key.$keyprefix); $value_key = price2num($value_arr); } else { - if (! GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it. + if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it. $value_key = GETPOST($keysuffix."options_".$key.$keyprefix); } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 734f6f229c1..305a34d5036 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -767,7 +767,7 @@ class Form { //if (empty($showempty) && empty($row['rowid'])) continue; if (empty($row['rowid'])) continue; - if (is_array($exclude_country_code) && count($exclude_country_code) && in_array($row['code_iso'], $exclude_country_code)) continue; // exclude some countries + if (is_array($exclude_country_code) && count($exclude_country_code) && in_array($row['code_iso'], $exclude_country_code)) continue; // exclude some countries if (empty($disablefavorites) && $row['favorite'] && $row['code_iso']) $atleastonefavorite++; if (empty($row['favorite']) && $atleastonefavorite) @@ -2643,7 +2643,7 @@ class Form $langs->load("stocks"); $tmpproduct = new Product($this->db); - $tmpproduct->fetch($objp->rowid, '', '', '', 1, 1, 1); // Load product without lang and prices arrays (we just need to make ->virtual_stock() after) + $tmpproduct->fetch($objp->rowid, '', '', '', 1, 1, 1); // Load product without lang and prices arrays (we just need to make ->virtual_stock() after) $tmpproduct->load_virtual_stock(); $virtualstock = $tmpproduct->stock_theorique; @@ -6242,7 +6242,7 @@ class Form if (is_array($id)) { if (in_array($key, $id) && !$disabled) $out .= ' selected'; // To preselect a value } else { - $id = (string) $id; // if $id = 0, then $id = '0' + $id = (string) $id; // if $id = 0, then $id = '0' if ($id != '' && $id == $key && !$disabled) $out .= ' selected'; // To preselect a value } if ($nohtmlescape) $out .= ' data-html="'.dol_escape_htmltag($selectOptionValue).'"'; diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index fca9a9ae3d7..64e027db537 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -309,7 +309,7 @@ class FormAccounting extends Form return -1; } - $selected = $selectid; // selectid can be -1, 0, 123 + $selected = $selectid; // selectid can be -1, 0, 123 while ($obj = $this->db->fetch_object($resql)) { if (empty($obj->labelshort)) @@ -321,7 +321,7 @@ class FormAccounting extends Form $labeltoshow = $obj->labelshort; } - $label = length_accountg($obj->account_number) . ' - ' . $labeltoshow; + $label = length_accountg($obj->account_number).' - '.$labeltoshow; $label = dol_trunc($label, $trunclength); $select_value_in = $obj->rowid; @@ -459,7 +459,7 @@ class FormAccounting extends Form $sql = "SELECT DISTINCT date_format(doc_date, '%Y') as dtyear"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping"; - $sql .= " WHERE entity IN (" . getEntity('accountancy') . ")"; + $sql .= " WHERE entity IN (".getEntity('accountancy').")"; $sql .= " ORDER BY date_format(doc_date, '%Y')"; dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index f80d2f1547a..39c7d3ba778 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -117,10 +117,10 @@ class SMTPs /** * Message Sensitivity */ - private $_arySensitivity = array ( false, + private $_arySensitivity = array(false, 'Personal', 'Private', - 'Company Confidential' ); + 'Company Confidential'); /** * Message Sensitivity @@ -131,12 +131,12 @@ class SMTPs /** * Message Priority */ - private $_aryPriority = array ( 'Bulk', + private $_aryPriority = array('Bulk', 'Highest', 'High', 'Normal', 'Low', - 'Lowest' ); + 'Lowest'); /** * Content-Transfer-Encoding @@ -147,13 +147,13 @@ class SMTPs /** * Content-Transfer-Encoding */ - private $_smtpsTransEncodeTypes = array( '7bit', // Simple 7-bit ASCII - '8bit', // 8-bit coding with line termination characters - 'base64', // 3 octets encoded into 4 sextets with offset - 'binary', // Arbitrary binary stream - 'mac-binhex40', // Macintosh binary to hex encoding - 'quoted-printable', // Mostly 7-bit, with 8-bit characters encoded as "=HH" - 'uuencode' ); // UUENCODE encoding + private $_smtpsTransEncodeTypes = array('7bit', // Simple 7-bit ASCII + '8bit', // 8-bit coding with line termination characters + 'base64', // 3 octets encoded into 4 sextets with offset + 'binary', // Arbitrary binary stream + 'mac-binhex40', // Macintosh binary to hex encoding + 'quoted-printable', // Mostly 7-bit, with 8-bit characters encoded as "=HH" + 'uuencode'); // UUENCODE encoding /** * Content-Transfer-Encoding @@ -300,7 +300,7 @@ class SMTPs */ public function setErrorsTo($_strErrorsTo) { - if ( $_strErrorsTo ) + if ($_strErrorsTo) $this->_errorsTo = $this->_strip_email($_strErrorsTo); } @@ -314,7 +314,7 @@ class SMTPs { $_retValue = ''; - if ( $_part === true ) + if ($_part === true) $_retValue = $this->_errorsTo; else $_retValue = $this->_errorsTo[$_part]; @@ -359,29 +359,29 @@ class SMTPs // We have to make sure the HOST given is valid // This is done here because '@fsockopen' will not give me this // information if it failes to connect because it can't find the HOST - $host=$this->getHost(); + $host = $this->getHost(); $usetls = preg_match('@tls://@i', $host); - $host=preg_replace('@tcp://@i', '', $host); // Remove prefix - $host=preg_replace('@ssl://@i', '', $host); // Remove prefix - $host=preg_replace('@tls://@i', '', $host); // Remove prefix + $host = preg_replace('@tcp://@i', '', $host); // Remove prefix + $host = preg_replace('@ssl://@i', '', $host); // Remove prefix + $host = preg_replace('@tls://@i', '', $host); // Remove prefix // @CHANGE LDR include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - if ( (! is_ip($host)) && ((gethostbyname($host)) == $host)) + if ((!is_ip($host)) && ((gethostbyname($host)) == $host)) { - $this->_setErr(99, $host . ' is either offline or is an invalid host name.'); + $this->_setErr(99, $host.' is either offline or is an invalid host name.'); $_retVal = false; } else { //See if we can connect to the SMTP server if ($this->socket = @fsockopen( - preg_replace('@tls://@i', '', $this->getHost()), // Host to 'hit', IP or domain - $this->getPort(), // which Port number to use - $this->errno, // actual system level error - $this->errstr, // and any text that goes with the error + preg_replace('@tls://@i', '', $this->getHost()), // Host to 'hit', IP or domain + $this->getPort(), // which Port number to use + $this->errno, // actual system level error + $this->errstr, // and any text that goes with the error $this->_smtpTimeout // timeout for reading/writing data over the socket )) { // Fix from PHP SMTP class by 'Chris Ryan' @@ -391,14 +391,14 @@ class SMTPs if (function_exists('stream_set_timeout')) stream_set_timeout($this->socket, $this->_smtpTimeout, 0); // Check response from Server - if ( $_retVal = $this->server_parse($this->socket, "220") ) + if ($_retVal = $this->server_parse($this->socket, "220")) $_retVal = $this->socket; } // This connection attempt failed. else { // @CHANGE LDR - if (empty($this->errstr)) $this->errstr='Failed to connect with fsockopen host='.$this->getHost().' port='.$this->getPort(); + if (empty($this->errstr)) $this->errstr = 'Failed to connect with fsockopen host='.$this->getHost().' port='.$this->getPort(); $this->_setErr($this->errno, $this->errstr); $_retVal = false; } @@ -421,18 +421,18 @@ class SMTPs // Send the RFC2554 specified EHLO. // This improvment as provided by 'SirSir' to // accomodate both SMTP AND ESMTP capable servers - $host=$this->getHost(); + $host = $this->getHost(); $usetls = preg_match('@tls://@i', $host); - $host=preg_replace('@tcp://@i', '', $host); // Remove prefix - $host=preg_replace('@ssl://@i', '', $host); // Remove prefix - $host=preg_replace('@tls://@i', '', $host); // Remove prefix + $host = preg_replace('@tcp://@i', '', $host); // Remove prefix + $host = preg_replace('@ssl://@i', '', $host); // Remove prefix + $host = preg_replace('@tls://@i', '', $host); // Remove prefix - if ($usetls) $host='tls://'.$host; + if ($usetls) $host = 'tls://'.$host; $hosth = $host; - if (! empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) + if (!empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) { // If the from to is 'aaa ', we will keep 'ccc.com' $hosth = $this->getFrom('addr'); @@ -441,7 +441,7 @@ class SMTPs $hosth = preg_replace('/.*@/', '', $hosth); } - if ( $_retVal = $this->socket_send_str('EHLO ' . $hosth, '250') ) + if ($_retVal = $this->socket_send_str('EHLO '.$hosth, '250')) { if ($usetls) { @@ -492,7 +492,7 @@ class SMTPs // the answer with list of supported AUTH methods. They may differs between non STARTTLS and with STARTTLS. if (!$_retVal = $this->socket_send_str('EHLO '.$host, '250')) { - $this->_setErr(126, '"' . $host . '" does not support authenticated connections.'); + $this->_setErr(126, '"'.$host.'" does not support authenticated connections.'); return $_retVal; } } @@ -506,7 +506,7 @@ class SMTPs case 'PLAIN': $this->socket_send_str('AUTH PLAIN', '334'); // The error here just means the ID/password combo doesn't work. - $_retVal = $this->socket_send_str(base64_encode("\0" . $this->_smtpsID . "\0" . $this->_smtpsPW), '235'); + $_retVal = $this->socket_send_str(base64_encode("\0".$this->_smtpsID."\0".$this->_smtpsPW), '235'); break; case 'LOGIN': // most common case default: @@ -518,13 +518,13 @@ class SMTPs $_retVal = $this->socket_send_str(base64_encode($this->_smtpsPW), '235'); break; } - if (! $_retVal) { + if (!$_retVal) { $this->_setErr(130, 'Invalid Authentication Credentials.'); } } else { - $this->_setErr(126, '"' . $host . '" does not support authenticated connections.'); + $this->_setErr(126, '"'.$host.'" does not support authenticated connections.'); } return $_retVal; @@ -548,10 +548,10 @@ class SMTPs $_retVal = false; // Connect to Server - if ( $this->socket = $this->_server_connect() ) + if ($this->socket = $this->_server_connect()) { // If a User ID *and* a password is given, assume Authentication is desired - if( !empty($this->_smtpsID) && !empty($this->_smtpsPW) ) + if (!empty($this->_smtpsID) && !empty($this->_smtpsPW)) { // Send the RFC2554 specified EHLO. $_retVal = $this->_server_authenticate(); @@ -561,16 +561,16 @@ class SMTPs else { // Send the RFC821 specified HELO. - $host=$this->getHost(); + $host = $this->getHost(); $usetls = preg_match('@tls://@i', $host); - $host=preg_replace('@tcp://@i', '', $host); // Remove prefix - $host=preg_replace('@ssl://@i', '', $host); // Remove prefix - $host=preg_replace('@tls://@i', '', $host); // Remove prefix + $host = preg_replace('@tcp://@i', '', $host); // Remove prefix + $host = preg_replace('@ssl://@i', '', $host); // Remove prefix + $host = preg_replace('@tls://@i', '', $host); // Remove prefix $hosth = $host; - if (! empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) + if (!empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) { // If the from to is 'aaa ', we will keep 'ccc.com' $hosth = $this->getFrom('addr'); @@ -579,17 +579,17 @@ class SMTPs $hosth = preg_replace('/.*@/', '', $hosth); } - $_retVal = $this->socket_send_str('HELO ' . $hosth, '250'); + $_retVal = $this->socket_send_str('HELO '.$hosth, '250'); } // Well, did we get to the server? - if ( $_retVal ) + if ($_retVal) { // From this point onward most server response codes should be 250 // Specify who the mail is from.... // This has to be the raw email address, strip the "name" off - $resultmailfrom = $this->socket_send_str('MAIL FROM: ' . $this->getFrom('addr'), '250'); - if (! $resultmailfrom) { + $resultmailfrom = $this->socket_send_str('MAIL FROM: '.$this->getFrom('addr'), '250'); + if (!$resultmailfrom) { fclose($this->socket); return false; } @@ -613,7 +613,7 @@ class SMTPs * mark the last address as "bad" and start the address loop over again. * If any address fails, the entire message fails. */ - $this->socket_send_str('RCPT TO: <' . $_address . '>', '250'); + $this->socket_send_str('RCPT TO: <'.$_address.'>', '250'); } // Tell the server we are ready to start sending data @@ -623,7 +623,7 @@ class SMTPs // Now we are ready for the message... // Ok, all the ingredients are mixed in let's cook this puppy... - $this->socket_send_str($this->getHeader().$this->getBodyContent() . "\r\n" . '.', '250'); + $this->socket_send_str($this->getHeader().$this->getBodyContent()."\r\n".'.', '250'); // Now tell the server we are done and close the socket... fputs($this->socket, 'QUIT'); @@ -673,13 +673,13 @@ class SMTPs $_retVal = true; // if we have a path... - if ( ! empty($_strConfigPath) ) + if (!empty($_strConfigPath)) { // If the path is not valid, this will NOT generate an error, // it will simply return false. - if ( ! @include $_strConfigPath) + if (!@include $_strConfigPath) { - $this->_setErr(110, '"' . $_strConfigPath . '" is not a valid path.'); + $this->_setErr(110, '"'.$_strConfigPath.'" is not a valid path.'); $_retVal = false; } } @@ -689,13 +689,13 @@ class SMTPs { // Set these properties ONLY if they are set in the php.ini file. // Otherwise the default values will be used. - if ( $_host = ini_get('SMTPs') ) + if ($_host = ini_get('SMTPs')) $this->setHost($_host); - if ( $_port = ini_get('smtp_port') ) + if ($_port = ini_get('smtp_port')) $this->setPort($_port); - if ( $_from = ini_get('sendmail_from') ) + if ($_from = ini_get('sendmail_from')) $this->setFrom($_from); } @@ -757,7 +757,7 @@ class SMTPs */ public function setHost($_strHost) { - if ( $_strHost ) + if ($_strHost) $this->_smtpsHost = $_strHost; } @@ -782,8 +782,8 @@ class SMTPs */ public function setPort($_intPort) { - if ( ( is_numeric($_intPort) ) && - ( ( $_intPort >= 1 ) && ( $_intPort <= 65536 ) ) ) + if ((is_numeric($_intPort)) && + (($_intPort >= 1) && ($_intPort <= 65536))) $this->_smtpsPort = $_intPort; } @@ -849,7 +849,7 @@ class SMTPs */ public function setCharSet($_strCharSet) { - if ( $_strCharSet ) + if ($_strCharSet) $this->_smtpsCharSet = $_strCharSet; } @@ -937,7 +937,7 @@ class SMTPs */ public function setFrom($_strFrom) { - if ( $_strFrom ) + if ($_strFrom) $this->_msgFrom = $this->_strip_email($_strFrom); } @@ -951,7 +951,7 @@ class SMTPs { $_retValue = ''; - if ( $_part === true ) + if ($_part === true) $_retValue = $this->_msgFrom; else $_retValue = $this->_msgFrom[$_part]; @@ -967,7 +967,7 @@ class SMTPs */ public function setReplyTo($_strReplyTo) { - if ( $_strReplyTo ) + if ($_strReplyTo) $this->_msgReplyTo = $this->_strip_email($_strReplyTo); } @@ -981,7 +981,7 @@ class SMTPs { $_retValue = ''; - if ( $_part === true ) + if ($_part === true) $_retValue = $this->_msgReplyTo; else $_retValue = $this->_msgReplyTo[$_part]; @@ -1007,13 +1007,13 @@ class SMTPs $aryHost = $this->_msgRecipients; // Only run this if we have something - if ( !empty($_addrList)) + if (!empty($_addrList)) { // $_addrList can be a STRING or an array - if ( is_string($_addrList) ) + if (is_string($_addrList)) { // This could be a COMMA delimited string - if ( strstr($_addrList, ',') ) + if (strstr($_addrList, ',')) // "explode "list" into an array $_addrList = explode(',', $_addrList); @@ -1033,7 +1033,7 @@ class SMTPs $_tmpaddr = explode('<', $_strAddr); // We have a "Real Name" and eMail address - if ( count($_tmpaddr) == 2 ) + if (count($_tmpaddr) == 2) { $_tmpHost = explode('@', $_tmpaddr[1]); $_tmpaddr[0] = trim($_tmpaddr[0], ' ">'); @@ -1090,10 +1090,10 @@ class SMTPs $_tmpAry = explode('<', $_strAddr); // Do we have a "Real name" - if ( count($_tmpAry) == 2 ) + if (count($_tmpAry) == 2) { // We may not really have a "Real Name" - if ( $_tmpAry[0]) + if ($_tmpAry[0]) $_aryEmail['real'] = trim($_tmpAry[0], ' ">'); $_aryEmail['addr'] = $_tmpAry[1]; @@ -1102,10 +1102,10 @@ class SMTPs $_aryEmail['addr'] = $_tmpAry[0]; // Pull User Name and Host.tld apart - list($_aryEmail['user'], $_aryEmail['host'] ) = explode('@', $_aryEmail['addr']); + list($_aryEmail['user'], $_aryEmail['host']) = explode('@', $_aryEmail['addr']); // Put the brackets back around the address - $_aryEmail['addr'] = '<' . $_aryEmail['addr'] . '>'; + $_aryEmail['addr'] = '<'.$_aryEmail['addr'].'>'; return $_aryEmail; } @@ -1124,7 +1124,7 @@ class SMTPs /** * An array of bares addresses for use with 'RCPT TO:' */ - $_RCPT_list=array(); + $_RCPT_list = array(); // walk down Recipients array and pull just email addresses foreach ($this->_msgRecipients as $_host => $_list) @@ -1134,7 +1134,7 @@ class SMTPs foreach ($_subList as $_name => $_addr) { // build RCPT list - $_RCPT_list[] = $_name . '@' . $_host; + $_RCPT_list[] = $_name.'@'.$_host; } } } @@ -1153,27 +1153,27 @@ class SMTPs { // phpcs:enable // We need to know which address segment to pull - if ( $_which ) + if ($_which) { // Make sure we have addresses to process - if ( $this->_msgRecipients ) + if ($this->_msgRecipients) { - $_RCPT_list=array(); + $_RCPT_list = array(); // walk down Recipients array and pull just email addresses foreach ($this->_msgRecipients as $_host => $_list) { - if ( $this->_msgRecipients[$_host][$_which] ) + if ($this->_msgRecipients[$_host][$_which]) { foreach ($this->_msgRecipients[$_host][$_which] as $_addr => $_realName) { - if ( $_realName ) // @CHANGE LDR + if ($_realName) // @CHANGE LDR { - $_realName = '"' . $_realName . '"'; - $_RCPT_list[] = $_realName . ' <' . $_addr . '@' . $_host . '>'; + $_realName = '"'.$_realName.'"'; + $_RCPT_list[] = $_realName.' <'.$_addr.'@'.$_host.'>'; } else { - $_RCPT_list[] = $_addr . '@' . $_host; + $_RCPT_list[] = $_addr.'@'.$_host; } } } @@ -1202,7 +1202,7 @@ class SMTPs */ public function setTO($_addrTo) { - if ( $_addrTo ) + if ($_addrTo) $this->_buildAddrList('to', $_addrTo); } @@ -1224,7 +1224,7 @@ class SMTPs */ public function setCC($_strCC) { - if ( $_strCC ) + if ($_strCC) $this->_buildAddrList('cc', $_strCC); } @@ -1246,7 +1246,7 @@ class SMTPs */ public function setBCC($_strBCC) { - if ( $_strBCC ) + if ($_strBCC) $this->_buildAddrList('bcc', $_strBCC); } @@ -1268,7 +1268,7 @@ class SMTPs */ public function setSubject($_strSubject = '') { - if ( $_strSubject ) + if ($_strSubject) $this->_msgSubject = $_strSubject; } @@ -1291,11 +1291,11 @@ class SMTPs { global $conf; - $_header = 'From: ' . $this->getFrom('org') . "\r\n" - . 'To: ' . $this->getTO() . "\r\n"; + $_header = 'From: '.$this->getFrom('org')."\r\n" + . 'To: '.$this->getTO()."\r\n"; - if ( $this->getCC() ) - $_header .= 'Cc: ' . $this->getCC() . "\r\n"; + if ($this->getCC()) + $_header .= 'Cc: '.$this->getCC()."\r\n"; /* Note: * BCC email addresses must be listed in the RCPT TO command list, @@ -1308,50 +1308,50 @@ class SMTPs $_header .= 'Bcc: ' . $this->getBCC() . "\r\n"; */ - $host=dol_getprefix('email'); + $host = dol_getprefix('email'); //NOTE: Message-ID should probably contain the username of the user who sent the msg - $_header .= 'Subject: ' . $this->getSubject() . "\r\n"; - $_header .= 'Date: ' . date("r") . "\r\n"; + $_header .= 'Subject: '.$this->getSubject()."\r\n"; + $_header .= 'Date: '.date("r")."\r\n"; $trackid = $this->getTrackId(); if ($trackid) { // References is kept in response and Message-ID is returned into In-Reply-To: - $_header .= 'Message-ID: <' . time() . '.SMTPs-dolibarr-'.$trackid.'@' . $host . ">\r\n"; - $_header .= 'References: <' . time() . '.SMTPs-dolibarr-'.$trackid.'@' . $host . ">\r\n"; - $_header .= 'X-Dolibarr-TRACKID: ' . $trackid . '@' . $host . "\r\n"; + $_header .= 'Message-ID: <'.time().'.SMTPs-dolibarr-'.$trackid.'@'.$host.">\r\n"; + $_header .= 'References: <'.time().'.SMTPs-dolibarr-'.$trackid.'@'.$host.">\r\n"; + $_header .= 'X-Dolibarr-TRACKID: '.$trackid.'@'.$host."\r\n"; } else { - $_header .= 'Message-ID: <' . time() . '.SMTPs@' . $host . ">\r\n"; + $_header .= 'Message-ID: <'.time().'.SMTPs@'.$host.">\r\n"; } - if (! empty($_SERVER['REMOTE_ADDR'])) $_header .= "X-RemoteAddr: " . $_SERVER['REMOTE_ADDR']. "\r\n"; - if ( $this->getMoreInHeader() ) - $_header .= $this->getMoreInHeader(); // Value must include the "\r\n"; + if (!empty($_SERVER['REMOTE_ADDR'])) $_header .= "X-RemoteAddr: ".$_SERVER['REMOTE_ADDR']."\r\n"; + if ($this->getMoreInHeader()) + $_header .= $this->getMoreInHeader(); // Value must include the "\r\n"; //$_header .= // 'Read-Receipt-To: ' . $this->getFrom( 'org' ) . "\r\n" // 'Return-Receipt-To: ' . $this->getFrom( 'org' ) . "\r\n"; - if ( $this->getSensitivity() ) - $_header .= 'Sensitivity: ' . $this->getSensitivity() . "\r\n"; + if ($this->getSensitivity()) + $_header .= 'Sensitivity: '.$this->getSensitivity()."\r\n"; - if ( $this->_msgPriority != 3 ) + if ($this->_msgPriority != 3) $_header .= $this->getPriority(); // @CHANGE LDR - if ( $this->getDeliveryReceipt() ) - $_header .= 'Disposition-Notification-To: '.$this->getFrom('addr') . "\r\n"; - if ( $this->getErrorsTo() ) - $_header .= 'Errors-To: '.$this->getErrorsTo('addr') . "\r\n"; - if ( $this->getReplyTo() ) - $_header .= "Reply-To: ".$this->getReplyTo('addr') ."\r\n"; + if ($this->getDeliveryReceipt()) + $_header .= 'Disposition-Notification-To: '.$this->getFrom('addr')."\r\n"; + if ($this->getErrorsTo()) + $_header .= 'Errors-To: '.$this->getErrorsTo('addr')."\r\n"; + if ($this->getReplyTo()) + $_header .= "Reply-To: ".$this->getReplyTo('addr')."\r\n"; - $_header .= 'X-Mailer: Dolibarr version ' . DOL_VERSION .' (using SMTPs Mailer)' . "\r\n"; - $_header .= 'X-Dolibarr-Option: '.($conf->global->MAIN_MAIL_USE_MULTI_PART?'MAIN_MAIL_USE_MULTI_PART':'No MAIN_MAIL_USE_MULTI_PART') . "\r\n"; - $_header .= 'Mime-Version: 1.0' . "\r\n"; + $_header .= 'X-Mailer: Dolibarr version '.DOL_VERSION.' (using SMTPs Mailer)'."\r\n"; + $_header .= 'X-Dolibarr-Option: '.($conf->global->MAIN_MAIL_USE_MULTI_PART ? 'MAIN_MAIL_USE_MULTI_PART' : 'No MAIN_MAIL_USE_MULTI_PART')."\r\n"; + $_header .= 'Mime-Version: 1.0'."\r\n"; return $_header; @@ -1368,7 +1368,7 @@ class SMTPs { //if ( $strContent ) //{ - if ( $strType == 'html' ) + if ($strType == 'html') $strMimeType = 'text/html'; else $strMimeType = 'text/plain'; @@ -1387,7 +1387,7 @@ class SMTPs // Make RFC2045 Compliant //$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems ko if not used on a base64 content - $strContent = rtrim(wordwrap($strContent, 75, "\r\n")); // TODO Using this method creates unexpected line break on text/plain content. + $strContent = rtrim(wordwrap($strContent, 75, "\r\n")); // TODO Using this method creates unexpected line break on text/plain content. $this->_msgContent[$strType] = array(); @@ -1395,7 +1395,7 @@ class SMTPs $this->_msgContent[$strType]['data'] = $strContent; $this->_msgContent[$strType]['dataText'] = $strContentAltText; - if ( $this->getMD5flag() ) + if ($this->getMD5flag()) $this->_msgContent[$strType]['md5'] = dol_hash($strContent, 3); //} } @@ -1419,49 +1419,49 @@ class SMTPs $keyCount = count($_types); // If we have ZERO, we have a problem - if( $keyCount === 0 ) + if ($keyCount === 0) die("Sorry, no content"); // If we have ONE, we can use the simple format - elseif( $keyCount === 1 && empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) + elseif ($keyCount === 1 && empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) { $_msgData = $this->_msgContent; $_msgData = $_msgData[$_types[0]]; - $content = 'Content-Type: ' . $_msgData['mimeType'] . '; charset="' . $this->getCharSet() . '"' . "\r\n" - . 'Content-Transfer-Encoding: ' . $this->getTransEncodeType() . "\r\n" - . 'Content-Disposition: inline' . "\r\n" - . 'Content-Description: Message' . "\r\n"; + $content = 'Content-Type: '.$_msgData['mimeType'].'; charset="'.$this->getCharSet().'"'."\r\n" + . 'Content-Transfer-Encoding: '.$this->getTransEncodeType()."\r\n" + . 'Content-Disposition: inline'."\r\n" + . 'Content-Description: Message'."\r\n"; - if ( $this->getMD5flag() ) - $content .= 'Content-MD5: ' . $_msgData['md5'] . "\r\n"; + if ($this->getMD5flag()) + $content .= 'Content-MD5: '.$_msgData['md5']."\r\n"; $content .= "\r\n" - . $_msgData['data'] . "\r\n"; + . $_msgData['data']."\r\n"; } // If we have more than ONE, we use the multi-part format - elseif( $keyCount >= 1 || ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) + elseif ($keyCount >= 1 || !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) { // Since this is an actual multi-part message // We need to define a content message Boundary // NOTE: This was 'multipart/alternative', but Windows based mail servers have issues with this. //$content = 'Content-Type: multipart/related; boundary="' . $this->_getBoundary() . '"' . "\r\n"; - $content = 'Content-Type: multipart/mixed; boundary="' . $this->_getBoundary('mixed') . '"' . "\r\n"; + $content = 'Content-Type: multipart/mixed; boundary="'.$this->_getBoundary('mixed').'"'."\r\n"; // . "\r\n" // . 'This is a multi-part message in MIME format.' . "\r\n"; $content .= "Content-Transfer-Encoding: 8bit\r\n"; $content .= "\r\n"; - $content .= "--" . $this->_getBoundary('mixed') . "\r\n"; + $content .= "--".$this->_getBoundary('mixed')."\r\n"; if (key_exists('image', $this->_msgContent)) // If inline image found { - $content.= 'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary('alternative').'"' . "\r\n"; + $content .= 'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary('alternative').'"'."\r\n"; $content .= "\r\n"; - $content .= "--" . $this->_getBoundary('alternative') . "\r\n"; + $content .= "--".$this->_getBoundary('alternative')."\r\n"; } @@ -1471,91 +1471,91 @@ class SMTPs // Loop through message content array foreach ($this->_msgContent as $type => $_content) { - if ( $type == 'attachment' ) + if ($type == 'attachment') { // loop through all attachments foreach ($_content as $_file => $_data) { - $content .= "--" . $this->_getBoundary('mixed') . "\r\n" - . 'Content-Disposition: attachment; filename="' . $_data['fileName'] . '"' . "\r\n" - . 'Content-Type: ' . $_data['mimeType'] . '; name="' . $_data['fileName'] . '"' . "\r\n" - . 'Content-Transfer-Encoding: base64' . "\r\n" - . 'Content-Description: ' . $_data['fileName'] ."\r\n"; + $content .= "--".$this->_getBoundary('mixed')."\r\n" + . 'Content-Disposition: attachment; filename="'.$_data['fileName'].'"'."\r\n" + . 'Content-Type: '.$_data['mimeType'].'; name="'.$_data['fileName'].'"'."\r\n" + . 'Content-Transfer-Encoding: base64'."\r\n" + . 'Content-Description: '.$_data['fileName']."\r\n"; - if ( $this->getMD5flag() ) - $content .= 'Content-MD5: ' . $_data['md5'] . "\r\n"; + if ($this->getMD5flag()) + $content .= 'Content-MD5: '.$_data['md5']."\r\n"; - $content .= "\r\n" . $_data['data'] . "\r\n\r\n"; + $content .= "\r\n".$_data['data']."\r\n\r\n"; } } // @CHANGE LDR - elseif ( $type == 'image' ) + elseif ($type == 'image') { // loop through all images foreach ($_content as $_image => $_data) { - $content .= "--" . $this->_getBoundary('related') . "\r\n"; // always related for an inline image + $content .= "--".$this->_getBoundary('related')."\r\n"; // always related for an inline image - $content .= 'Content-Type: ' . $_data['mimeType'] . '; name="' . $_data['imageName'] . '"' . "\r\n" - . 'Content-Transfer-Encoding: base64' . "\r\n" - . 'Content-Disposition: inline; filename="' . $_data['imageName'] . '"' . "\r\n" - . 'Content-ID: <' . $_data['cid'] . '> ' . "\r\n"; + $content .= 'Content-Type: '.$_data['mimeType'].'; name="'.$_data['imageName'].'"'."\r\n" + . 'Content-Transfer-Encoding: base64'."\r\n" + . 'Content-Disposition: inline; filename="'.$_data['imageName'].'"'."\r\n" + . 'Content-ID: <'.$_data['cid'].'> '."\r\n"; - if ( $this->getMD5flag() ) - $content .= 'Content-MD5: ' . $_data['md5'] . "\r\n"; + if ($this->getMD5flag()) + $content .= 'Content-MD5: '.$_data['md5']."\r\n"; $content .= "\r\n" - . $_data['data'] . "\r\n"; + . $_data['data']."\r\n"; } // always end related and end alternative after inline images - $content.= "--" . $this->_getBoundary('related') . "--" . "\r\n"; - $content.= "\r\n" . "--" . $this->_getBoundary('alternative') . "--" . "\r\n"; - $content.= "\r\n"; + $content .= "--".$this->_getBoundary('related')."--"."\r\n"; + $content .= "\r\n"."--".$this->_getBoundary('alternative')."--"."\r\n"; + $content .= "\r\n"; } else { if (key_exists('image', $this->_msgContent)) { - $content.= "Content-Type: text/plain; charset=" . $this->getCharSet() . "\r\n"; - $content.= "\r\n" . ($_content['dataText']?$_content['dataText']:strip_tags($_content['data'])) . "\r\n"; // Add plain text message - $content.= "--" . $this->_getBoundary('alternative') . "\r\n"; - $content.= 'Content-Type: multipart/related; boundary="' . $this->_getBoundary('related') . '"' . "\r\n"; - $content.= "\r\n"; - $content.= "--" . $this->_getBoundary('related') . "\r\n"; - } - - if (! key_exists('image', $this->_msgContent) && $_content['dataText'] && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part before html part - { - $content.= 'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary('alternative').'"' . "\r\n"; + $content .= "Content-Type: text/plain; charset=".$this->getCharSet()."\r\n"; + $content .= "\r\n".($_content['dataText'] ? $_content['dataText'] : strip_tags($_content['data']))."\r\n"; // Add plain text message + $content .= "--".$this->_getBoundary('alternative')."\r\n"; + $content .= 'Content-Type: multipart/related; boundary="'.$this->_getBoundary('related').'"'."\r\n"; $content .= "\r\n"; - $content .= "--" . $this->_getBoundary('alternative') . "\r\n"; - - $content.= "Content-Type: text/plain; charset=" . $this->getCharSet() . "\r\n"; - $content.= "\r\n". $_content['dataText'] . "\r\n"; - $content.= "--" . $this->_getBoundary('alternative') . "\r\n"; + $content .= "--".$this->_getBoundary('related')."\r\n"; } - $content .= 'Content-Type: ' . $_content['mimeType'] . '; ' + if (!key_exists('image', $this->_msgContent) && $_content['dataText'] && !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part before html part + { + $content .= 'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary('alternative').'"'."\r\n"; + $content .= "\r\n"; + $content .= "--".$this->_getBoundary('alternative')."\r\n"; + + $content .= "Content-Type: text/plain; charset=".$this->getCharSet()."\r\n"; + $content .= "\r\n".$_content['dataText']."\r\n"; + $content .= "--".$this->_getBoundary('alternative')."\r\n"; + } + + $content .= 'Content-Type: '.$_content['mimeType'].'; ' // . 'charset="' . $this->getCharSet() . '"'; - . 'charset=' . $this->getCharSet() . ''; + . 'charset='.$this->getCharSet().''; // $content .= ( $type == 'html') ? '; name="HTML Part"' : ''; - $content .= "\r\n"; + $content .= "\r\n"; // $content .= 'Content-Transfer-Encoding: '; // $content .= ($type == 'html') ? 'quoted-printable' : $this->getTransEncodeType(); // $content .= "\r\n" // . 'Content-Disposition: inline' . "\r\n" // . 'Content-Description: ' . $type . ' message' . "\r\n"; - if ( $this->getMD5flag() ) - $content .= 'Content-MD5: ' . $_content['md5'] . "\r\n"; + if ($this->getMD5flag()) + $content .= 'Content-MD5: '.$_content['md5']."\r\n"; - $content .= "\r\n" . $_content['data'] . "\r\n"; + $content .= "\r\n".$_content['data']."\r\n"; - if (! key_exists('image', $this->_msgContent) && $_content['dataText'] && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part after html part + if (!key_exists('image', $this->_msgContent) && $_content['dataText'] && !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part after html part { - $content.= "--" . $this->_getBoundary('alternative') . "--". "\r\n"; + $content .= "--".$this->_getBoundary('alternative')."--"."\r\n"; } $content .= "\r\n"; @@ -1564,7 +1564,7 @@ class SMTPs // Close message boundries // $content .= "\r\n--" . $this->_getBoundary() . '--' . "\r\n" ; - $content .= "--" . $this->_getBoundary('mixed') . '--' . "\r\n" ; + $content .= "--".$this->_getBoundary('mixed').'--'."\r\n"; } return $content; @@ -1581,15 +1581,15 @@ class SMTPs */ public function setAttachment($strContent, $strFileName = 'unknown', $strMimeType = 'unknown') { - if ( $strContent ) + if ($strContent) { - $strContent = rtrim(chunk_split(base64_encode($strContent), 76, "\r\n")); // 76 max is defined into http://tools.ietf.org/html/rfc2047 + $strContent = rtrim(chunk_split(base64_encode($strContent), 76, "\r\n")); // 76 max is defined into http://tools.ietf.org/html/rfc2047 $this->_msgContent['attachment'][$strFileName]['mimeType'] = $strMimeType; $this->_msgContent['attachment'][$strFileName]['fileName'] = $strFileName; $this->_msgContent['attachment'][$strFileName]['data'] = $strContent; - if ( $this->getMD5flag() ) + if ($this->getMD5flag()) $this->_msgContent['attachment'][$strFileName]['md5'] = dol_hash($strContent, 3); } } @@ -1616,7 +1616,7 @@ class SMTPs $this->_msgContent['image'][$strImageName]['cid'] = $strImageCid; $this->_msgContent['image'][$strImageName]['data'] = $strContent; - if ( $this->getMD5flag() ) + if ($this->getMD5flag()) $this->_msgContent['image'][$strImageName]['md5'] = dol_hash($strContent, 3); } } @@ -1636,8 +1636,8 @@ class SMTPs */ public function setSensitivity($_value = 0) { - if ( ( is_numeric($_value) ) && - ( ( $_value >= 0 ) && ( $_value <= 3 ) ) ) + if ((is_numeric($_value)) && + (($_value >= 0) && ($_value <= 3))) $this->_msgSensitivity = $_value; } @@ -1671,8 +1671,8 @@ class SMTPs */ public function setPriority($_value = 3) { - if ( ( is_numeric($_value) ) && - ( ( $_value >= 0 ) && ( $_value <= 5 ) ) ) + if ((is_numeric($_value)) && + (($_value >= 0) && ($_value <= 5))) $this->_msgPriority = $_value; } @@ -1690,9 +1690,9 @@ class SMTPs */ public function getPriority() { - return 'Importance: ' . $this->_aryPriority[$this->_msgPriority] . "\r\n" - . 'Priority: ' . $this->_aryPriority[$this->_msgPriority] . "\r\n" - . 'X-Priority: ' . $this->_msgPriority . ' (' . $this->_aryPriority[$this->_msgPriority] . ')' . "\r\n"; + return 'Importance: '.$this->_aryPriority[$this->_msgPriority]."\r\n" + . 'Priority: '.$this->_aryPriority[$this->_msgPriority]."\r\n" + . 'X-Priority: '.$this->_msgPriority.' ('.$this->_aryPriority[$this->_msgPriority].')'."\r\n"; } /** @@ -1726,7 +1726,7 @@ class SMTPs */ public function setXheader($strXdata) { - if ( $strXdata ) + if ($strXdata) $this->_msgXheader[] = $strXdata; } @@ -1747,7 +1747,7 @@ class SMTPs */ private function _setBoundary() { - $this->_smtpsBoundary = "multipart_x." . time() . ".x_boundary"; + $this->_smtpsBoundary = "multipart_x.".time().".x_boundary"; $this->_smtpsRelatedBoundary = 'mul_'.dol_hash(uniqid("dolibarr2"), 3); $this->_smtpsAlternativeBoundary = 'mul_'.dol_hash(uniqid("dolibarr3"), 3); } @@ -1786,11 +1786,11 @@ class SMTPs $server_response = ''; // avoid infinite loop - $limit=0; + $limit = 0; - while (substr($server_response, 3, 1) != ' ' && $limit<100) + while (substr($server_response, 3, 1) != ' ' && $limit < 100) { - if (! ($server_response = fgets($socket, 256))) + if (!($server_response = fgets($socket, 256))) { $this->_setErr(121, "Couldn't get mail server response codes"); $_retVal = false; @@ -1800,7 +1800,7 @@ class SMTPs $limit++; } - if (! (substr($server_response, 0, 3) == $response)) + if (!(substr($server_response, 0, 3) == $response)) { $this->_setErr(120, "Ran into problems sending Mail.\r\nResponse: $server_response"); $_retVal = false; @@ -1821,11 +1821,11 @@ class SMTPs public function socket_send_str($_strSend, $_returnCode = null, $CRLF = "\r\n") { // phpcs:enable - if ($this->_debug) $this->log.=$_strSend; // @CHANGE LDR for log - fputs($this->socket, $_strSend . $CRLF); - if ($this->_debug) $this->log.=' ('.$_returnCode.')' . $CRLF; + if ($this->_debug) $this->log .= $_strSend; // @CHANGE LDR for log + fputs($this->socket, $_strSend.$CRLF); + if ($this->_debug) $this->log .= ' ('.$_returnCode.')'.$CRLF; - if ( $_returnCode ) + if ($_returnCode) return $this->server_parse($this->socket, $_returnCode); } @@ -1860,7 +1860,7 @@ class SMTPs { foreach ($this->_smtpsErrors as $_err => $_info) { - $_errMsg[] = 'Error [' . $_info['num'] .']: '. $_info['msg']; + $_errMsg[] = 'Error ['.$_info['num'].']: '.$_info['msg']; } } diff --git a/htdocs/core/extrafieldsinexport.inc.php b/htdocs/core/extrafieldsinexport.inc.php index e9d10138d1e..4f85610e657 100644 --- a/htdocs/core/extrafieldsinexport.inc.php +++ b/htdocs/core/extrafieldsinexport.inc.php @@ -8,67 +8,67 @@ if (empty($keyforselect) || empty($keyforelement) || empty($keyforaliasextra)) } // Add extra fields -$sql="SELECT name, label, type, param, fieldcomputed, fielddefault FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = '".$keyforselect."' AND type != 'separate' AND entity IN (0, ".$conf->entity.') ORDER BY pos ASC'; +$sql = "SELECT name, label, type, param, fieldcomputed, fielddefault FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = '".$keyforselect."' AND type != 'separate' AND entity IN (0, ".$conf->entity.') ORDER BY pos ASC'; //print $sql; -$resql=$this->db->query($sql); +$resql = $this->db->query($sql); if ($resql) // This can fail when class is used on old database (during migration for example) { - while ($obj=$this->db->fetch_object($resql)) + while ($obj = $this->db->fetch_object($resql)) { - $fieldname=$keyforaliasextra.'.'.$obj->name; - $fieldlabel=ucfirst($obj->label); - $typeFilter="Text"; - $typefield=preg_replace('/\(.*$/', '', $obj->type); // double(24,8) -> double + $fieldname = $keyforaliasextra.'.'.$obj->name; + $fieldlabel = ucfirst($obj->label); + $typeFilter = "Text"; + $typefield = preg_replace('/\(.*$/', '', $obj->type); // double(24,8) -> double switch ($typefield) { case 'int': case 'integer': case 'double': case 'price': - $typeFilter="Numeric"; + $typeFilter = "Numeric"; break; case 'date': case 'datetime': case 'timestamp': - $typeFilter="Date"; + $typeFilter = "Date"; break; case 'boolean': - $typeFilter="Boolean"; + $typeFilter = "Boolean"; break; case 'select': - if (! empty($conf->global->EXPORT_LABEL_FOR_SELECT)) + if (!empty($conf->global->EXPORT_LABEL_FOR_SELECT)) { - $tmpparam=unserialize($obj->param); // $tmpparam may be array with 'options' = array(key1=>val1, key2=>val2 ...) + $tmpparam = unserialize($obj->param); // $tmpparam may be array with 'options' = array(key1=>val1, key2=>val2 ...) if ($tmpparam['options'] && is_array($tmpparam['options'])) { - $typeFilter="Select:".$obj->param; + $typeFilter = "Select:".$obj->param; } } break; case 'sellist': - $tmp=''; - $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null + $tmp = ''; + $tmpparam = unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null if ($tmpparam['options'] && is_array($tmpparam['options'])) { - $tmpkeys=array_keys($tmpparam['options']); - $tmp=array_shift($tmpkeys); + $tmpkeys = array_keys($tmpparam['options']); + $tmp = array_shift($tmpkeys); } - if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp; + if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter = "List:".$tmp; break; } - if ($obj->type!='separate') + if ($obj->type != 'separate') { // If not a computed field if (empty($obj->fieldcomputed)) { - $this->export_fields_array[$r][$fieldname]=$fieldlabel; - $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; - $this->export_entities_array[$r][$fieldname]=$keyforelement; + $this->export_fields_array[$r][$fieldname] = $fieldlabel; + $this->export_TypeFields_array[$r][$fieldname] = $typeFilter; + $this->export_entities_array[$r][$fieldname] = $keyforelement; } // If this is a computed field else { - $this->export_fields_array[$r][$fieldname]=$fieldlabel; - $this->export_TypeFields_array[$r][$fieldname]=$typeFilter.'Compute'; - $this->export_special_array[$r][$fieldname]=$obj->fieldcomputed; - $this->export_entities_array[$r][$fieldname]=$keyforelement; + $this->export_fields_array[$r][$fieldname] = $fieldlabel; + $this->export_TypeFields_array[$r][$fieldname] = $typeFilter.'Compute'; + $this->export_special_array[$r][$fieldname] = $obj->fieldcomputed; + $this->export_entities_array[$r][$fieldname] = $keyforelement; } } } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 0051d28caf3..4568ab2774d 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -195,7 +195,7 @@ function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excl closedir($dir); // Obtain a list of columns - if (! empty($sortcriteria) && $sortorder) + if (!empty($sortcriteria) && $sortorder) { $file_list = dol_sort_array($file_list, $sortcriteria, ($sortorder == SORT_ASC ? 'asc' : 'desc')); } @@ -1435,21 +1435,21 @@ function dol_meta_create($object) if (is_dir($dir)) { $nblines = count($object->lines); - $client = $object->thirdparty->name . " " . $object->thirdparty->address . " " . $object->thirdparty->zip . " " . $object->thirdparty->town; - $meta = "REFERENCE=\"" . $object->ref . "\" - DATE=\"" . dol_print_date($object->date, '') . "\" - NB_ITEMS=\"" . $nblines . "\" - CLIENT=\"" . $client . "\" - AMOUNT_EXCL_TAX=\"" . $object->total_ht . "\" - AMOUNT=\"" . $object->total_ttc . "\"\n"; + $client = $object->thirdparty->name." ".$object->thirdparty->address." ".$object->thirdparty->zip." ".$object->thirdparty->town; + $meta = "REFERENCE=\"".$object->ref."\" + DATE=\"" . dol_print_date($object->date, '')."\" + NB_ITEMS=\"" . $nblines."\" + CLIENT=\"" . $client."\" + AMOUNT_EXCL_TAX=\"" . $object->total_ht."\" + AMOUNT=\"" . $object->total_ttc."\"\n"; - for ($i = 0 ; $i < $nblines ; $i++) + for ($i = 0; $i < $nblines; $i++) { //Pour les articles - $meta .= "ITEM_" . $i . "_QUANTITY=\"" . $object->lines[$i]->qty . "\" - ITEM_" . $i . "_AMOUNT_WO_TAX=\"" . $object->lines[$i]->total_ht . "\" - ITEM_" . $i . "_VAT=\"" .$object->lines[$i]->tva_tx . "\" - ITEM_" . $i . "_DESCRIPTION=\"" . str_replace("\r\n", "", nl2br($object->lines[$i]->desc)) . "\" + $meta .= "ITEM_".$i."_QUANTITY=\"".$object->lines[$i]->qty."\" + ITEM_" . $i."_AMOUNT_WO_TAX=\"".$object->lines[$i]->total_ht."\" + ITEM_" . $i."_VAT=\"".$object->lines[$i]->tva_tx."\" + ITEM_" . $i."_DESCRIPTION=\"".str_replace("\r\n", "", nl2br($object->lines[$i]->desc))."\" "; } } @@ -1543,21 +1543,21 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess for ($i = 0; $i < $nbfile; $i++) { // Define $destfull (path to file including filename) and $destfile (only filename) - $destfull=$upload_dir . "/" . $TFile['name'][$i]; - $destfile=$TFile['name'][$i]; + $destfull = $upload_dir."/".$TFile['name'][$i]; + $destfile = $TFile['name'][$i]; if ($savingdocmask) { - $destfull=$upload_dir . "/" . preg_replace('/__file__/', $TFile['name'][$i], $savingdocmask); - $destfile=preg_replace('/__file__/', $TFile['name'][$i], $savingdocmask); + $destfull = $upload_dir."/".preg_replace('/__file__/', $TFile['name'][$i], $savingdocmask); + $destfile = preg_replace('/__file__/', $TFile['name'][$i], $savingdocmask); } // dol_sanitizeFileName the file name and lowercase extension $info = pathinfo($destfull); - $destfull = $info['dirname'].'/'.dol_sanitizeFileName($info['filename'].($info['extension']!='' ? ('.'.strtolower($info['extension'])) : '')); + $destfull = $info['dirname'].'/'.dol_sanitizeFileName($info['filename'].($info['extension'] != '' ? ('.'.strtolower($info['extension'])) : '')); $info = pathinfo($destfile); - $destfile = dol_sanitizeFileName($info['filename'].($info['extension']!='' ? ('.'.strtolower($info['extension'])) : '')); + $destfile = dol_sanitizeFileName($info['filename'].($info['extension'] != '' ? ('.'.strtolower($info['extension'])) : '')); // We apply dol_string_nohtmltag also to clean file names (this remove duplicate spaces) because // this function is also applied when we make try to download file (by the GETPOST(filename, 'alphanohtml') call). @@ -1845,15 +1845,15 @@ function dol_convert_file($fileinput, $ext = 'png', $fileoutput = '', $page = '' $ret = $image->setImageFormat($ext); if ($ret) { - if (empty($fileoutput)) $fileoutput=$fileinput.".".$ext; + if (empty($fileoutput)) $fileoutput = $fileinput.".".$ext; $count = $image->getNumberImages(); - if (! dol_is_file($fileoutput) || is_writeable($fileoutput)) + if (!dol_is_file($fileoutput) || is_writeable($fileoutput)) { try { $ret = $image->writeImages($fileoutput, true); } - catch(Exception $e) + catch (Exception $e) { dol_syslog($e->getMessage(), LOG_WARNING); } @@ -1896,20 +1896,20 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring { global $conf; - $foundhandler=0; + $foundhandler = 0; try { dol_syslog("dol_compress_file mode=".$mode." inputfile=".$inputfile." outputfile=".$outputfile); $data = implode("", file(dol_osencode($inputfile))); - if ($mode == 'gz') { $foundhandler=1; $compressdata = gzencode($data, 9); } - elseif ($mode == 'bz') { $foundhandler=1; $compressdata = bzcompress($data, 9); } + if ($mode == 'gz') { $foundhandler = 1; $compressdata = gzencode($data, 9); } + elseif ($mode == 'bz') { $foundhandler = 1; $compressdata = bzcompress($data, 9); } elseif ($mode == 'zip') { - if (class_exists('ZipArchive') && ! empty($conf->global->MAIN_USE_ZIPARCHIVE_FOR_ZIP_COMPRESS)) + if (class_exists('ZipArchive') && !empty($conf->global->MAIN_USE_ZIPARCHIVE_FOR_ZIP_COMPRESS)) { - $foundhandler=1; + $foundhandler = 1; $rootPath = realpath($inputfile); @@ -1917,7 +1917,7 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring $zip = new ZipArchive; if ($zip->open($outputfile, ZipArchive::CREATE) !== true) { - $errorstring="dol_compress_file failure - Failed to open file ".$outputfile."\n"; + $errorstring = "dol_compress_file failure - Failed to open file ".$outputfile."\n"; dol_syslog($errorstring, LOG_ERR); global $errormsg; @@ -1956,7 +1956,7 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring if (defined('ODTPHP_PATHTOPCLZIP')) { - $foundhandler=1; + $foundhandler = 1; include_once ODTPHP_PATHTOPCLZIP.'/pclzip.lib.php'; $archive = new PclZip($outputfile); @@ -1965,7 +1965,7 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring if ($result === 0) { global $errormsg; - $errormsg=$archive->errorInfo(true); + $errormsg = $archive->errorInfo(true); if ($archive->errorCode() == PCLZIP_ERR_WRITE_OPEN_FAIL) { @@ -2007,7 +2007,7 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring { global $langs, $errormsg; $langs->load("errors"); - $errormsg=$langs->trans("ErrorFailedToWriteInDir"); + $errormsg = $langs->trans("ErrorFailedToWriteInDir"); $errorstring = "Failed to open file ".$outputfile; dol_syslog($errorstring, LOG_ERR); @@ -2087,22 +2087,22 @@ function dol_uncompress($inputfile, $outputdir) */ function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles = '', $rootdirinzip = '') { - $foundhandler=0; + $foundhandler = 0; dol_syslog("Try to zip dir ".$inputdir." into ".$outputfile." mode=".$mode); - if (! dol_is_dir(dirname($outputfile)) || ! is_writable(dirname($outputfile))) + if (!dol_is_dir(dirname($outputfile)) || !is_writable(dirname($outputfile))) { global $langs, $errormsg; $langs->load("errors"); - $errormsg=$langs->trans("ErrorFailedToWriteInDir", $outputfile); + $errormsg = $langs->trans("ErrorFailedToWriteInDir", $outputfile); return -3; } try { - if ($mode == 'gz') { $foundhandler=0; } - elseif ($mode == 'bz') { $foundhandler=0; } + if ($mode == 'gz') { $foundhandler = 0; } + elseif ($mode == 'bz') { $foundhandler = 0; } elseif ($mode == 'zip') { /*if (defined('ODTPHP_PATHTOPCLZIP')) @@ -2124,11 +2124,11 @@ function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles = // Initialize archive object $zip = new ZipArchive(); $result = $zip->open($outputfile, ZipArchive::CREATE | ZipArchive::OVERWRITE); - if (! $result) + if (!$result) { global $langs, $errormsg; $langs->load("errors"); - $errormsg=$langs->trans("ErrorFailedToWriteInFile", $outputfile); + $errormsg = $langs->trans("ErrorFailedToWriteInFile", $outputfile); return -4; } @@ -2148,7 +2148,7 @@ function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles = $filePath = $file->getRealPath(); $relativePath = ($rootdirinzip ? $rootdirinzip.'/' : '').substr($filePath, strlen($inputdir) + 1); - if (empty($excludefiles) || ! preg_match($excludefiles, $filePath)) + if (empty($excludefiles) || !preg_match($excludefiles, $filePath)) { // Add current file to archive $zip->addFile($filePath, $relativePath); @@ -2219,267 +2219,267 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, global $conf, $db, $user; global $dolibarr_main_data_root, $dolibarr_main_document_root_alt; - if (! is_object($fuser)) $fuser=$user; + if (!is_object($fuser)) $fuser = $user; if (empty($modulepart)) return 'ErrorBadParameter'; if (empty($entity)) { - if (empty($conf->multicompany->enabled)) $entity=1; - else $entity=0; + if (empty($conf->multicompany->enabled)) $entity = 1; + else $entity = 0; } // Fix modulepart - if ($modulepart == 'users') $modulepart='user'; + if ($modulepart == 'users') $modulepart = 'user'; dol_syslog('modulepart='.$modulepart.' original_file='.$original_file.' entity='.$entity); // We define $accessallowed and $sqlprotectagainstexternals - $accessallowed=0; - $sqlprotectagainstexternals=''; - $ret=array(); + $accessallowed = 0; + $sqlprotectagainstexternals = ''; + $ret = array(); // Find the subdirectory name as the reference. For exemple original_file='10/myfile.pdf' -> refname='10' - if (empty($refname)) $refname=basename(dirname($original_file)."/"); + if (empty($refname)) $refname = basename(dirname($original_file)."/"); // Define possible keys to use for permission check - $lire='lire'; $read='read'; $download='download'; + $lire = 'lire'; $read = 'read'; $download = 'download'; if ($mode == 'write') { - $lire='creer'; $read='write'; $download='upload'; + $lire = 'creer'; $read = 'write'; $download = 'upload'; } // Wrapping for miscellaneous medias files if ($modulepart == 'medias' && !empty($dolibarr_main_data_root)) { if (empty($entity) || empty($conf->medias->multidir_output[$entity])) return array('accessallowed'=>0, 'error'=>'Value entity must be provided'); - $accessallowed=1; - $original_file=$conf->medias->multidir_output[$entity].'/'.$original_file; + $accessallowed = 1; + $original_file = $conf->medias->multidir_output[$entity].'/'.$original_file; } // Wrapping for *.log files, like when used with url http://.../document.php?modulepart=logs&file=dolibarr.log elseif ($modulepart == 'logs' && !empty($dolibarr_main_data_root)) { - $accessallowed=($user->admin && basename($original_file) == $original_file && preg_match('/^dolibarr.*\.log$/', basename($original_file))); - $original_file=$dolibarr_main_data_root.'/'.$original_file; + $accessallowed = ($user->admin && basename($original_file) == $original_file && preg_match('/^dolibarr.*\.log$/', basename($original_file))); + $original_file = $dolibarr_main_data_root.'/'.$original_file; } // Wrapping for *.log files, like when used with url http://.../document.php?modulepart=logs&file=dolibarr.log elseif ($modulepart == 'doctemplateswebsite' && !empty($dolibarr_main_data_root)) { - $accessallowed=($fuser->rights->website->write && preg_match('/\.jpg$/i', basename($original_file))); - $original_file=$dolibarr_main_data_root.'/doctemplates/websites/'.$original_file; + $accessallowed = ($fuser->rights->website->write && preg_match('/\.jpg$/i', basename($original_file))); + $original_file = $dolibarr_main_data_root.'/doctemplates/websites/'.$original_file; } // Wrapping for *.zip files, like when used with url http://.../document.php?modulepart=packages&file=module_myfile.zip elseif ($modulepart == 'packages' && !empty($dolibarr_main_data_root)) { // Dir for custom dirs - $tmp=explode(',', $dolibarr_main_document_root_alt); + $tmp = explode(',', $dolibarr_main_document_root_alt); $dirins = $tmp[0]; - $accessallowed=($user->admin && preg_match('/^module_.*\.zip$/', basename($original_file))); - $original_file=$dirins.'/'.$original_file; + $accessallowed = ($user->admin && preg_match('/^module_.*\.zip$/', basename($original_file))); + $original_file = $dirins.'/'.$original_file; } // Wrapping for some images elseif ($modulepart == 'mycompany' && !empty($conf->mycompany->dir_output)) { - $accessallowed=1; - $original_file=$conf->mycompany->dir_output.'/'.$original_file; + $accessallowed = 1; + $original_file = $conf->mycompany->dir_output.'/'.$original_file; } // Wrapping for users photos elseif ($modulepart == 'userphoto' && !empty($conf->user->dir_output)) { - $accessallowed=1; - $original_file=$conf->user->dir_output.'/'.$original_file; + $accessallowed = 1; + $original_file = $conf->user->dir_output.'/'.$original_file; } // Wrapping for members photos elseif ($modulepart == 'memberphoto' && !empty($conf->adherent->dir_output)) { - $accessallowed=1; - $original_file=$conf->adherent->dir_output.'/'.$original_file; + $accessallowed = 1; + $original_file = $conf->adherent->dir_output.'/'.$original_file; } // Wrapping pour les apercu factures elseif ($modulepart == 'apercufacture' && !empty($conf->facture->multidir_output[$entity])) { - if ($fuser->rights->facture->{$lire}) $accessallowed=1; - $original_file=$conf->facture->multidir_output[$entity].'/'.$original_file; + if ($fuser->rights->facture->{$lire}) $accessallowed = 1; + $original_file = $conf->facture->multidir_output[$entity].'/'.$original_file; } // Wrapping pour les apercu propal elseif ($modulepart == 'apercupropal' && !empty($conf->propal->multidir_output[$entity])) { - if ($fuser->rights->propale->{$lire}) $accessallowed=1; - $original_file=$conf->propal->multidir_output[$entity].'/'.$original_file; + if ($fuser->rights->propale->{$lire}) $accessallowed = 1; + $original_file = $conf->propal->multidir_output[$entity].'/'.$original_file; } // Wrapping pour les apercu commande elseif ($modulepart == 'apercucommande' && !empty($conf->commande->multidir_output[$entity])) { - if ($fuser->rights->commande->{$lire}) $accessallowed=1; - $original_file=$conf->commande->multidir_output[$entity].'/'.$original_file; + if ($fuser->rights->commande->{$lire}) $accessallowed = 1; + $original_file = $conf->commande->multidir_output[$entity].'/'.$original_file; } // Wrapping pour les apercu intervention elseif (($modulepart == 'apercufichinter' || $modulepart == 'apercuficheinter') && !empty($conf->ficheinter->dir_output)) { - if ($fuser->rights->ficheinter->{$lire}) $accessallowed=1; - $original_file=$conf->ficheinter->dir_output.'/'.$original_file; + if ($fuser->rights->ficheinter->{$lire}) $accessallowed = 1; + $original_file = $conf->ficheinter->dir_output.'/'.$original_file; } // Wrapping pour les apercu conat elseif (($modulepart == 'apercucontract') && !empty($conf->contrat->dir_output)) { - if ($fuser->rights->contrat->{$lire}) $accessallowed=1; - $original_file=$conf->contrat->dir_output.'/'.$original_file; + if ($fuser->rights->contrat->{$lire}) $accessallowed = 1; + $original_file = $conf->contrat->dir_output.'/'.$original_file; } // Wrapping pour les apercu supplier proposal elseif (($modulepart == 'apercusupplier_proposal' || $modulepart == 'apercusupplier_proposal') && !empty($conf->supplier_proposal->dir_output)) { - if ($fuser->rights->supplier_proposal->{$lire}) $accessallowed=1; - $original_file=$conf->supplier_proposal->dir_output.'/'.$original_file; + if ($fuser->rights->supplier_proposal->{$lire}) $accessallowed = 1; + $original_file = $conf->supplier_proposal->dir_output.'/'.$original_file; } // Wrapping pour les apercu supplier order elseif (($modulepart == 'apercusupplier_order' || $modulepart == 'apercusupplier_order') && !empty($conf->fournisseur->commande->dir_output)) { - if ($fuser->rights->fournisseur->commande->{$lire}) $accessallowed=1; - $original_file=$conf->fournisseur->commande->dir_output.'/'.$original_file; + if ($fuser->rights->fournisseur->commande->{$lire}) $accessallowed = 1; + $original_file = $conf->fournisseur->commande->dir_output.'/'.$original_file; } // Wrapping pour les apercu supplier invoice elseif (($modulepart == 'apercusupplier_invoice' || $modulepart == 'apercusupplier_invoice') && !empty($conf->fournisseur->facture->dir_output)) { - if ($fuser->rights->fournisseur->facture->{$lire}) $accessallowed=1; - $original_file=$conf->fournisseur->facture->dir_output.'/'.$original_file; + if ($fuser->rights->fournisseur->facture->{$lire}) $accessallowed = 1; + $original_file = $conf->fournisseur->facture->dir_output.'/'.$original_file; } // Wrapping pour les apercu supplier invoice elseif (($modulepart == 'apercuexpensereport') && !empty($conf->expensereport->dir_output)) { - if ($fuser->rights->expensereport->{$lire}) $accessallowed=1; - $original_file=$conf->expensereport->dir_output.'/'.$original_file; + if ($fuser->rights->expensereport->{$lire}) $accessallowed = 1; + $original_file = $conf->expensereport->dir_output.'/'.$original_file; } // Wrapping pour les images des stats propales elseif ($modulepart == 'propalstats' && !empty($conf->propal->multidir_temp[$entity])) { - if ($fuser->rights->propale->{$lire}) $accessallowed=1; - $original_file=$conf->propal->multidir_temp[$entity].'/'.$original_file; + if ($fuser->rights->propale->{$lire}) $accessallowed = 1; + $original_file = $conf->propal->multidir_temp[$entity].'/'.$original_file; } // Wrapping pour les images des stats commandes elseif ($modulepart == 'orderstats' && !empty($conf->commande->dir_temp)) { - if ($fuser->rights->commande->{$lire}) $accessallowed=1; - $original_file=$conf->commande->dir_temp.'/'.$original_file; + if ($fuser->rights->commande->{$lire}) $accessallowed = 1; + $original_file = $conf->commande->dir_temp.'/'.$original_file; } elseif ($modulepart == 'orderstatssupplier' && !empty($conf->fournisseur->dir_output)) { - if ($fuser->rights->fournisseur->commande->{$lire}) $accessallowed=1; - $original_file=$conf->fournisseur->commande->dir_temp.'/'.$original_file; + if ($fuser->rights->fournisseur->commande->{$lire}) $accessallowed = 1; + $original_file = $conf->fournisseur->commande->dir_temp.'/'.$original_file; } // Wrapping pour les images des stats factures elseif ($modulepart == 'billstats' && !empty($conf->facture->dir_temp)) { - if ($fuser->rights->facture->{$lire}) $accessallowed=1; - $original_file=$conf->facture->dir_temp.'/'.$original_file; + if ($fuser->rights->facture->{$lire}) $accessallowed = 1; + $original_file = $conf->facture->dir_temp.'/'.$original_file; } elseif ($modulepart == 'billstatssupplier' && !empty($conf->fournisseur->dir_output)) { - if ($fuser->rights->fournisseur->facture->{$lire}) $accessallowed=1; - $original_file=$conf->fournisseur->facture->dir_temp.'/'.$original_file; + if ($fuser->rights->fournisseur->facture->{$lire}) $accessallowed = 1; + $original_file = $conf->fournisseur->facture->dir_temp.'/'.$original_file; } // Wrapping pour les images des stats expeditions elseif ($modulepart == 'expeditionstats' && !empty($conf->expedition->dir_temp)) { - if ($fuser->rights->expedition->{$lire}) $accessallowed=1; - $original_file=$conf->expedition->dir_temp.'/'.$original_file; + if ($fuser->rights->expedition->{$lire}) $accessallowed = 1; + $original_file = $conf->expedition->dir_temp.'/'.$original_file; } // Wrapping pour les images des stats expeditions elseif ($modulepart == 'tripsexpensesstats' && !empty($conf->deplacement->dir_temp)) { - if ($fuser->rights->deplacement->{$lire}) $accessallowed=1; - $original_file=$conf->deplacement->dir_temp.'/'.$original_file; + if ($fuser->rights->deplacement->{$lire}) $accessallowed = 1; + $original_file = $conf->deplacement->dir_temp.'/'.$original_file; } // Wrapping pour les images des stats expeditions elseif ($modulepart == 'memberstats' && !empty($conf->adherent->dir_temp)) { - if ($fuser->rights->adherent->{$lire}) $accessallowed=1; - $original_file=$conf->adherent->dir_temp.'/'.$original_file; + if ($fuser->rights->adherent->{$lire}) $accessallowed = 1; + $original_file = $conf->adherent->dir_temp.'/'.$original_file; } // Wrapping pour les images des stats produits elseif (preg_match('/^productstats_/i', $modulepart) && !empty($conf->product->dir_temp)) { - if ($fuser->rights->produit->{$lire} || $fuser->rights->service->{$lire}) $accessallowed=1; - $original_file=(!empty($conf->product->multidir_temp[$entity])?$conf->product->multidir_temp[$entity]:$conf->service->multidir_temp[$entity]).'/'.$original_file; + if ($fuser->rights->produit->{$lire} || $fuser->rights->service->{$lire}) $accessallowed = 1; + $original_file = (!empty($conf->product->multidir_temp[$entity]) ? $conf->product->multidir_temp[$entity] : $conf->service->multidir_temp[$entity]).'/'.$original_file; } // Wrapping for taxes elseif ($modulepart == 'tax' && !empty($conf->tax->dir_output)) { - if ($fuser->rights->tax->charges->{$lire}) $accessallowed=1; - $original_file=$conf->tax->dir_output.'/'.$original_file; + if ($fuser->rights->tax->charges->{$lire}) $accessallowed = 1; + $original_file = $conf->tax->dir_output.'/'.$original_file; } // Wrapping for events elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output)) { - if ($fuser->rights->agenda->myactions->{$read}) $accessallowed=1; - $original_file=$conf->agenda->dir_output.'/'.$original_file; + if ($fuser->rights->agenda->myactions->{$read}) $accessallowed = 1; + $original_file = $conf->agenda->dir_output.'/'.$original_file; } // Wrapping for categories elseif ($modulepart == 'category' && !empty($conf->categorie->dir_output)) { if (empty($entity) || empty($conf->categorie->multidir_output[$entity])) return array('accessallowed'=>0, 'error'=>'Value entity must be provided'); - if ($fuser->rights->categorie->{$lire}) $accessallowed=1; - $original_file=$conf->categorie->multidir_output[$entity].'/'.$original_file; + if ($fuser->rights->categorie->{$lire}) $accessallowed = 1; + $original_file = $conf->categorie->multidir_output[$entity].'/'.$original_file; } // Wrapping pour les prelevements elseif ($modulepart == 'prelevement' && !empty($conf->prelevement->dir_output)) { - if ($fuser->rights->prelevement->bons->{$lire} || preg_match('/^specimen/i', $original_file)) $accessallowed=1; - $original_file=$conf->prelevement->dir_output.'/'.$original_file; + if ($fuser->rights->prelevement->bons->{$lire} || preg_match('/^specimen/i', $original_file)) $accessallowed = 1; + $original_file = $conf->prelevement->dir_output.'/'.$original_file; } // Wrapping pour les graph energie elseif ($modulepart == 'graph_stock' && !empty($conf->stock->dir_temp)) { - $accessallowed=1; - $original_file=$conf->stock->dir_temp.'/'.$original_file; + $accessallowed = 1; + $original_file = $conf->stock->dir_temp.'/'.$original_file; } // Wrapping pour les graph fournisseurs elseif ($modulepart == 'graph_fourn' && !empty($conf->fournisseur->dir_temp)) { - $accessallowed=1; - $original_file=$conf->fournisseur->dir_temp.'/'.$original_file; + $accessallowed = 1; + $original_file = $conf->fournisseur->dir_temp.'/'.$original_file; } // Wrapping pour les graph des produits elseif ($modulepart == 'graph_product' && !empty($conf->product->dir_temp)) { - $accessallowed=1; - $original_file=$conf->product->multidir_temp[$entity].'/'.$original_file; + $accessallowed = 1; + $original_file = $conf->product->multidir_temp[$entity].'/'.$original_file; } // Wrapping pour les code barre elseif ($modulepart == 'barcode') { - $accessallowed=1; + $accessallowed = 1; // If viewimage is called for barcode, we try to output an image on the fly, with no build of file on disk. //$original_file=$conf->barcode->dir_temp.'/'.$original_file; - $original_file=''; + $original_file = ''; } // Wrapping pour les icones de background des mailings elseif ($modulepart == 'iconmailing' && !empty($conf->mailing->dir_temp)) { - $accessallowed=1; - $original_file=$conf->mailing->dir_temp.'/'.$original_file; + $accessallowed = 1; + $original_file = $conf->mailing->dir_temp.'/'.$original_file; } // Wrapping pour le scanner elseif ($modulepart == 'scanner_user_temp' && !empty($conf->scanner->dir_temp)) { - $accessallowed=1; - $original_file=$conf->scanner->dir_temp.'/'.$fuser->id.'/'.$original_file; + $accessallowed = 1; + $original_file = $conf->scanner->dir_temp.'/'.$fuser->id.'/'.$original_file; } // Wrapping pour les images fckeditor elseif ($modulepart == 'fckeditor' && !empty($conf->fckeditor->dir_output)) { - $accessallowed=1; - $original_file=$conf->fckeditor->dir_output.'/'.$original_file; + $accessallowed = 1; + $original_file = $conf->fckeditor->dir_output.'/'.$original_file; } // Wrapping for users elseif ($modulepart == 'user' && !empty($conf->user->dir_output)) { - $canreaduser=(! empty($fuser->admin) || $fuser->rights->user->user->{$lire}); - if ($fuser->id == (int) $refname) { $canreaduser=1; } // A user can always read its own card + $canreaduser = (!empty($fuser->admin) || $fuser->rights->user->user->{$lire}); + if ($fuser->id == (int) $refname) { $canreaduser = 1; } // A user can always read its own card if ($canreaduser || preg_match('/^specimen/i', $original_file)) { - $accessallowed=1; + $accessallowed = 1; } - $original_file=$conf->user->dir_output.'/'.$original_file; + $original_file = $conf->user->dir_output.'/'.$original_file; } // Wrapping for third parties @@ -2510,9 +2510,9 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, { if ($fuser->rights->facture->{$lire} || preg_match('/^specimen/i', $original_file)) { - $accessallowed=1; + $accessallowed = 1; } - $original_file=$conf->facture->multidir_output[$entity].'/'.$original_file; + $original_file = $conf->facture->multidir_output[$entity].'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; } // Wrapping for mass actions @@ -2520,81 +2520,81 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, { if ($fuser->rights->propal->{$lire} || preg_match('/^specimen/i', $original_file)) { - $accessallowed=1; + $accessallowed = 1; } - $original_file=$conf->propal->multidir_output[$entity].'/temp/massgeneration/'.$user->id.'/'.$original_file; + $original_file = $conf->propal->multidir_output[$entity].'/temp/massgeneration/'.$user->id.'/'.$original_file; } elseif ($modulepart == 'massfilesarea_orders') { if ($fuser->rights->commande->{$lire} || preg_match('/^specimen/i', $original_file)) { - $accessallowed=1; + $accessallowed = 1; } - $original_file=$conf->commande->multidir_output[$entity].'/temp/massgeneration/'.$user->id.'/'.$original_file; + $original_file = $conf->commande->multidir_output[$entity].'/temp/massgeneration/'.$user->id.'/'.$original_file; } elseif ($modulepart == 'massfilesarea_sendings') { if ($fuser->rights->expedition->{$lire} || preg_match('/^specimen/i', $original_file)) { - $accessallowed=1; + $accessallowed = 1; } - $original_file=$conf->expedition->dir_output.'/sending/temp/massgeneration/'.$user->id.'/'.$original_file; + $original_file = $conf->expedition->dir_output.'/sending/temp/massgeneration/'.$user->id.'/'.$original_file; } elseif ($modulepart == 'massfilesarea_invoices') { if ($fuser->rights->facture->{$lire} || preg_match('/^specimen/i', $original_file)) { - $accessallowed=1; + $accessallowed = 1; } - $original_file=$conf->facture->multidir_output[$entity].'/temp/massgeneration/'.$user->id.'/'.$original_file; + $original_file = $conf->facture->multidir_output[$entity].'/temp/massgeneration/'.$user->id.'/'.$original_file; } elseif ($modulepart == 'massfilesarea_expensereport') { if ($fuser->rights->facture->{$lire} || preg_match('/^specimen/i', $original_file)) { - $accessallowed=1; + $accessallowed = 1; } - $original_file=$conf->expensereport->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; + $original_file = $conf->expensereport->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; } elseif ($modulepart == 'massfilesarea_interventions') { if ($fuser->rights->ficheinter->{$lire} || preg_match('/^specimen/i', $original_file)) { - $accessallowed=1; + $accessallowed = 1; } - $original_file=$conf->ficheinter->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; + $original_file = $conf->ficheinter->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; } elseif ($modulepart == 'massfilesarea_supplier_proposal' && !empty($conf->supplier_proposal->dir_output)) { if ($fuser->rights->supplier_proposal->{$lire} || preg_match('/^specimen/i', $original_file)) { - $accessallowed=1; + $accessallowed = 1; } - $original_file=$conf->supplier_proposal->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; + $original_file = $conf->supplier_proposal->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; } elseif ($modulepart == 'massfilesarea_supplier_order') { if ($fuser->rights->fournisseur->commande->{$lire} || preg_match('/^specimen/i', $original_file)) { - $accessallowed=1; + $accessallowed = 1; } - $original_file=$conf->fournisseur->commande->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; + $original_file = $conf->fournisseur->commande->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; } elseif ($modulepart == 'massfilesarea_supplier_invoice') { if ($fuser->rights->fournisseur->facture->{$lire} || preg_match('/^specimen/i', $original_file)) { - $accessallowed=1; + $accessallowed = 1; } - $original_file=$conf->fournisseur->facture->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; + $original_file = $conf->fournisseur->facture->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; } elseif ($modulepart == 'massfilesarea_contract' && !empty($conf->contrat->dir_output)) { if ($fuser->rights->contrat->{$lire} || preg_match('/^specimen/i', $original_file)) { - $accessallowed=1; + $accessallowed = 1; } - $original_file=$conf->contrat->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; + $original_file = $conf->contrat->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; } // Wrapping for interventions @@ -2634,9 +2634,9 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, { if ($fuser->rights->commande->{$lire} || preg_match('/^specimen/i', $original_file)) { - $accessallowed=1; + $accessallowed = 1; } - $original_file=$conf->commande->multidir_output[$entity].'/'.$original_file; + $original_file = $conf->commande->multidir_output[$entity].'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."commande WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; } @@ -2676,9 +2676,9 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, { if ($fuser->rights->fournisseur->facture->{$lire} || preg_match('/^specimen/i', $original_file)) { - $accessallowed=1; + $accessallowed = 1; } - $original_file=$conf->fournisseur->facture->dir_output.'/'.$original_file; + $original_file = $conf->fournisseur->facture->dir_output.'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture_fourn WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; } // Wrapping pour les rapport de paiements diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 4d105e0074e..98d636e97dd 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -2627,7 +2627,7 @@ function price2fec($amount) global $conf; // Clean parameters - if (empty($amount)) $amount=0; // To have a numeric value if amount not defined or = '' + if (empty($amount)) $amount = 0; // To have a numeric value if amount not defined or = '' $amount = (is_numeric($amount) ? $amount : 0); // Check if amount is numeric, for example, an error occured when amount value = o (letter) instead 0 (number) // Output decimal number by default diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index a5ba08bb139..4be26bc4c50 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2157,7 +2157,7 @@ function pdf_getLinkedObjects($object, $outputlangs) elseif ($objecttype == 'fichinter') { $outputlangs->load('interventions'); - foreach($objects as $elementobject) + foreach ($objects as $elementobject) { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("InterRef"); $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref); diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 26e97499482..6542b774208 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -34,9 +34,9 @@ */ function dol_getwebuser($mode) { - $t='?'; - if ($mode=='user') $t=getenv('APACHE_RUN_USER'); // $_ENV['APACHE_RUN_USER'] is empty - if ($mode=='group') $t=getenv('APACHE_RUN_GROUP'); + $t = '?'; + if ($mode == 'user') $t = getenv('APACHE_RUN_USER'); // $_ENV['APACHE_RUN_USER'] is empty + if ($mode == 'group') $t = getenv('APACHE_RUN_GROUP'); return $t; } @@ -52,11 +52,11 @@ function dol_getwebuser($mode) */ function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $authmode, $context = '') { - global $conf,$langs; + global $conf, $langs; //global $dolauthmode; // To return authentication finally used // Check parameters - if ($entitytotest == '') $entitytotest=1; + if ($entitytotest == '') $entitytotest = 1; dol_syslog("checkLoginPassEntity usertotest=".$usertotest." entitytotest=".$entitytotest." authmode=".join(',', $authmode)); $login = ''; @@ -64,42 +64,42 @@ function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $auth // Validation of login/pass/entity with standard modules if (empty($login)) { - $test=true; - foreach($authmode as $mode) + $test = true; + foreach ($authmode as $mode) { - if ($test && $mode && ! $login) + if ($test && $mode && !$login) { // Validation of login/pass/entity for mode $mode - $mode=trim($mode); - $authfile='functions_'.$mode.'.php'; - $fullauthfile=''; + $mode = trim($mode); + $authfile = 'functions_'.$mode.'.php'; + $fullauthfile = ''; - $dirlogin=array_merge(array("/core/login"), (array) $conf->modules_parts['login']); - foreach($dirlogin as $reldir) + $dirlogin = array_merge(array("/core/login"), (array) $conf->modules_parts['login']); + foreach ($dirlogin as $reldir) { - $dir=dol_buildpath($reldir, 0); - $newdir=dol_osencode($dir); + $dir = dol_buildpath($reldir, 0); + $newdir = dol_osencode($dir); // Check if file found (do not use dol_is_file to avoid loading files.lib.php) - $tmpnewauthfile = $newdir.(preg_match('/\/$/', $newdir)?'':'/').$authfile; - if (is_file($tmpnewauthfile)) $fullauthfile=$tmpnewauthfile; + $tmpnewauthfile = $newdir.(preg_match('/\/$/', $newdir) ? '' : '/').$authfile; + if (is_file($tmpnewauthfile)) $fullauthfile = $tmpnewauthfile; } - $result=false; - if ($fullauthfile) $result=include_once $fullauthfile; + $result = false; + if ($fullauthfile) $result = include_once $fullauthfile; if ($fullauthfile && $result) { // Call function to check user/password - $function='check_user_password_'.$mode; - $login=call_user_func($function, $usertotest, $passwordtotest, $entitytotest, $context); + $function = 'check_user_password_'.$mode; + $login = call_user_func($function, $usertotest, $passwordtotest, $entitytotest, $context); if ($login) // Login is successfull { - $test=false; // To stop once at first login success - $conf->authmode=$mode; // This properties is defined only when logged to say what mode was successfully used - $dol_tz=GETPOST('tz'); - $dol_dst=GETPOST('dst'); - $dol_screenwidth=GETPOST('screenwidth'); - $dol_screenheight=GETPOST('screenheight'); + $test = false; // To stop once at first login success + $conf->authmode = $mode; // This properties is defined only when logged to say what mode was successfully used + $dol_tz = GETPOST('tz'); + $dol_dst = GETPOST('dst'); + $dol_screenwidth = GETPOST('screenwidth'); + $dol_screenheight = GETPOST('screenheight'); } } else @@ -109,7 +109,7 @@ function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $auth // Load translation files required by the page $langs->loadLangs(array('other', 'main', 'errors')); - $_SESSION["dol_loginmesg"]=$langs->trans("ErrorFailedToLoadLoginFileForMode", $mode); + $_SESSION["dol_loginmesg"] = $langs->trans("ErrorFailedToLoadLoginFileForMode", $mode); } } } @@ -119,7 +119,7 @@ function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $auth } -if (! function_exists('dol_loginfunction')) +if (!function_exists('dol_loginfunction')) { /** * Show Dolibarr default login page. @@ -135,22 +135,22 @@ if (! function_exists('dol_loginfunction')) global $dolibarr_main_demo, $db; global $hookmanager; - $langs->loadLangs(array("main","other","help","admin")); + $langs->loadLangs(array("main", "other", "help", "admin")); // Instantiate hooks of thirdparty module only if not already define $hookmanager->initHooks(array('mainloginpage')); - $main_authentication=$conf->file->main_authentication; + $main_authentication = $conf->file->main_authentication; - $session_name=session_name(); // Get current session name + $session_name = session_name(); // Get current session name $dol_url_root = DOL_URL_ROOT; // Title - $appli=constant('DOL_APPLICATION_TITLE'); - $title=$appli.' '.constant('DOL_VERSION'); - if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE; - $titletruedolibarrversion=constant('DOL_VERSION'); // $title used by login template after the @ to inform of true Dolibarr version + $appli = constant('DOL_APPLICATION_TITLE'); + $title = $appli.' '.constant('DOL_VERSION'); + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $title = $conf->global->MAIN_APPLICATION_TITLE; + $titletruedolibarrversion = constant('DOL_VERSION'); // $title used by login template after the @ to inform of true Dolibarr version // Note: $conf->css looks like '/theme/eldy/style.css.php' /* @@ -171,13 +171,13 @@ if (! function_exists('dol_loginfunction')) */ // Select templates dir - if (! empty($conf->modules_parts['tpl'])) // Using this feature slow down application + if (!empty($conf->modules_parts['tpl'])) // Using this feature slow down application { - $dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl/')); - foreach($dirtpls as $reldir) + $dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl/')); + foreach ($dirtpls as $reldir) { - $tmp=dol_buildpath($reldir.'login.tpl.php'); - if (file_exists($tmp)) { $template_dir=preg_replace('/login\.tpl\.php$/', '', $tmp); break; } + $tmp = dol_buildpath($reldir.'login.tpl.php'); + if (file_exists($tmp)) { $template_dir = preg_replace('/login\.tpl\.php$/', '', $tmp); break; } } } else @@ -186,116 +186,116 @@ if (! function_exists('dol_loginfunction')) } // Set cookie for timeout management - $prefix=dol_getprefix(''); - $sessiontimeout='DOLSESSTIMEOUT_'.$prefix; - if (! empty($conf->global->MAIN_SESSION_TIMEOUT)) setcookie($sessiontimeout, $conf->global->MAIN_SESSION_TIMEOUT, 0, "/", null, false, true); + $prefix = dol_getprefix(''); + $sessiontimeout = 'DOLSESSTIMEOUT_'.$prefix; + if (!empty($conf->global->MAIN_SESSION_TIMEOUT)) setcookie($sessiontimeout, $conf->global->MAIN_SESSION_TIMEOUT, 0, "/", null, false, true); - if (GETPOST('urlfrom', 'alpha')) $_SESSION["urlfrom"]=GETPOST('urlfrom', 'alpha'); + if (GETPOST('urlfrom', 'alpha')) $_SESSION["urlfrom"] = GETPOST('urlfrom', 'alpha'); else unset($_SESSION["urlfrom"]); - if (! GETPOST("username", 'alpha')) $focus_element='username'; - else $focus_element='password'; + if (!GETPOST("username", 'alpha')) $focus_element = 'username'; + else $focus_element = 'password'; - $demologin=''; - $demopassword=''; - if (! empty($dolibarr_main_demo)) + $demologin = ''; + $demopassword = ''; + if (!empty($dolibarr_main_demo)) { - $tab=explode(',', $dolibarr_main_demo); - $demologin=$tab[0]; - $demopassword=$tab[1]; + $tab = explode(',', $dolibarr_main_demo); + $demologin = $tab[0]; + $demopassword = $tab[1]; } // Execute hook getLoginPageOptions (for table) - $parameters=array('entity' => GETPOST('entity', 'int')); - $reshook = $hookmanager->executeHooks('getLoginPageOptions', $parameters); // Note that $action and $object may have been modified by some hooks. + $parameters = array('entity' => GETPOST('entity', 'int')); + $reshook = $hookmanager->executeHooks('getLoginPageOptions', $parameters); // Note that $action and $object may have been modified by some hooks. $morelogincontent = $hookmanager->resPrint; // Execute hook getLoginPageExtraOptions (eg for js) - $parameters=array('entity' => GETPOST('entity', 'int')); - $reshook = $hookmanager->executeHooks('getLoginPageExtraOptions', $parameters); // Note that $action and $object may have been modified by some hooks. + $parameters = array('entity' => GETPOST('entity', 'int')); + $reshook = $hookmanager->executeHooks('getLoginPageExtraOptions', $parameters); // Note that $action and $object may have been modified by some hooks. $moreloginextracontent = $hookmanager->resPrint; // Login - $login = (! empty($hookmanager->resArray['username']) ? $hookmanager->resArray['username'] : (GETPOST("username", "alpha") ? GETPOST("username", "alpha") : $demologin)); + $login = (!empty($hookmanager->resArray['username']) ? $hookmanager->resArray['username'] : (GETPOST("username", "alpha") ? GETPOST("username", "alpha") : $demologin)); $password = $demopassword; // Show logo (search in order: small company logo, large company logo, theme logo, common logo) - $width=0; - $urllogo=DOL_URL_ROOT.'/theme/login_logo.png'; + $width = 0; + $urllogo = DOL_URL_ROOT.'/theme/login_logo.png'; - if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) + if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small); + $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small); } - elseif (! empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) + elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo); - $width=128; + $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo); + $width = 128; } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/dolibarr_logo.png')) { - $urllogo=DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/dolibarr_logo.png'; + $urllogo = DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/dolibarr_logo.png'; } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.png')) { - $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png'; + $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.png'; } // Security graphical code - $captcha=0; - $captcha_refresh=''; - if (function_exists("imagecreatefrompng") && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) + $captcha = 0; + $captcha_refresh = ''; + if (function_exists("imagecreatefrompng") && !empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) { - $captcha=1; - $captcha_refresh=img_picto($langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"'); + $captcha = 1; + $captcha_refresh = img_picto($langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"'); } // Extra link - $forgetpasslink=0; - $helpcenterlink=0; + $forgetpasslink = 0; + $helpcenterlink = 0; if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK) || empty($conf->global->MAIN_HELPCENTER_DISABLELINK)) { if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)) { - $forgetpasslink=1; + $forgetpasslink = 1; } if (empty($conf->global->MAIN_HELPCENTER_DISABLELINK)) { - $helpcenterlink=1; + $helpcenterlink = 1; } } // Home message - $main_home=''; - if (! empty($conf->global->MAIN_HOME)) + $main_home = ''; + if (!empty($conf->global->MAIN_HOME)) { - $substitutionarray=getCommonSubstitutionArray($langs); + $substitutionarray = getCommonSubstitutionArray($langs); complete_substitutions_array($substitutionarray, $langs); $texttoshow = make_substitutions($conf->global->MAIN_HOME, $substitutionarray, $langs); - $main_home=dol_htmlcleanlastbr($texttoshow); + $main_home = dol_htmlcleanlastbr($texttoshow); } // Google AD - $main_google_ad_client = ((! empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN_GOOGLE_AD_SLOT))?1:0); + $main_google_ad_client = ((!empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && !empty($conf->global->MAIN_GOOGLE_AD_SLOT)) ? 1 : 0); // Set jquery theme - $dol_loginmesg = (! empty($_SESSION["dol_loginmesg"])?$_SESSION["dol_loginmesg"]:''); + $dol_loginmesg = (!empty($_SESSION["dol_loginmesg"]) ? $_SESSION["dol_loginmesg"] : ''); $favicon = DOL_URL_ROOT.'/theme/dolibarr_logo_256x256.png'; - if (! empty($mysoc->logo_squarred_mini)) $favicon = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini); - if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL; + if (!empty($mysoc->logo_squarred_mini)) $favicon = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini); + if (!empty($conf->global->MAIN_FAVICON_URL)) $favicon = $conf->global->MAIN_FAVICON_URL; $jquerytheme = 'base'; - if (! empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME; + if (!empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME; // Set dol_hide_topmenu, dol_hide_leftmenu, dol_optimize_smallscreen, dol_no_mouse_hover - $dol_hide_topmenu=GETPOST('dol_hide_topmenu', 'int'); - $dol_hide_leftmenu=GETPOST('dol_hide_leftmenu', 'int'); - $dol_optimize_smallscreen=GETPOST('dol_optimize_smallscreen', 'int'); - $dol_no_mouse_hover=GETPOST('dol_no_mouse_hover', 'int'); - $dol_use_jmobile=GETPOST('dol_use_jmobile', 'int'); + $dol_hide_topmenu = GETPOST('dol_hide_topmenu', 'int'); + $dol_hide_leftmenu = GETPOST('dol_hide_leftmenu', 'int'); + $dol_optimize_smallscreen = GETPOST('dol_optimize_smallscreen', 'int'); + $dol_no_mouse_hover = GETPOST('dol_no_mouse_hover', 'int'); + $dol_use_jmobile = GETPOST('dol_use_jmobile', 'int'); // Include login page template include $template_dir.'login.tpl.php'; @@ -316,20 +316,20 @@ if (! function_exists('dol_loginfunction')) function makesalt($type = CRYPT_SALT_LENGTH) { dol_syslog("makesalt type=".$type); - switch($type) + switch ($type) { case 12: // 8 + 4 - $saltlen=8; $saltprefix='$1$'; $saltsuffix='$'; break; + $saltlen = 8; $saltprefix = '$1$'; $saltsuffix = '$'; break; case 8: // 8 (Pour compatibilite, ne devrait pas etre utilise) - $saltlen=8; $saltprefix='$1$'; $saltsuffix='$'; break; + $saltlen = 8; $saltprefix = '$1$'; $saltsuffix = '$'; break; case 2: // 2 default: // by default, fall back on Standard DES (should work everywhere) - $saltlen=2; $saltprefix=''; $saltsuffix=''; break; + $saltlen = 2; $saltprefix = ''; $saltsuffix = ''; break; } - $salt=''; - while(dol_strlen($salt) < $saltlen) $salt.=chr(mt_rand(64, 126)); + $salt = ''; + while (dol_strlen($salt) < $saltlen) $salt .= chr(mt_rand(64, 126)); - $result=$saltprefix.$salt.$saltsuffix; + $result = $saltprefix.$salt.$saltsuffix; dol_syslog("makesalt return=".$result); return $result; } @@ -344,35 +344,35 @@ function encodedecode_dbpassconf($level = 0) { dol_syslog("encodedecode_dbpassconf level=".$level, LOG_DEBUG); $config = ''; - $passwd=''; - $passwd_crypted=''; + $passwd = ''; + $passwd_crypted = ''; if ($fp = fopen(DOL_DOCUMENT_ROOT.'/conf/conf.php', 'r')) { - while(!feof($fp)) + while (!feof($fp)) { $buffer = fgets($fp, 4096); - $lineofpass=0; + $lineofpass = 0; if (preg_match('/^[^#]*dolibarr_main_db_encrypted_pass[\s]*=[\s]*(.*)/i', $buffer, $reg)) // Old way to save crypted value { - $val = trim($reg[1]); // This also remove CR/LF - $val=preg_replace('/^["\']/', '', $val); - $val=preg_replace('/["\'][\s;]*$/', '', $val); - if (! empty($val)) + $val = trim($reg[1]); // This also remove CR/LF + $val = preg_replace('/^["\']/', '', $val); + $val = preg_replace('/["\'][\s;]*$/', '', $val); + if (!empty($val)) { $passwd_crypted = $val; $val = dol_decode($val); $passwd = $val; - $lineofpass=1; + $lineofpass = 1; } } elseif (preg_match('/^[^#]*dolibarr_main_db_pass[\s]*=[\s]*(.*)/i', $buffer, $reg)) { - $val = trim($reg[1]); // This also remove CR/LF - $val=preg_replace('/^["\']/', '', $val); - $val=preg_replace('/["\'][\s;]*$/', '', $val); + $val = trim($reg[1]); // This also remove CR/LF + $val = preg_replace('/^["\']/', '', $val); + $val = preg_replace('/["\'][\s;]*$/', '', $val); if (preg_match('/crypted:/i', $buffer)) { $val = preg_replace('/crypted:/i', '', $val); @@ -386,7 +386,7 @@ function encodedecode_dbpassconf($level = 0) $val = dol_encode($val); $passwd_crypted = $val; } - $lineofpass=1; + $lineofpass = 1; } // Output line @@ -413,7 +413,7 @@ function encodedecode_dbpassconf($level = 0) fclose($fp); // Write new conf file - $file=DOL_DOCUMENT_ROOT.'/conf/conf.php'; + $file = DOL_DOCUMENT_ROOT.'/conf/conf.php'; if ($fp = @fopen($file, 'w')) { fputs($fp, $config); @@ -451,17 +451,17 @@ function encodedecode_dbpassconf($level = 0) */ function getRandomPassword($generic = false, $replaceambiguouschars = null, $length = 32) { - global $db,$conf,$langs,$user; + global $db, $conf, $langs, $user; - $generated_password=''; + $generated_password = ''; if ($generic) { $lowercase = "qwertyuiopasdfghjklzxcvbnm"; $uppercase = "ASDFGHJKLZXCVBNMQWERTYUIOP"; $numbers = "1234567890"; $randomCode = ""; - $nbofchar = round($length/3); - $nbofcharlast = ($length - 2*$nbofchar); + $nbofchar = round($length / 3); + $nbofcharlast = ($length - 2 * $nbofchar); //var_dump($nbofchar.'-'.$nbofcharlast); if (function_exists('random_int')) // Cryptographic random { @@ -478,7 +478,7 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len $randomCode .= $numbers{random_int(0, $max)}; } - $generated_password=str_shuffle($randomCode); + $generated_password = str_shuffle($randomCode); } else // Old platform, non cryptographic random { @@ -495,17 +495,17 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len $randomCode .= $numbers{mt_rand(0, $max)}; } - $generated_password=str_shuffle($randomCode); + $generated_password = str_shuffle($randomCode); } } - elseif (! empty($conf->global->USER_PASSWORD_GENERATED)) + elseif (!empty($conf->global->USER_PASSWORD_GENERATED)) { - $nomclass="modGeneratePass".ucfirst($conf->global->USER_PASSWORD_GENERATED); - $nomfichier=$nomclass.".class.php"; + $nomclass = "modGeneratePass".ucfirst($conf->global->USER_PASSWORD_GENERATED); + $nomfichier = $nomclass.".class.php"; //print DOL_DOCUMENT_ROOT."/core/modules/security/generate/".$nomclass; require_once DOL_DOCUMENT_ROOT."/core/modules/security/generate/".$nomfichier; - $genhandler=new $nomclass($db, $conf, $langs, $user); - $generated_password=$genhandler->getNewGeneratedPassword(); + $genhandler = new $nomclass($db, $conf, $langs, $user); + $generated_password = $genhandler->getNewGeneratedPassword(); unset($genhandler); } @@ -516,11 +516,11 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len $max = strlen($numbers) - 1; if (function_exists('random_int')) // Cryptographic random { - $generated_password=str_replace($replaceambiguouschars, $numbers{random_int(0, $max)}, $generated_password); + $generated_password = str_replace($replaceambiguouschars, $numbers{random_int(0, $max)}, $generated_password); } else { - $generated_password=str_replace($replaceambiguouschars, $numbers{mt_rand(0, $max)}, $generated_password); + $generated_password = str_replace($replaceambiguouschars, $numbers{mt_rand(0, $max)}, $generated_password); } } diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index e8a09515d91..aabc538db41 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -128,7 +128,7 @@ class pdf_einstein extends ModelePDFCommandes */ public function __construct($db) { - global $conf,$langs,$mysoc; + global $conf, $langs, $mysoc; // Translations $langs->loadLangs(array("main", "bills", "products")); @@ -136,70 +136,70 @@ class pdf_einstein extends ModelePDFCommandes $this->db = $db; $this->name = "einstein"; $this->description = $langs->trans('PDFEinsteinDescription'); - $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template + $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template // Dimension page $this->type = 'pdf'; - $formatarray=pdf_getFormat(); + $formatarray = pdf_getFormat(); $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; - $this->format = array($this->page_largeur,$this->page_hauteur); - $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; - $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; - $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; - $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; + $this->format = array($this->page_largeur, $this->page_hauteur); + $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; + $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; + $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; + $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; - $this->option_logo = 1; // Display logo - $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION - $this->option_modereg = 1; // Display payment mode - $this->option_condreg = 1; // Display payment terms - $this->option_codeproduitservice = 1; // Display product-service code - $this->option_multilang = 1; // Available in several languages - $this->option_escompte = 0; // Displays if there has been a discount - $this->option_credit_note = 0; // Support credit notes - $this->option_freetext = 1; // Support add of a personalised text - $this->option_draft_watermark = 1; // Support add of a watermark on drafts + $this->option_logo = 1; // Display logo + $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION + $this->option_modereg = 1; // Display payment mode + $this->option_condreg = 1; // Display payment terms + $this->option_codeproduitservice = 1; // Display product-service code + $this->option_multilang = 1; // Available in several languages + $this->option_escompte = 0; // Displays if there has been a discount + $this->option_credit_note = 0; // Support credit notes + $this->option_freetext = 1; // Support add of a personalised text + $this->option_draft_watermark = 1; // Support add of a watermark on drafts // Get source company - $this->emetteur=$mysoc; - if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default, if was not defined + $this->emetteur = $mysoc; + if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined // Define position of columns - $this->posxdesc=$this->marge_gauche+1; - if($conf->global->PRODUCT_USE_UNITS) + $this->posxdesc = $this->marge_gauche + 1; + if ($conf->global->PRODUCT_USE_UNITS) { - $this->posxtva=101; - $this->posxup=118; - $this->posxqty=135; - $this->posxunit=151; + $this->posxtva = 101; + $this->posxup = 118; + $this->posxqty = 135; + $this->posxunit = 151; } else { - $this->posxtva=110; - $this->posxup=126; - $this->posxqty=145; - $this->posxunit=162; + $this->posxtva = 110; + $this->posxup = 126; + $this->posxqty = 145; + $this->posxunit = 162; } - $this->posxdiscount=162; - $this->postotalht=174; - if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) $this->posxtva=$this->posxup; - $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images + $this->posxdiscount = 162; + $this->postotalht = 174; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || !empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) $this->posxtva = $this->posxup; + $this->posxpicture = $this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images if ($this->page_largeur < 210) // To work with US executive format { - $this->posxpicture-=20; - $this->posxtva-=20; - $this->posxup-=20; - $this->posxqty-=20; - $this->posxunit-=20; - $this->posxdiscount-=20; - $this->postotalht-=20; + $this->posxpicture -= 20; + $this->posxtva -= 20; + $this->posxup -= 20; + $this->posxqty -= 20; + $this->posxunit -= 20; + $this->posxdiscount -= 20; + $this->postotalht -= 20; } - $this->tva=array(); - $this->localtax1=array(); - $this->localtax2=array(); - $this->atleastoneratenotnull=0; - $this->atleastonediscount=0; + $this->tva = array(); + $this->localtax1 = array(); + $this->localtax2 = array(); + $this->atleastoneratenotnull = 0; + $this->atleastonediscount = 0; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -219,9 +219,9 @@ class pdf_einstein extends ModelePDFCommandes // phpcs:enable global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines; - if (! is_object($outputlangs)) $outputlangs=$langs; + if (!is_object($outputlangs)) $outputlangs = $langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO - if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; + if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; // Load translation files required by the page $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "orders", "deliveries")); @@ -238,20 +238,20 @@ class pdf_einstein extends ModelePDFCommandes if ($object->specimen) { $dir = $conf->commande->multidir_output[$conf->entity]; - $file = $dir . "/SPECIMEN.pdf"; + $file = $dir."/SPECIMEN.pdf"; } else { $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->commande->multidir_output[$object->entity] . "/" . $objectref; - $file = $dir . "/" . $objectref . ".pdf"; + $dir = $conf->commande->multidir_output[$object->entity]."/".$objectref; + $file = $dir."/".$objectref.".pdf"; } - if (! file_exists($dir)) + if (!file_exists($dir)) { if (dol_mkdir($dir) < 0) { - $this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir); + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; } } @@ -259,25 +259,25 @@ class pdf_einstein extends ModelePDFCommandes if (file_exists($dir)) { // Add pdfgeneration hook - if (! is_object($hookmanager)) + if (!is_object($hookmanager)) { include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager=new HookManager($this->db); + $hookmanager = new HookManager($this->db); } $hookmanager->initHooks(array('pdfgeneration')); - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); global $action; - $reshook=$hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks + $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks // Create pdf instance - $pdf=pdf_getInstance($this->format); - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance + $pdf = pdf_getInstance($this->format); + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance $pdf->SetAutoPageBreak(1, 0); - $heightforinfotot = 40; // Height reserved to output the info and total part - $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6; + $heightforinfotot = 40; // Height reserved to output the info and total part + $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) + if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; if (class_exists('TCPDF')) { @@ -286,14 +286,14 @@ class pdf_einstein extends ModelePDFCommandes } $pdf->SetFont(pdf_getPDFFont($outputlangs)); // Set path to the background PDF File - if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) + if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) { $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); $tplidx = $pdf->importPage(1); } $pdf->Open(); - $pagenb=0; + $pagenb = 0; $pdf->SetDrawColor(128, 128, 128); $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); @@ -301,12 +301,12 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfOrderTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); - $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right // Set $this->atleastonediscount if you have at least one discount - for ($i = 0 ; $i < $nblines ; $i++) + for ($i = 0; $i < $nblines; $i++) { if ($object->lines[$i]->remise_percent) { @@ -316,27 +316,27 @@ class pdf_einstein extends ModelePDFCommandes if (empty($this->atleastonediscount)) { $delta = ($this->postotalht - $this->posxdiscount); - $this->posxpicture+=$delta; - $this->posxtva+=$delta; - $this->posxup+=$delta; - $this->posxqty+=$delta; - $this->posxunit+=$delta; - $this->posxdiscount+=$delta; + $this->posxpicture += $delta; + $this->posxtva += $delta; + $this->posxup += $delta; + $this->posxqty += $delta; + $this->posxunit += $delta; + $this->posxdiscount += $delta; // post of fields after are not modified, stay at same position } // New page $pdf->AddPage(); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs); $pdf->SetFont('', '', $default_font_size - 1); - $pdf->MultiCell(0, 3, ''); // Set interline to 3 + $pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->SetTextColor(0, 0, 0); - $tab_top = 90+$top_shift; - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42+$top_shift:10); + $tab_top = 90 + $top_shift; + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); // Incoterm if ($conf->incoterm->enabled) @@ -347,50 +347,50 @@ class pdf_einstein extends ModelePDFCommandes $tab_top -= 2; $pdf->SetFont('', '', $default_font_size - 1); - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($desc_incoterms), 0, 1); $nexY = $pdf->GetY(); - $height_incoterms=$nexY-$tab_top; + $height_incoterms = $nexY - $tab_top; // Rect takes a length in 3rd parameter $pdf->SetDrawColor(192, 192, 192); - $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1); + $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1); - $tab_top = $nexY+6; + $tab_top = $nexY + 6; } } // Displays notes - $notetoshow=empty($object->note_public)?'':$object->note_public; - if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) + $notetoshow = empty($object->note_public) ? '' : $object->note_public; + if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) { // Get first sale rep if (is_object($object->thirdparty)) { - $salereparray=$object->thirdparty->getSalesRepresentatives($user); - $salerepobj=new User($this->db); + $salereparray = $object->thirdparty->getSalesRepresentatives($user); + $salerepobj = new User($this->db); $salerepobj->fetch($salereparray[0]['id']); - if (! empty($salerepobj->signature)) $notetoshow=dol_concatdesc($notetoshow, $salerepobj->signature); + if (!empty($salerepobj->signature)) $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature); } } if ($notetoshow) { $tab_top -= 2; - $substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object); + $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object); $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs); $notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow); $pdf->SetFont('', '', $default_font_size - 1); - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($notetoshow), 0, 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($notetoshow), 0, 1); $nexY = $pdf->GetY(); - $height_note=$nexY-$tab_top; + $height_note = $nexY - $tab_top; // Rect takes a length in 3rd parameter $pdf->SetDrawColor(192, 192, 192); - $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1); + $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); - $tab_top = $nexY+6; + $tab_top = $nexY + 6; } $iniY = $tab_top + 7; @@ -398,156 +398,156 @@ class pdf_einstein extends ModelePDFCommandes $nexY = $tab_top + 7; // Loop on each lines - for ($i = 0 ; $i < $nblines ; $i++) + for ($i = 0; $i < $nblines; $i++) { $curY = $nexY; - $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage + $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage $pdf->SetTextColor(0, 0, 0); $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. - $pageposbefore=$pdf->getPage(); + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pageposbefore = $pdf->getPage(); // Description of product line - $curX = $this->posxdesc-1; + $curX = $this->posxdesc - 1; - $showpricebeforepagebreak=1; + $showpricebeforepagebreak = 1; $pdf->startTransaction(); - pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxtva-$curX, 3, $curX, $curY, $hideref, $hidedesc); - $pageposafter=$pdf->getPage(); + pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxtva - $curX, 3, $curX, $curY, $hideref, $hidedesc); + $pageposafter = $pdf->getPage(); if ($pageposafter > $pageposbefore) // There is a pagebreak { $pdf->rollbackTransaction(true); - $pageposafter=$pageposbefore; + $pageposafter = $pageposbefore; //print $pageposafter.'-'.$pageposbefore;exit; - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. - pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxtva-$curX, 4, $curX, $curY, $hideref, $hidedesc); - $pageposafter=$pdf->getPage(); - $posyafter=$pdf->GetY(); - if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxtva - $curX, 4, $curX, $curY, $hideref, $hidedesc); + $pageposafter = $pdf->getPage(); + $posyafter = $pdf->GetY(); + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text { - if ($i == ($nblines-1)) // No more lines, and no space left to show total, so we create a new page + if ($i == ($nblines - 1)) // No more lines, and no space left to show total, so we create a new page { $pdf->AddPage('', '', true); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - $pdf->setPage($pageposafter+1); + $pdf->setPage($pageposafter + 1); } } else { // We found a page break - $showpricebeforepagebreak=0; + $showpricebeforepagebreak = 0; } } else // No pagebreak { $pdf->commitTransaction(); } - $posYAfterDescription=$pdf->GetY(); + $posYAfterDescription = $pdf->GetY(); $nexY = $pdf->GetY(); - $pageposafter=$pdf->getPage(); + $pageposafter = $pdf->getPage(); $pdf->setPage($pageposbefore); $pdf->setTopMargin($this->marge_haute); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { $pdf->setPage($pageposafter); $curY = $tab_top_newpage; } - $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font + $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font // VAT Rate if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) { $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); - $pdf->SetXY($this->posxtva-5, $curY); - $pdf->MultiCell($this->posxup-$this->posxtva+4, 3, $vat_rate, 0, 'R'); + $pdf->SetXY($this->posxtva - 5, $curY); + $pdf->MultiCell($this->posxup - $this->posxtva + 4, 3, $vat_rate, 0, 'R'); } // Unit price before discount $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->posxup, $curY); - $pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, $up_excl_tax, 0, 'R', 0); + $pdf->MultiCell($this->posxqty - $this->posxup - 0.8, 3, $up_excl_tax, 0, 'R', 0); // Quantity $qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->posxqty, $curY); - $pdf->MultiCell($this->posxunit-$this->posxqty-0.8, 4, $qty, 0, 'R'); // Enough for 6 chars + $pdf->MultiCell($this->posxunit - $this->posxqty - 0.8, 4, $qty, 0, 'R'); // Enough for 6 chars // Unit - if($conf->global->PRODUCT_USE_UNITS) + if ($conf->global->PRODUCT_USE_UNITS) { $unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager); $pdf->SetXY($this->posxunit, $curY); - $pdf->MultiCell($this->posxdiscount-$this->posxunit-0.8, 4, $unit, 0, 'L'); + $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 4, $unit, 0, 'L'); } // Discount on line $pdf->SetXY($this->posxdiscount, $curY); if ($object->lines[$i]->remise_percent) { - $pdf->SetXY($this->posxdiscount-2, $curY); + $pdf->SetXY($this->posxdiscount - 2, $curY); $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails); - $pdf->MultiCell($this->postotalht-$this->posxdiscount+2, 3, $remise_percent, 0, 'R'); + $pdf->MultiCell($this->postotalht - $this->posxdiscount + 2, 3, $remise_percent, 0, 'R'); } // Total HT line $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->postotalht, $curY); - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0, 'R', 0); // Collection of totals by value of vat in $this->vat["rate"] = total_tva - if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; - else $tvaligne=$object->lines[$i]->total_tva; + if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne = $object->lines[$i]->multicurrency_total_tva; + else $tvaligne = $object->lines[$i]->total_tva; - $localtax1ligne=$object->lines[$i]->total_localtax1; - $localtax2ligne=$object->lines[$i]->total_localtax2; - $localtax1_rate=$object->lines[$i]->localtax1_tx; - $localtax2_rate=$object->lines[$i]->localtax2_tx; - $localtax1_type=$object->lines[$i]->localtax1_type; - $localtax2_type=$object->lines[$i]->localtax2_type; + $localtax1ligne = $object->lines[$i]->total_localtax1; + $localtax2ligne = $object->lines[$i]->total_localtax2; + $localtax1_rate = $object->lines[$i]->localtax1_tx; + $localtax2_rate = $object->lines[$i]->localtax2_tx; + $localtax1_type = $object->lines[$i]->localtax1_type; + $localtax2_type = $object->lines[$i]->localtax2_type; - if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100; - if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100; - if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100; + if ($object->remise_percent) $tvaligne -= ($tvaligne * $object->remise_percent) / 100; + if ($object->remise_percent) $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100; + if ($object->remise_percent) $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100; - $vatrate=(string) $object->lines[$i]->tva_tx; + $vatrate = (string) $object->lines[$i]->tva_tx; // Retrieve type from database for backward compatibility with old records - if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined - && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax + if ((!isset($localtax1_type) || $localtax1_type == '' || !isset($localtax2_type) || $localtax2_type == '') // if tax type not defined + && (!empty($localtax1_rate) || !empty($localtax2_rate))) // and there is local tax { - $localtaxtmp_array=getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc); + $localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc); $localtax1_type = $localtaxtmp_array[0]; $localtax2_type = $localtaxtmp_array[2]; } // retrieve global local tax if ($localtax1_type && $localtax1ligne != 0) - $this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne; + $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne; if ($localtax2_type && $localtax2ligne != 0) - $this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne; + $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne; - if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; - if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=0; + if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate .= '*'; + if (!isset($this->tva[$vatrate])) $this->tva[$vatrate] = 0; $this->tva[$vatrate] += $tvaligne; // Add line - if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) + if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) { $pdf->setPage($pageposafter); - $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80))); + $pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80))); //$pdf->SetDrawColor(190,190,200); - $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); + $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1); $pdf->SetLineStyle(array('dash'=>0)); } - $nexY+=2; // Add space between lines + $nexY += 2; // Add space between lines // Detect if some page were added automatically and output _tableau for past pages while ($pagenb < $pageposafter) @@ -564,10 +564,10 @@ class pdf_einstein extends ModelePDFCommandes $this->_pagefoot($pdf, $object, $outputlangs, 1); $pagenb++; $pdf->setPage($pagenb); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); } - if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) + if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { if ($pagenb == 1) { @@ -580,7 +580,7 @@ class pdf_einstein extends ModelePDFCommandes $this->_pagefoot($pdf, $object, $outputlangs, 1); // New page $pdf->AddPage(); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); } @@ -591,13 +591,13 @@ class pdf_einstein extends ModelePDFCommandes $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code); else $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; // Affiche zone infos - $posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); + $posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); // Affiche zone totaux - $posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); + $posy = $this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); // Affiche zone versements /* @@ -617,31 +617,31 @@ class pdf_einstein extends ModelePDFCommandes // Add pdfgeneration hook $hookmanager->initHooks(array('pdfgeneration')); - $parameters=array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); global $action; - $reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; } - if (! empty($conf->global->MAIN_UMASK)) + if (!empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); $this->result = array('fullpath'=>$file); - return 1; // No error + return 1; // No error } else { - $this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir); + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; } } else { - $this->error=$langs->transnoentities("ErrorConstantNotDefined", "COMMANDE_OUTPUTDIR"); + $this->error = $langs->transnoentities("ErrorConstantNotDefined", "COMMANDE_OUTPUTDIR"); return 0; } } @@ -688,10 +688,10 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetXY($this->marge_gauche, $posy); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); - $posy=$pdf->GetY()+4; + $posy = $pdf->GetY() + 4; } - $posxval=52; + $posxval = 52; // Show payments conditions if ($object->cond_reglement_code || $object->cond_reglement) @@ -703,11 +703,11 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc); - $lib_condition_paiement=str_replace('\n', "\n", $lib_condition_paiement); + $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc); + $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); $pdf->MultiCell(67, 4, $lib_condition_paiement, 0, 'L'); - $posy=$pdf->GetY()+3; + $posy = $pdf->GetY() + 3; } // Check a payment mode is defined @@ -738,7 +738,7 @@ class pdf_einstein extends ModelePDFCommandes }*/ // Show planed date of delivery - if (! empty($object->date_livraison)) + if (!empty($object->date_livraison)) { $outputlangs->load("sendings"); $pdf->SetFont('', 'B', $default_font_size - 2); @@ -747,10 +747,10 @@ class pdf_einstein extends ModelePDFCommandes $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $dlp=dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true); + $dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); - $posy=$pdf->GetY()+1; + $posy = $pdf->GetY() + 1; } elseif ($object->availability_code || $object->availability) // Show availability conditions { @@ -761,11 +761,11 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $lib_availability=$outputlangs->transnoentities("AvailabilityType".$object->availability_code)!=('AvailabilityType'.$object->availability_code)?$outputlangs->transnoentities("AvailabilityType".$object->availability_code):$outputlangs->convToOutputCharset(isset($object->availability)?$object->availability:''); - $lib_availability=str_replace('\n', "\n", $lib_availability); + $lib_availability = $outputlangs->transnoentities("AvailabilityType".$object->availability_code) != ('AvailabilityType'.$object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : $outputlangs->convToOutputCharset(isset($object->availability) ? $object->availability : ''); + $lib_availability = str_replace('\n', "\n", $lib_availability); $pdf->MultiCell(80, 4, $lib_availability, 0, 'L'); - $posy=$pdf->GetY()+1; + $posy = $pdf->GetY() + 1; } // Show payment mode @@ -779,17 +779,17 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $lib_mode_reg=$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code)!=('PaymentType'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code):$outputlangs->convToOutputCharset($object->mode_reglement); + $lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement); $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L'); - $posy=$pdf->GetY()+2; + $posy = $pdf->GetY() + 2; } // Show payment mode CHQ if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') { // Si mode reglement non force ou si force a CHQ - if (! empty($conf->global->FACTURE_CHQ_NUMBER)) + if (!empty($conf->global->FACTURE_CHQ_NUMBER)) { if ($conf->global->FACTURE_CHQ_NUMBER > 0) { @@ -799,14 +799,14 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('', 'B', $default_font_size - 3); $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $account->proprio), 0, 'L', 0); - $posy=$pdf->GetY()+1; + $posy = $pdf->GetY() + 1; if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) { $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('', '', $default_font_size - 3); $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0); - $posy=$pdf->GetY()+2; + $posy = $pdf->GetY() + 2; } } if ($conf->global->FACTURE_CHQ_NUMBER == -1) @@ -814,14 +814,14 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('', 'B', $default_font_size - 3); $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0); - $posy=$pdf->GetY()+1; + $posy = $pdf->GetY() + 1; if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) { $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('', '', $default_font_size - 3); $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); - $posy=$pdf->GetY()+2; + $posy = $pdf->GetY() + 2; } } } @@ -830,19 +830,19 @@ class pdf_einstein extends ModelePDFCommandes // If payment mode not forced or forced to VIR, show payment with BAN if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') { - if (! empty($object->fk_account) || ! empty($object->fk_bank) || ! empty($conf->global->FACTURE_RIB_NUMBER)) + if (!empty($object->fk_account) || !empty($object->fk_bank) || !empty($conf->global->FACTURE_RIB_NUMBER)) { - $bankid=(empty($object->fk_account)?$conf->global->FACTURE_RIB_NUMBER:$object->fk_account); - if (! empty($object->fk_bank)) $bankid=$object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank + $bankid = (empty($object->fk_account) ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_account); + if (!empty($object->fk_bank)) $bankid = $object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank $account = new Account($this->db); $account->fetch($bankid); - $curx=$this->marge_gauche; - $cury=$posy; + $curx = $this->marge_gauche; + $cury = $posy; - $posy=pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size); + $posy = pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size); - $posy+=2; + $posy += 2; } } @@ -864,7 +864,7 @@ class pdf_einstein extends ModelePDFCommandes protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { // phpcs:enable - global $conf,$mysoc; + global $conf, $mysoc; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -876,32 +876,32 @@ class pdf_einstein extends ModelePDFCommandes $col1x = 120; $col2x = 170; if ($this->page_largeur < 210) // To work with US executive format { - $col2x-=20; + $col2x -= 20; } $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x); - $useborder=0; + $useborder = 0; $index = 0; // Total HT $pdf->SetFillColor(255, 255, 255); $pdf->SetXY($col1x, $tab2_top + 0); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); $total_ht = (($conf->multicurrency->enabled && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); $pdf->SetXY($col2x, $tab2_top + 0); - $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (! empty($object->remise)?$object->remise:0), 0, $outputlangs), 0, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0, 'R', 1); // Show VAT by rates and total $pdf->SetFillColor(248, 248, 248); $total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; - $this->atleastoneratenotnull=0; + $this->atleastoneratenotnull = 0; if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { - $tvaisnull=((! empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false); - if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL) && $tvaisnull) + $tvaisnull = ((!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false); + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL) && $tvaisnull) { // Nothing to do } @@ -910,27 +910,27 @@ class pdf_einstein extends ModelePDFCommandes //Local tax 1 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach ($this->localtax1 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('1','3','5'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + if (in_array((string) $localtax_type, array('1', '3', '5'))) continue; + foreach ($localtax_rate as $tvakey => $tvaval) { - if ($tvakey!=0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); @@ -941,27 +941,27 @@ class pdf_einstein extends ModelePDFCommandes //Local tax 2 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach ($this->localtax2 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('1','3','5'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + if (in_array((string) $localtax_type, array('1', '3', '5'))) continue; + foreach ($localtax_rate as $tvakey => $tvaval) { - if ($tvakey!=0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); @@ -970,7 +970,7 @@ class pdf_einstein extends ModelePDFCommandes } //} // VAT - foreach($this->tva as $tvakey => $tvaval) + foreach ($this->tva as $tvakey => $tvaval) { if ($tvakey != 0) // On affiche pas taux 0 { @@ -979,15 +979,15 @@ class pdf_einstein extends ModelePDFCommandes $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat =$outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).' '; - $totalvat.=vatrate($tvakey, 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).' '; + $totalvat .= vatrate($tvakey, 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); @@ -997,11 +997,11 @@ class pdf_einstein extends ModelePDFCommandes //Local tax 1 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach ($this->localtax1 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; + if (in_array((string) $localtax_type, array('2', '4', '6'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + foreach ($localtax_rate as $tvakey => $tvaval) { if ($tvakey != 0) // On affiche pas taux 0 { @@ -1010,16 +1010,16 @@ class pdf_einstein extends ModelePDFCommandes $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } @@ -1029,11 +1029,11 @@ class pdf_einstein extends ModelePDFCommandes //Local tax 2 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach ($this->localtax2 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; + if (in_array((string) $localtax_type, array('2', '4', '6'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + foreach ($localtax_rate as $tvakey => $tvaval) { if ($tvakey != 0) // On affiche pas taux 0 { @@ -1042,16 +1042,16 @@ class pdf_einstein extends ModelePDFCommandes $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); @@ -1065,7 +1065,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetTextColor(0, 0, 60); $pdf->SetFillColor(224, 224, 224); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc, 0, $outputlangs), $useborder, 'R', 1); @@ -1074,13 +1074,13 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetTextColor(0, 0, 0); - $creditnoteamount=0; - $depositsamount=0; + $creditnoteamount = 0; + $depositsamount = 0; //$creditnoteamount=$object->getSumCreditNotesUsed(); //$depositsamount=$object->getSumDepositsUsed(); //print "x".$creditnoteamount."-".$depositsamount;exit; $resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT'); - if (! empty($object->paye)) $resteapayer=0; + if (!empty($object->paye)) $resteapayer = 0; if ($deja_regle > 0) { @@ -1088,7 +1088,7 @@ class pdf_einstein extends ModelePDFCommandes $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid"), 0, 'L', 0); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid"), 0, 'L', 0); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle, 0, $outputlangs), 0, 'R', 0); @@ -1096,7 +1096,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetTextColor(0, 0, 60); $pdf->SetFillColor(224, 224, 224); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer, 0, $outputlangs), $useborder, 'R', 1); @@ -1128,8 +1128,8 @@ class pdf_einstein extends ModelePDFCommandes global $conf; // Force to disable hidetop and hidebottom - $hidebottom=0; - if ($hidetop) $hidetop=-1; + $hidebottom = 0; + if ($hidetop) $hidetop = -1; $currency = !empty($currency) ? $currency : $conf->currency; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -1141,52 +1141,52 @@ class pdf_einstein extends ModelePDFCommandes if (empty($hidetop)) { $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency)); - $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4); + $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; - if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); } $pdf->SetDrawColor(128, 128, 128); $pdf->SetFont('', '', $default_font_size - 1); // Output Rect - $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter + $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter if (empty($hidetop)) { - $pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line takes a position y in 2nd parameter and 4th parameter + $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5); // line takes a position y in 2nd parameter and 4th parameter - $pdf->SetXY($this->posxdesc-1, $tab_top+1); + $pdf->SetXY($this->posxdesc - 1, $tab_top + 1); $pdf->MultiCell(108, 2, $outputlangs->transnoentities("Designation"), '', 'L'); } if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) { - $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); + $pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posxtva-3, $tab_top+1); - $pdf->MultiCell($this->posxup-$this->posxtva+3, 2, $outputlangs->transnoentities("VAT"), '', 'C'); + $pdf->SetXY($this->posxtva - 3, $tab_top + 1); + $pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities("VAT"), '', 'C'); } } - $pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height); + $pdf->line($this->posxup - 1, $tab_top, $this->posxup - 1, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posxup-1, $tab_top+1); - $pdf->MultiCell($this->posxqty-$this->posxup-1, 2, $outputlangs->transnoentities("PriceUHT"), '', 'C'); + $pdf->SetXY($this->posxup - 1, $tab_top + 1); + $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceUHT"), '', 'C'); } - $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); + $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posxqty-1, $tab_top+1); - $pdf->MultiCell($this->posxunit-$this->posxqty-1, 2, $outputlangs->transnoentities("Qty"), '', 'C'); + $pdf->SetXY($this->posxqty - 1, $tab_top + 1); + $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C'); } - if($conf->global->PRODUCT_USE_UNITS) { + if ($conf->global->PRODUCT_USE_UNITS) { $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxunit - 1, $tab_top + 1); @@ -1194,13 +1194,13 @@ class pdf_einstein extends ModelePDFCommandes } } - $pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height); + $pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height); if (empty($hidetop)) { if ($this->atleastonediscount) { - $pdf->SetXY($this->posxdiscount-1, $tab_top+1); - $pdf->MultiCell($this->postotalht-$this->posxdiscount+1, 2, $outputlangs->transnoentities("ReductionShort"), '', 'C'); + $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1); + $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities("ReductionShort"), '', 'C'); } } @@ -1210,7 +1210,7 @@ class pdf_einstein extends ModelePDFCommandes } if (empty($hidetop)) { - $pdf->SetXY($this->postotalht-1, $tab_top+1); + $pdf->SetXY($this->postotalht - 1, $tab_top + 1); $pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHT"), '', 'C'); } } @@ -1230,7 +1230,7 @@ class pdf_einstein extends ModelePDFCommandes protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "PdfOrderTitle") { // phpcs:enable - global $conf,$langs,$hookmanager; + global $conf, $langs, $hookmanager; // Load traductions files required by page $outputlangs->loadLangs(array("main", "bills", "propal", "orders", "companies")); @@ -1240,7 +1240,7 @@ class pdf_einstein extends ModelePDFCommandes pdf_pagehead($pdf, $outputlangs, $this->page_hauteur); // Show Draft Watermark - if($object->statut==0 && (! empty($conf->global->COMMANDE_DRAFT_WATERMARK)) ) + if ($object->statut == 0 && (!empty($conf->global->COMMANDE_DRAFT_WATERMARK))) { pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->COMMANDE_DRAFT_WATERMARK); } @@ -1248,8 +1248,8 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetTextColor(0, 0, 60); $pdf->SetFont('', 'B', $default_font_size + 3); - $posy=$this->marge_haute; - $posx=$this->page_largeur-$this->marge_droite-100; + $posy = $this->marge_haute; + $posx = $this->page_largeur - $this->marge_droite - 100; $pdf->SetXY($this->marge_gauche, $posy); @@ -1259,7 +1259,7 @@ class pdf_einstein extends ModelePDFCommandes if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; - if (! empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; @@ -1269,20 +1269,20 @@ class pdf_einstein extends ModelePDFCommandes } if (is_readable($logo)) { - $height=pdf_getHeightForLogo($logo); - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) + $height = pdf_getHeightForLogo($logo); + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } else { $pdf->SetTextColor(200, 0, 0); - $pdf->SetFont('', 'B', $default_font_size -2); + $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); } } else { - $text=$this->emetteur->name; + $text = $this->emetteur->name; $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } } @@ -1290,56 +1290,56 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetFont('', 'B', $default_font_size + 3); $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $title=$outputlangs->transnoentities($titlekey); + $title = $outputlangs->transnoentities($titlekey); $pdf->MultiCell(100, 3, $title, '', 'R'); $pdf->SetFont('', 'B', $default_font_size); - $posy+=5; + $posy += 5; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->ref), '', 'R'); + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref), '', 'R'); - $posy+=1; + $posy += 1; $pdf->SetFont('', '', $default_font_size - 1); if ($object->ref_client) { - $posy+=5; + $posy += 5; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : " . $outputlangs->convToOutputCharset($object->ref_client), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); } - $posy+=4; + $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : " . dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R'); - if (!empty($conf->global->DOC_SHOW_CUSTOMER_CODE) && ! empty($object->thirdparty->code_client)) + if (!empty($conf->global->DOC_SHOW_CUSTOMER_CODE) && !empty($object->thirdparty->code_client)) { - $posy+=4; + $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); } // Get contact if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP)) { - $arrayidcontact=$object->getIdContact('internal', 'SALESREPFOLL'); + $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL'); if (count($arrayidcontact) > 0) { - $usertmp=new User($this->db); + $usertmp = new User($this->db); $usertmp->fetch($arrayidcontact[0]); - $posy+=4; + $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); $pdf->MultiCell(100, 3, $langs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R'); } } - $posy+=2; + $posy += 2; $top_shift = 0; // Show list of linked objects @@ -1353,28 +1353,28 @@ class pdf_einstein extends ModelePDFCommandes if ($showaddress) { // Sender properties - $carac_emetteur=''; + $carac_emetteur = ''; // Add internal contact of proposal if defined - $arrayidcontact=$object->getIdContact('internal', 'SALESREPFOLL'); + $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL'); if (count($arrayidcontact) > 0) { $object->fetch_user($arrayidcontact[0]); - $labelbeforecontactname=($outputlangs->transnoentities("FromContactName")!='FromContactName'?$outputlangs->transnoentities("FromContactName"):$outputlangs->transnoentities("Name")); - $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$labelbeforecontactname." ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; + $labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name")); + $carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname." ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; } $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object); // Show sender - $posy=42+$top_shift; - $posx=$this->marge_gauche; - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80; - $hautcadre=40; + $posy = 42 + $top_shift; + $posx = $this->marge_gauche; + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80; + $hautcadre = 40; // Show sender frame $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('', '', $default_font_size - 2); - $pdf->SetXY($posx, $posy-5); + $pdf->SetXY($posx, $posy - 5); $pdf->MultiCell(66, 5, $outputlangs->transnoentities("BillFrom").":", 0, 'L'); $pdf->SetXY($posx, $posy); $pdf->SetFillColor(230, 230, 230); @@ -1382,25 +1382,25 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetTextColor(0, 0, 60); // Show sender name - $pdf->SetXY($posx+2, $posy+3); + $pdf->SetXY($posx + 2, $posy + 3); $pdf->SetFont('', 'B', $default_font_size); $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); - $posy=$pdf->getY(); + $posy = $pdf->getY(); // Show sender information - $pdf->SetXY($posx+2, $posy); + $pdf->SetXY($posx + 2, $posy); $pdf->SetFont('', '', $default_font_size - 1); $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); // If CUSTOMER contact defined on order, we use it - $usecontact=false; - $arrayidcontact=$object->getIdContact('external', 'CUSTOMER'); + $usecontact = false; + $arrayidcontact = $object->getIdContact('external', 'CUSTOMER'); if (count($arrayidcontact) > 0) { - $usecontact=true; - $result=$object->fetch_contact($arrayidcontact[0]); + $usecontact = true; + $result = $object->fetch_contact($arrayidcontact[0]); } //Recipient name @@ -1411,26 +1411,26 @@ class pdf_einstein extends ModelePDFCommandes $thirdparty = $object->thirdparty; } - $carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs); + $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); - $carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact?$object->contact:''), $usecontact, 'target', $object); + $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target', $object); // Show recipient - $widthrecbox=100; - if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format - $posy=42+$top_shift; - $posx=$this->page_largeur-$this->marge_droite-$widthrecbox; - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; + $widthrecbox = 100; + if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format + $posy = 42 + $top_shift; + $posx = $this->page_largeur - $this->marge_droite - $widthrecbox; + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche; // Show recipient frame $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('', '', $default_font_size - 2); - $pdf->SetXY($posx+2, $posy-5); + $pdf->SetXY($posx + 2, $posy - 5); $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":", 0, 'L'); $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre); // Show recipient name - $pdf->SetXY($posx+2, $posy+3); + $pdf->SetXY($posx + 2, $posy + 3); $pdf->SetFont('', 'B', $default_font_size); $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L'); @@ -1438,7 +1438,7 @@ class pdf_einstein extends ModelePDFCommandes // Show recipient information $pdf->SetFont('', '', $default_font_size - 1); - $pdf->SetXY($posx+2, $posy); + $pdf->SetXY($posx + 2, $posy); $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); } @@ -1461,7 +1461,7 @@ class pdf_einstein extends ModelePDFCommandes { // phpcs:enable global $conf; - $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 03730936c0f..cd9f4c9d6a3 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -136,45 +136,45 @@ class pdf_eratosthene extends ModelePDFCommandes $this->db = $db; $this->name = "eratosthene"; $this->description = $langs->trans('PDFEratostheneDescription'); - $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template + $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template // Dimension page $this->type = 'pdf'; - $formatarray=pdf_getFormat(); + $formatarray = pdf_getFormat(); $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; - $this->format = array($this->page_largeur,$this->page_hauteur); - $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; - $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; - $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; - $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; + $this->format = array($this->page_largeur, $this->page_hauteur); + $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; + $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; + $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; + $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; - $this->option_logo = 1; // Display logo - $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION - $this->option_modereg = 1; // Display payment mode - $this->option_condreg = 1; // Display payment terms - $this->option_codeproduitservice = 1; // Display product-service code - $this->option_multilang = 1; // Available in several languages - $this->option_escompte = 0; // Displays if there has been a discount - $this->option_credit_note = 0; // Support credit notes - $this->option_freetext = 1; // Support add of a personalised text - $this->option_draft_watermark = 1; // Support add of a watermark on drafts + $this->option_logo = 1; // Display logo + $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION + $this->option_modereg = 1; // Display payment mode + $this->option_condreg = 1; // Display payment terms + $this->option_codeproduitservice = 1; // Display product-service code + $this->option_multilang = 1; // Available in several languages + $this->option_escompte = 0; // Displays if there has been a discount + $this->option_credit_note = 0; // Support credit notes + $this->option_freetext = 1; // Support add of a personalised text + $this->option_draft_watermark = 1; // Support add of a watermark on drafts // Get source company - $this->emetteur=$mysoc; - if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default, if was not defined + $this->emetteur = $mysoc; + if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined // Define position of columns - $this->posxdesc=$this->marge_gauche+1; + $this->posxdesc = $this->marge_gauche + 1; $this->tabTitleHeight = 5; // default height - $this->tva=array(); - $this->localtax1=array(); - $this->localtax2=array(); - $this->atleastoneratenotnull=0; - $this->atleastonediscount=0; + $this->tva = array(); + $this->localtax1 = array(); + $this->localtax2 = array(); + $this->atleastoneratenotnull = 0; + $this->atleastonediscount = 0; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -194,14 +194,14 @@ class pdf_eratosthene extends ModelePDFCommandes // phpcs:enable global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines; - if (! is_object($outputlangs)) $outputlangs=$langs; + if (!is_object($outputlangs)) $outputlangs = $langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO - if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; + if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; // Load translation files required by the page $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "orders", "deliveries")); - if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) { + if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) { global $outputlangsbis; $outputlangsbis = new Translate('', $conf); $outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE); @@ -210,39 +210,39 @@ class pdf_eratosthene extends ModelePDFCommandes $nblines = count($object->lines); - $hidetop=0; - if(!empty($conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE)){ - $hidetop=$conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE; + $hidetop = 0; + if (!empty($conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE)) { + $hidetop = $conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE; } // Loop on each lines to detect if there is at least one image to show - $realpatharray=array(); + $realpatharray = array(); $this->atleastonephoto = false; - if (! empty($conf->global->MAIN_GENERATE_ORDERS_WITH_PICTURE)) + if (!empty($conf->global->MAIN_GENERATE_ORDERS_WITH_PICTURE)) { $objphoto = new Product($this->db); - for ($i = 0 ; $i < $nblines ; $i++) + for ($i = 0; $i < $nblines; $i++) { if (empty($object->lines[$i]->fk_product)) continue; $objphoto->fetch($object->lines[$i]->fk_product); //var_dump($objphoto->ref);exit; - if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) + if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { - $pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product') . $objphoto->id ."/photos/"; - $pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product') . dol_sanitizeFileName($objphoto->ref).'/'; + $pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; + $pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; } else { - $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product') . dol_sanitizeFileName($objphoto->ref).'/'; // default - $pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product') . $objphoto->id ."/photos/"; // alternative + $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; // default + $pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative } $arephoto = false; foreach ($pdir as $midir) { - if (! $arephoto) + if (!$arephoto) { $dir = $conf->product->dir_output.'/'.$midir; @@ -287,20 +287,20 @@ class pdf_eratosthene extends ModelePDFCommandes if ($object->specimen) { $dir = $conf->commande->multidir_output[$conf->entity]; - $file = $dir . "/SPECIMEN.pdf"; + $file = $dir."/SPECIMEN.pdf"; } else { $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->commande->multidir_output[$object->entity] . "/" . $objectref; - $file = $dir . "/" . $objectref . ".pdf"; + $dir = $conf->commande->multidir_output[$object->entity]."/".$objectref; + $file = $dir."/".$objectref.".pdf"; } - if (! file_exists($dir)) + if (!file_exists($dir)) { if (dol_mkdir($dir) < 0) { - $this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir); + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; } } @@ -334,14 +334,14 @@ class pdf_eratosthene extends ModelePDFCommandes } $pdf->SetFont(pdf_getPDFFont($outputlangs)); // Set path to the background PDF File - if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) + if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) { $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); $tplidx = $pdf->importPage(1); } $pdf->Open(); - $pagenb=0; + $pagenb = 0; $pdf->SetDrawColor(128, 128, 128); $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); @@ -364,16 +364,16 @@ class pdf_eratosthene extends ModelePDFCommandes // New page $pdf->AddPage(); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs); $pdf->SetFont('', '', $default_font_size - 1); - $pdf->MultiCell(0, 3, ''); // Set interline to 3 + $pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->SetTextColor(0, 0, 0); - $tab_top = 90+$top_shift; - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42+$top_shift:10); + $tab_top = 90 + $top_shift; + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); // Incoterm if ($conf->incoterm->enabled) @@ -384,39 +384,39 @@ class pdf_eratosthene extends ModelePDFCommandes $tab_top -= 2; $pdf->SetFont('', '', $default_font_size - 1); - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($desc_incoterms), 0, 1); $nexY = $pdf->GetY(); - $height_incoterms=$nexY-$tab_top; + $height_incoterms = $nexY - $tab_top; // Rect takes a length in 3rd parameter $pdf->SetDrawColor(192, 192, 192); - $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1); + $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1); - $tab_top = $nexY+6; + $tab_top = $nexY + 6; } } // Displays notes - $notetoshow=empty($object->note_public)?'':$object->note_public; - if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) + $notetoshow = empty($object->note_public) ? '' : $object->note_public; + if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) { // Get first sale rep if (is_object($object->thirdparty)) { - $salereparray=$object->thirdparty->getSalesRepresentatives($user); - $salerepobj=new User($this->db); + $salereparray = $object->thirdparty->getSalesRepresentatives($user); + $salerepobj = new User($this->db); $salerepobj->fetch($salereparray[0]['id']); - if (! empty($salerepobj->signature)) $notetoshow=dol_concatdesc($notetoshow, $salerepobj->signature); + if (!empty($salerepobj->signature)) $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature); } } $pagenb = $pdf->getPage(); if ($notetoshow) { - $tab_width = $this->page_largeur-$this->marge_gauche-$this->marge_droite; + $tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite; $pageposbeforenote = $pagenb; - $substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object); + $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object); $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs); $notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow); @@ -544,85 +544,85 @@ class pdf_eratosthene extends ModelePDFCommandes $nexY = $tab_top + $this->tabTitleHeight + 2; // Loop on each lines - $pageposbeforeprintlines=$pdf->getPage(); + $pageposbeforeprintlines = $pdf->getPage(); $pagenb = $pageposbeforeprintlines; - for ($i = 0 ; $i < $nblines ; $i++) + for ($i = 0; $i < $nblines; $i++) { $curY = $nexY; - $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage + $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage $pdf->SetTextColor(0, 0, 0); // Define size of image if we need it - $imglinesize=array(); - if (! empty($realpatharray[$i])) $imglinesize=pdf_getSizeForImage($realpatharray[$i]); + $imglinesize = array(); + if (!empty($realpatharray[$i])) $imglinesize = pdf_getSizeForImage($realpatharray[$i]); $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. - $pageposbefore=$pdf->getPage(); + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pageposbefore = $pdf->getPage(); // Description of product line - $curX = $this->posxdesc-1; + $curX = $this->posxdesc - 1; - $showpricebeforepagebreak=1; - $posYAfterImage=0; - $posYAfterDescription=0; + $showpricebeforepagebreak = 1; + $posYAfterImage = 0; + $posYAfterDescription = 0; - if($this->getColumnStatus('photo')) + if ($this->getColumnStatus('photo')) { // We start with Photo of product line - if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur-($heightforfooter+$heightforfreetext+$heightforinfotot))) // If photo too high, we moved completely on new page + if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // If photo too high, we moved completely on new page { $pdf->AddPage('', '', true); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); - $pdf->setPage($pageposbefore+1); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); + $pdf->setPage($pageposbefore + 1); $curY = $tab_top_newpage; - $showpricebeforepagebreak=0; + $showpricebeforepagebreak = 0; } if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) { - $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi + $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi // $pdf->Image does not increase value return by getY, so we save it manually - $posYAfterImage=$curY+$imglinesize['height']; + $posYAfterImage = $curY + $imglinesize['height']; } } - if($this->getColumnStatus('desc')) + if ($this->getColumnStatus('desc')) { $pdf->startTransaction(); pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc); - $pageposafter=$pdf->getPage(); + $pageposafter = $pdf->getPage(); if ($pageposafter > $pageposbefore) // There is a pagebreak { $pdf->rollbackTransaction(true); - $pageposafter=$pageposbefore; + $pageposafter = $pageposbefore; //print $pageposafter.'-'.$pageposbefore;exit; - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc); - $pageposafter=$pdf->getPage(); - $posyafter=$pdf->GetY(); - if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text + $pageposafter = $pdf->getPage(); + $posyafter = $pdf->GetY(); + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text { - if ($i == ($nblines-1)) // No more lines, and no space left to show total, so we create a new page + if ($i == ($nblines - 1)) // No more lines, and no space left to show total, so we create a new page { $pdf->AddPage('', '', true); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); //if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - $pdf->setPage($pageposafter+1); + $pdf->setPage($pageposafter + 1); } } else { // We found a page break - $showpricebeforepagebreak=0; + $showpricebeforepagebreak = 0; } } else // No pagebreak { $pdf->commitTransaction(); } - $posYAfterDescription=$pdf->GetY(); + $posYAfterDescription = $pdf->GetY(); } @@ -630,18 +630,18 @@ class pdf_eratosthene extends ModelePDFCommandes $nexY = max($pdf->GetY(), $posYAfterImage); - $pageposafter=$pdf->getPage(); + $pageposafter = $pdf->getPage(); $pdf->setPage($pageposbefore); $pdf->setTopMargin($this->marge_haute); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { $pdf->setPage($pageposafter); $curY = $tab_top_newpage; } - $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font + $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font // VAT Rate if ($this->getColumnStatus('vat')) @@ -703,56 +703,56 @@ class pdf_eratosthene extends ModelePDFCommandes 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails ); - $reshook=$hookmanager->executeHooks('printPDFline', $parameters, $this); // Note that $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printPDFline', $parameters, $this); // Note that $object may have been modified by hook // Collection of totals by value of vat in $this->tva["rate"] = total_tva - if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; - else $tvaligne=$object->lines[$i]->total_tva; + if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne = $object->lines[$i]->multicurrency_total_tva; + else $tvaligne = $object->lines[$i]->total_tva; - $localtax1ligne=$object->lines[$i]->total_localtax1; - $localtax2ligne=$object->lines[$i]->total_localtax2; - $localtax1_rate=$object->lines[$i]->localtax1_tx; - $localtax2_rate=$object->lines[$i]->localtax2_tx; - $localtax1_type=$object->lines[$i]->localtax1_type; - $localtax2_type=$object->lines[$i]->localtax2_type; + $localtax1ligne = $object->lines[$i]->total_localtax1; + $localtax2ligne = $object->lines[$i]->total_localtax2; + $localtax1_rate = $object->lines[$i]->localtax1_tx; + $localtax2_rate = $object->lines[$i]->localtax2_tx; + $localtax1_type = $object->lines[$i]->localtax1_type; + $localtax2_type = $object->lines[$i]->localtax2_type; - if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100; - if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100; - if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100; + if ($object->remise_percent) $tvaligne -= ($tvaligne * $object->remise_percent) / 100; + if ($object->remise_percent) $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100; + if ($object->remise_percent) $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100; - $vatrate=(string) $object->lines[$i]->tva_tx; + $vatrate = (string) $object->lines[$i]->tva_tx; // Retrieve type from database for backward compatibility with old records - if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined - && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax + if ((!isset($localtax1_type) || $localtax1_type == '' || !isset($localtax2_type) || $localtax2_type == '') // if tax type not defined + && (!empty($localtax1_rate) || !empty($localtax2_rate))) // and there is local tax { - $localtaxtmp_array=getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc); + $localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc); $localtax1_type = $localtaxtmp_array[0]; $localtax2_type = $localtaxtmp_array[2]; } // retrieve global local tax if ($localtax1_type && $localtax1ligne != 0) - $this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne; + $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne; if ($localtax2_type && $localtax2ligne != 0) - $this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne; + $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne; - if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; - if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=0; + if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate .= '*'; + if (!isset($this->tva[$vatrate])) $this->tva[$vatrate] = 0; $this->tva[$vatrate] += $tvaligne; // Add line - if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) + if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) { $pdf->setPage($pageposafter); - $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80))); + $pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80))); //$pdf->SetDrawColor(190,190,200); - $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); + $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1); $pdf->SetLineStyle(array('dash'=>0)); } - $nexY+=2; // Add space between lines + $nexY += 2; // Add space between lines // Detect if some page were added automatically and output _tableau for past pages while ($pagenb < $pageposafter) @@ -822,31 +822,31 @@ class pdf_eratosthene extends ModelePDFCommandes // Add pdfgeneration hook $hookmanager->initHooks(array('pdfgeneration')); - $parameters=array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); global $action; - $reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; } - if (! empty($conf->global->MAIN_UMASK)) + if (!empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); $this->result = array('fullpath'=>$file); - return 1; // No error + return 1; // No error } else { - $this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir); + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; } } else { - $this->error=$langs->transnoentities("ErrorConstantNotDefined", "COMMANDE_OUTPUTDIR"); + $this->error = $langs->transnoentities("ErrorConstantNotDefined", "COMMANDE_OUTPUTDIR"); return 0; } } @@ -1080,7 +1080,7 @@ class pdf_eratosthene extends ModelePDFCommandes $index = 0; $outputlangsbis = null; - if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) { + if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) { $outputlangsbis = new Translate('', $conf); $outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE); $outputlangsbis->loadLangs(array("main", "dict", "companies", "bills", "products", "propal")); @@ -1112,27 +1112,27 @@ class pdf_eratosthene extends ModelePDFCommandes //Local tax 1 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach ($this->localtax1 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('1','3','5'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + if (in_array((string) $localtax_type, array('1', '3', '5'))) continue; + foreach ($localtax_rate as $tvakey => $tvaval) { - if ($tvakey!=0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT1", $mysoc->country_code) : ''); - $totalvat.=' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat .= ' '; + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); @@ -1143,28 +1143,28 @@ class pdf_eratosthene extends ModelePDFCommandes //Local tax 2 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach ($this->localtax2 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('1','3','5'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + if (in_array((string) $localtax_type, array('1', '3', '5'))) continue; + foreach ($localtax_rate as $tvakey => $tvaval) { - if ($tvakey!=0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : ''); - $totalvat.=' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat .= ' '; + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); @@ -1189,7 +1189,7 @@ class pdf_eratosthene extends ModelePDFCommandes $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalVAT", $mysoc->country_code) : ''); - $totalvat.=' '; + $totalvat .= ' '; $totalvat .= vatrate($tvakey, 1).$tvacompl; $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -1201,11 +1201,11 @@ class pdf_eratosthene extends ModelePDFCommandes //Local tax 1 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach ($this->localtax1 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; + if (in_array((string) $localtax_type, array('2', '4', '6'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + foreach ($localtax_rate as $tvakey => $tvaval) { if ($tvakey != 0) // On affiche pas taux 0 { @@ -1214,17 +1214,17 @@ class pdf_eratosthene extends ModelePDFCommandes $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT1", $mysoc->country_code) : ''); - $totalvat.=' '; + $totalvat .= ' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } @@ -1234,11 +1234,11 @@ class pdf_eratosthene extends ModelePDFCommandes //Local tax 2 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach ($this->localtax2 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; + if (in_array((string) $localtax_type, array('2', '4', '6'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + foreach ($localtax_rate as $tvakey => $tvaval) { if ($tvakey != 0) // On affiche pas taux 0 { @@ -1247,17 +1247,17 @@ class pdf_eratosthene extends ModelePDFCommandes $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : ''); - $totalvat.=' '; + $totalvat .= ' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); @@ -1347,12 +1347,12 @@ class pdf_eratosthene extends ModelePDFCommandes if (empty($hidetop)) { $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency)); - $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4); + $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; - if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) { + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); } } @@ -1360,13 +1360,13 @@ class pdf_eratosthene extends ModelePDFCommandes $pdf->SetFont('', '', $default_font_size - 1); // Output Rect - $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter + $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter $this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop); - if (empty($hidetop)){ - $pdf->line($this->marge_gauche, $tab_top+$this->tabTitleHeight, $this->page_largeur-$this->marge_droite, $tab_top+$this->tabTitleHeight); // line takes a position y in 2nd parameter and 4th parameter + if (empty($hidetop)) { + $pdf->line($this->marge_gauche, $tab_top + $this->tabTitleHeight, $this->page_largeur - $this->marge_droite, $tab_top + $this->tabTitleHeight); // line takes a position y in 2nd parameter and 4th parameter } } @@ -1385,7 +1385,7 @@ class pdf_eratosthene extends ModelePDFCommandes protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "PdfOrderTitle") { // phpcs:enable - global $conf,$langs,$hookmanager; + global $conf, $langs, $hookmanager; // Load traductions files required by page $outputlangs->loadLangs(array("main", "bills", "propal", "orders", "companies")); @@ -1403,8 +1403,8 @@ class pdf_eratosthene extends ModelePDFCommandes $pdf->SetTextColor(0, 0, 60); $pdf->SetFont('', 'B', $default_font_size + 3); - $posy=$this->marge_haute; - $posx=$this->page_largeur-$this->marge_droite-100; + $posy = $this->marge_haute; + $posx = $this->page_largeur - $this->marge_droite - 100; $pdf->SetXY($this->marge_gauche, $posy); @@ -1414,7 +1414,7 @@ class pdf_eratosthene extends ModelePDFCommandes if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; - if (! empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; @@ -1424,20 +1424,20 @@ class pdf_eratosthene extends ModelePDFCommandes } if (is_readable($logo)) { - $height=pdf_getHeightForLogo($logo); - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) + $height = pdf_getHeightForLogo($logo); + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } else { $pdf->SetTextColor(200, 0, 0); - $pdf->SetFont('', 'B', $default_font_size -2); + $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); } } else { - $text=$this->emetteur->name; + $text = $this->emetteur->name; $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } } @@ -1471,12 +1471,12 @@ class pdf_eratosthene extends ModelePDFCommandes $pdf->SetTextColor(0, 0, 60); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R'); - if (!empty($conf->global->DOC_SHOW_CUSTOMER_CODE) && ! empty($object->thirdparty->code_client)) + if (!empty($conf->global->DOC_SHOW_CUSTOMER_CODE) && !empty($object->thirdparty->code_client)) { - $posy+=4; + $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); } // Get contact diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 5b4199e2c57..52e41ea2589 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -168,7 +168,7 @@ class pdf_espadon extends ModelePdfExpedition // Load traductions files required by page $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch")); - if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) { + if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) { global $outputlangsbis; $outputlangsbis = new Translate('', $conf); $outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE); @@ -178,22 +178,22 @@ class pdf_espadon extends ModelePdfExpedition $nblines = count($object->lines); // Loop on each lines to detect if there is at least one image to show - $realpatharray=array(); - if (! empty($conf->global->MAIN_GENERATE_SHIPMENT_WITH_PICTURE)) + $realpatharray = array(); + if (!empty($conf->global->MAIN_GENERATE_SHIPMENT_WITH_PICTURE)) { $objphoto = new Product($this->db); - for ($i = 0 ; $i < $nblines ; $i++) + for ($i = 0; $i < $nblines; $i++) { if (empty($object->lines[$i]->fk_product)) continue; $objphoto = new Product($this->db); $objphoto->fetch($object->lines[$i]->fk_product); - $pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product') . $object->lines[$i]->fk_product ."/photos/"; + $pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product').$object->lines[$i]->fk_product."/photos/"; $dir = $conf->product->dir_output.'/'.$pdir; - $realpath=''; + $realpath = ''; foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) { @@ -250,25 +250,25 @@ class pdf_espadon extends ModelePdfExpedition if (file_exists($dir)) { // Add pdfgeneration hook - if (! is_object($hookmanager)) + if (!is_object($hookmanager)) { include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager=new HookManager($this->db); + $hookmanager = new HookManager($this->db); } $hookmanager->initHooks(array('pdfgeneration')); - $parameters=array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); global $action; - $reshook=$hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks + $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks // Set nblines with the new facture lines content after hook $nblines = count($object->lines); - $pdf=pdf_getInstance($this->format); + $pdf = pdf_getInstance($this->format); $default_font_size = pdf_getPDFFontSize($outputlangs); - $heightforinfotot = 8; // Height reserved to output the info and total part - $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6; + $heightforinfotot = 8; // Height reserved to output the info and total part + $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) + if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -323,51 +323,51 @@ class pdf_espadon extends ModelePdfExpedition $tab_top = 88; $pdf->SetFont('', '', $default_font_size - 1); - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($desc_incoterms), 0, 1); $nexY = $pdf->GetY(); - $height_incoterms=$nexY-$tab_top; + $height_incoterms = $nexY - $tab_top; // Rect takes a length in 3rd parameter $pdf->SetDrawColor(192, 192, 192); - $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1); + $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1); - $tab_top = $nexY+6; + $tab_top = $nexY + 6; $height_incoterms += 4; } } - if (! empty($object->note_public) || ! empty($object->tracking_number)) + if (!empty($object->note_public) || !empty($object->tracking_number)) { $tab_top = 88 + $height_incoterms; $tab_top_alt = $tab_top; $pdf->SetFont('', 'B', $default_font_size - 2); - $pdf->writeHTMLCell(60, 4, $this->posxdesc-1, $tab_top-1, $outputlangs->transnoentities("TrackingNumber")." : " . $object->tracking_number, 0, 1, false, true, 'L'); + $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities("TrackingNumber")." : ".$object->tracking_number, 0, 1, false, true, 'L'); $tab_top_alt = $pdf->GetY(); //$tab_top_alt += 1; // Tracking number - if (! empty($object->tracking_number)) + if (!empty($object->tracking_number)) { $object->getUrlTrackingStatus($object->tracking_number); - if (! empty($object->tracking_url)) + if (!empty($object->tracking_url)) { if ($object->shipping_method_id > 0) { // Get code using getLabelFromKey - $code=$outputlangs->getLabelFromKey($this->db, $object->shipping_method_id, 'c_shipment_mode', 'rowid', 'code'); - $label=''; - if ($object->tracking_url != $object->tracking_number) $label.=$outputlangs->trans("LinkToTrackYourPackage")."
"; - $label.=$outputlangs->trans("SendingMethod").": ".$outputlangs->trans("SendingMethod".strtoupper($code)); + $code = $outputlangs->getLabelFromKey($this->db, $object->shipping_method_id, 'c_shipment_mode', 'rowid', 'code'); + $label = ''; + if ($object->tracking_url != $object->tracking_number) $label .= $outputlangs->trans("LinkToTrackYourPackage")."
"; + $label .= $outputlangs->trans("SendingMethod").": ".$outputlangs->trans("SendingMethod".strtoupper($code)); //var_dump($object->tracking_url != $object->tracking_number);exit; if ($object->tracking_url != $object->tracking_number) { - $label.=" : "; - $label.=$object->tracking_url; + $label .= " : "; + $label .= $object->tracking_url; } $pdf->SetFont('', 'B', $default_font_size - 2); - $pdf->writeHTMLCell(60, 4, $this->posxdesc-1, $tab_top_alt, $label, 0, 1, false, true, 'L'); + $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top_alt, $label, 0, 1, false, true, 'L'); $tab_top_alt = $pdf->GetY(); } @@ -375,25 +375,25 @@ class pdf_espadon extends ModelePdfExpedition } // Notes - if (! empty($object->note_public)) + if (!empty($object->note_public)) { - $pdf->SetFont('', '', $default_font_size - 1); // In loop to manage multi-page - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top_alt, dol_htmlentitiesbr($object->note_public), 0, 1); + $pdf->SetFont('', '', $default_font_size - 1); // In loop to manage multi-page + $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top_alt, dol_htmlentitiesbr($object->note_public), 0, 1); } $nexY = $pdf->GetY(); - $height_note=$nexY-$tab_top; + $height_note = $nexY - $tab_top; // Rect takes a length in 3rd parameter $pdf->SetDrawColor(192, 192, 192); - $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1); + $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); $tab_height = $tab_height - $height_note; - $tab_top = $nexY+6; + $tab_top = $nexY + 6; } else { - $height_note=0; + $height_note = 0; } @@ -414,90 +414,90 @@ class pdf_espadon extends ModelePdfExpedition for ($i = 0; $i < $nblines; $i++) { $curY = $nexY; - $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage + $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage $pdf->SetTextColor(0, 0, 0); // Define size of image if we need it - $imglinesize=array(); - if (! empty($realpatharray[$i])) $imglinesize=pdf_getSizeForImage($realpatharray[$i]); + $imglinesize = array(); + if (!empty($realpatharray[$i])) $imglinesize = pdf_getSizeForImage($realpatharray[$i]); $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. - $pageposbefore=$pdf->getPage(); + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pageposbefore = $pdf->getPage(); - $showpricebeforepagebreak=1; - $posYAfterImage=0; - $posYAfterDescription=0; + $showpricebeforepagebreak = 1; + $posYAfterImage = 0; + $posYAfterDescription = 0; - if($this->getColumnStatus('photo')) + if ($this->getColumnStatus('photo')) { // We start with Photo of product line - if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur-($heightforfooter+$heightforfreetext+$heightforsignature+$heightforinfotot))) // If photo too high, we moved completely on new page + if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) // If photo too high, we moved completely on new page { $pdf->AddPage('', '', true); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); //if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - $pdf->setPage($pageposbefore+1); + $pdf->setPage($pageposbefore + 1); $curY = $tab_top_newpage; - $showpricebeforepagebreak=0; + $showpricebeforepagebreak = 0; } if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) { - $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi + $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi // $pdf->Image does not increase value return by getY, so we save it manually - $posYAfterImage=$curY+$imglinesize['height']; + $posYAfterImage = $curY + $imglinesize['height']; } } // Description of product line - if($this->getColumnStatus('desc')) + if ($this->getColumnStatus('desc')) { $pdf->startTransaction(); pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc); - $pageposafter=$pdf->getPage(); + $pageposafter = $pdf->getPage(); if ($pageposafter > $pageposbefore) // There is a pagebreak { $pdf->rollbackTransaction(true); - $pageposafter=$pageposbefore; + $pageposafter = $pageposbefore; //print $pageposafter.'-'.$pageposbefore;exit; - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc); - $pageposafter=$pdf->getPage(); - $posyafter=$pdf->GetY(); + $pageposafter = $pdf->getPage(); + $posyafter = $pdf->GetY(); //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; - if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforsignature+$heightforinfotot))) // There is no space left for total+free text + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) // There is no space left for total+free text { - if ($i == ($nblines-1)) // No more lines, and no space left to show total, so we create a new page + if ($i == ($nblines - 1)) // No more lines, and no space left to show total, so we create a new page { $pdf->AddPage('', '', true); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); //if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - $pdf->setPage($pageposafter+1); + $pdf->setPage($pageposafter + 1); } } else { // We found a page break - $showpricebeforepagebreak=0; + $showpricebeforepagebreak = 0; } } else // No pagebreak { $pdf->commitTransaction(); } - $posYAfterDescription=$pdf->GetY(); + $posYAfterDescription = $pdf->GetY(); } $nexY = $pdf->GetY(); - $pageposafter=$pdf->getPage(); + $pageposafter = $pdf->getPage(); $pdf->setPage($pageposbefore); $pdf->setTopMargin($this->marge_haute); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { @@ -509,25 +509,25 @@ class pdf_espadon extends ModelePdfExpedition $pdf->setPage($pageposafter); $curY = $tab_top_newpage; } - $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font + $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font // weight - $weighttxt=''; + $weighttxt = ''; if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->weight) { - $weighttxt=round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, 5).' '.measuringUnitString(0, "weight", $object->lines[$i]->weight_units); + $weighttxt = round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, 5).' '.measuringUnitString(0, "weight", $object->lines[$i]->weight_units); } - $voltxt=''; + $voltxt = ''; if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->volume) { - $voltxt=round($object->lines[$i]->volume * $object->lines[$i]->qty_shipped, 5).' '.measuringUnitString(0, "volume", $object->lines[$i]->volume_units?$object->lines[$i]->volume_units:0); + $voltxt = round($object->lines[$i]->volume * $object->lines[$i]->qty_shipped, 5).' '.measuringUnitString(0, "volume", $object->lines[$i]->volume_units ? $object->lines[$i]->volume_units : 0); } if ($this->getColumnStatus('weight')) { - $this->printStdColumnContent($pdf, $curY, 'weight', $weighttxt.(($weighttxt && $voltxt)?'
':'').$voltxt, array('html'=>1)); + $this->printStdColumnContent($pdf, $curY, 'weight', $weighttxt.(($weighttxt && $voltxt) ? '
' : '').$voltxt, array('html'=>1)); $nexY = max($pdf->GetY(), $nexY); } @@ -551,16 +551,16 @@ class pdf_espadon extends ModelePdfExpedition - $nexY+=3; - if ($weighttxt && $voltxt) $nexY+=2; + $nexY += 3; + if ($weighttxt && $voltxt) $nexY += 2; // Add line - if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) + if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) { $pdf->setPage($pageposafter); - $pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80,80,80))); + $pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80))); //$pdf->SetDrawColor(190,190,200); - $pdf->line($this->marge_gauche, $nexY-1, $this->page_largeur - $this->marge_droite, $nexY-1); + $pdf->line($this->marge_gauche, $nexY - 1, $this->page_largeur - $this->marge_droite, $nexY - 1); $pdf->SetLineStyle(array('dash'=>0)); } @@ -579,10 +579,10 @@ class pdf_espadon extends ModelePdfExpedition $this->_pagefoot($pdf, $object, $outputlangs, 1); $pagenb++; $pdf->setPage($pagenb); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); } - if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) + if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { if ($pagenb == 1) { @@ -605,16 +605,16 @@ class pdf_espadon extends ModelePdfExpedition if ($pagenb == 1) { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } // Display total area - $posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs); + $posy = $this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs); // Pagefoot $this->_pagefoot($pdf, $object, $outputlangs); @@ -681,7 +681,7 @@ class pdf_espadon extends ModelePdfExpedition $pdf->SetFont('', 'B', $default_font_size - 1); // Total table - $col1x = $this->posxweightvol-50; $col2x = $this->posxweightvol; + $col1x = $this->posxweightvol - 50; $col2x = $this->posxweightvol; /*if ($this->page_largeur < 210) // To work with US executive format { $col2x-=20; @@ -788,8 +788,8 @@ class pdf_espadon extends ModelePdfExpedition if (empty($hidetop)) { //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; - if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) { + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); } } @@ -797,13 +797,13 @@ class pdf_espadon extends ModelePdfExpedition $pdf->SetFont('', '', $default_font_size - 1); // Output Rect - $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter + $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter $this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop); - if (empty($hidetop)){ - $pdf->line($this->marge_gauche, $tab_top+$this->tabTitleHeight, $this->page_largeur-$this->marge_droite, $tab_top+$this->tabTitleHeight); // line takes a position y in 2nd parameter and 4th parameter + if (empty($hidetop)) { + $pdf->line($this->marge_gauche, $tab_top + $this->tabTitleHeight, $this->page_largeur - $this->marge_droite, $tab_top + $this->tabTitleHeight); // line takes a position y in 2nd parameter and 4th parameter } } @@ -839,19 +839,19 @@ class pdf_espadon extends ModelePdfExpedition $w = 110; - $posy=$this->marge_haute; - $posx=$this->page_largeur-$this->marge_droite-$w; + $posy = $this->marge_haute; + $posx = $this->page_largeur - $this->marge_droite - $w; $pdf->SetXY($this->marge_gauche, $posy); // Logo - $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; + $logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; if ($this->emetteur->logo) { if (is_readable($logo)) { - $height=pdf_getHeightForLogo($logo); - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) + $height = pdf_getHeightForLogo($logo); + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } else { @@ -863,21 +863,21 @@ class pdf_espadon extends ModelePdfExpedition } else { - $text=$this->emetteur->name; + $text = $this->emetteur->name; $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } // Show barcode - if (! empty($conf->barcode->enabled)) + if (!empty($conf->barcode->enabled)) { - $posx=105; + $posx = 105; } else { - $posx=$this->marge_gauche+3; + $posx = $this->marge_gauche + 3; } //$pdf->Rect($this->marge_gauche, $this->marge_haute, $this->page_largeur-$this->marge_gauche-$this->marge_droite, 30); - if (! empty($conf->barcode->enabled)) + if (!empty($conf->barcode->enabled)) { // TODO Build code bar with function writeBarCode of barcode module for sending ref $object->ref //$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3); @@ -893,67 +893,67 @@ class pdf_espadon extends ModelePdfExpedition } - $posx=$this->page_largeur - $w - $this->marge_droite; - $posy=$this->marge_haute; + $posx = $this->page_largeur - $w - $this->marge_droite; + $posy = $this->marge_haute; $pdf->SetFont('', 'B', $default_font_size + 2); $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $title=$outputlangs->transnoentities("SendingSheet"); + $title = $outputlangs->transnoentities("SendingSheet"); $pdf->MultiCell($w, 4, $title, '', 'R'); $pdf->SetFont('', '', $default_font_size + 1); - $posy+=5; + $posy += 5; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 4, $outputlangs->transnoentities("RefSending") ." : ".$object->ref, '', 'R'); + $pdf->MultiCell($w, 4, $outputlangs->transnoentities("RefSending")." : ".$object->ref, '', 'R'); // Date planned delivery - if (! empty($object->date_delivery)) + if (!empty($object->date_delivery)) { - $posy+=4; + $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); $pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery, "day", false, $outputlangs, true), '', 'R'); } - if (! empty($object->thirdparty->code_client)) + if (!empty($object->thirdparty->code_client)) { - $posy+=4; + $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); } $pdf->SetFont('', '', $default_font_size + 3); - $Yoff=25; + $Yoff = 25; // Add list of linked orders - $origin = $object->origin; - $origin_id = $object->origin_id; + $origin = $object->origin; + $origin_id = $object->origin_id; // TODO move to external function - if (! empty($conf->$origin->enabled)) // commonly $origin='commande' + if (!empty($conf->$origin->enabled)) // commonly $origin='commande' { $outputlangs->load('orders'); $classname = ucfirst($origin); $linkedobject = new $classname($this->db); - $result=$linkedobject->fetch($origin_id); + $result = $linkedobject->fetch($origin_id); if ($result >= 0) { //$linkedobject->fetchObjectLinked() Get all linked object to the $linkedobject (commonly order) into $linkedobject->linkedObjects $pdf->SetFont('', '', $default_font_size - 2); - $text=$linkedobject->ref; - if ($linkedobject->ref_client) $text.=' ('.$linkedobject->ref_client.')'; - $Yoff = $Yoff+8; + $text = $linkedobject->ref; + if ($linkedobject->ref_client) $text .= ' ('.$linkedobject->ref_client.')'; + $Yoff = $Yoff + 8; $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff); - $pdf->MultiCell($w, 2, $outputlangs->transnoentities("RefOrder") ." : ".$outputlangs->transnoentities($text), 0, 'R'); - $Yoff = $Yoff+3; + $pdf->MultiCell($w, 2, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), 0, 'R'); + $Yoff = $Yoff + 3; $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff); $pdf->MultiCell($w, 2, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($linkedobject->date, "day", false, $outputlangs, true), 0, 'R'); } @@ -994,24 +994,24 @@ class pdf_espadon extends ModelePdfExpedition $pdf->SetFillColor(255, 255, 255); // Show sender name - $pdf->SetXY($posx+2, $posy+3); + $pdf->SetXY($posx + 2, $posy + 3); $pdf->SetFont('', 'B', $default_font_size); - $pdf->MultiCell($widthrecbox-2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); - $posy=$pdf->getY(); + $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); + $posy = $pdf->getY(); // Show sender information - $pdf->SetXY($posx+2, $posy); + $pdf->SetXY($posx + 2, $posy); $pdf->SetFont('', '', $default_font_size - 1); - $pdf->MultiCell($widthrecbox-2, 4, $carac_emetteur, 0, 'L'); + $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0, 'L'); // If SHIPPING contact defined, we use it - $usecontact=false; - $arrayidcontact=$object->$origin->getIdContact('external', 'SHIPPING'); + $usecontact = false; + $arrayidcontact = $object->$origin->getIdContact('external', 'SHIPPING'); if (count($arrayidcontact) > 0) { - $usecontact=true; - $result=$object->fetch_contact($arrayidcontact[0]); + $usecontact = true; + $result = $object->fetch_contact($arrayidcontact[0]); } //Recipient name @@ -1022,26 +1022,26 @@ class pdf_espadon extends ModelePdfExpedition $thirdparty = $object->thirdparty; } - $carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs); + $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); - $carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (!empty($object->contact)?$object->contact:null), $usecontact, 'targetwithdetails', $object); + $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (!empty($object->contact) ? $object->contact : null), $usecontact, 'targetwithdetails', $object); // Show recipient - $widthrecbox=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100; - if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format - $posy=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42; - $posx=$this->page_largeur - $this->marge_droite - $widthrecbox; - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; + $widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100; + if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format + $posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42; + $posx = $this->page_largeur - $this->marge_droite - $widthrecbox; + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche; // Show recipient frame $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('', '', $default_font_size - 2); - $pdf->SetXY($posx+2, $posy-5); + $pdf->SetXY($posx + 2, $posy - 5); $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("Recipient").":", 0, 'L'); $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre); // Show recipient name - $pdf->SetXY($posx+2, $posy+3); + $pdf->SetXY($posx + 2, $posy + 3); $pdf->SetFont('', 'B', $default_font_size); $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0, 'L'); @@ -1049,7 +1049,7 @@ class pdf_espadon extends ModelePdfExpedition // Show recipient information $pdf->SetFont('', '', $default_font_size - 1); - $pdf->SetXY($posx+2, $posy); + $pdf->SetXY($posx + 2, $posy); $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); } diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 3936dccae95..71295335460 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -135,41 +135,41 @@ class pdf_standard extends ModeleExpenseReport // Page size for A4 format $this->type = 'pdf'; - $formatarray=pdf_getFormat(); + $formatarray = pdf_getFormat(); $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; - $this->format = array($this->page_largeur,$this->page_hauteur); - $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; - $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; - $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; - $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; + $this->format = array($this->page_largeur, $this->page_hauteur); + $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; + $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; + $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; + $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; - $this->option_logo = 1; // Affiche logo - $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION - $this->option_modereg = 1; // Affiche mode reglement - $this->option_condreg = 1; // Affiche conditions reglement - $this->option_codeproduitservice = 1; // Affiche code produit-service - $this->option_multilang = 1; // Dispo en plusieurs langues - $this->option_escompte = 0; // Affiche si il y a eu escompte - $this->option_credit_note = 0; // Support credit notes - $this->option_freetext = 1; // Support add of a personalised text - $this->option_draft_watermark = 1; // Support add of a watermark on drafts + $this->option_logo = 1; // Affiche logo + $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION + $this->option_modereg = 1; // Affiche mode reglement + $this->option_condreg = 1; // Affiche conditions reglement + $this->option_codeproduitservice = 1; // Affiche code produit-service + $this->option_multilang = 1; // Dispo en plusieurs langues + $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_credit_note = 0; // Support credit notes + $this->option_freetext = 1; // Support add of a personalised text + $this->option_draft_watermark = 1; // Support add of a watermark on drafts // Get source company - $this->emetteur=$mysoc; + $this->emetteur = $mysoc; - if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default, if was not defined + if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined // Define position of columns - $this->posxpiece=$this->marge_gauche+1; - $this->posxcomment=$this->marge_gauche+10; + $this->posxpiece = $this->marge_gauche + 1; + $this->posxcomment = $this->marge_gauche + 10; //$this->posxdate=88; //$this->posxtype=107; //$this->posxprojet=120; - $this->posxtva=130; - $this->posxup=145; - $this->posxqty=168; - $this->postotalttc=178; + $this->posxtva = 130; + $this->posxup = 145; + $this->posxqty = 168; + $this->postotalttc = 178; // if (empty($conf->projet->enabled)) { // $this->posxtva-=20; // $this->posxup-=20; @@ -287,40 +287,40 @@ class pdf_standard extends ModeleExpenseReport $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Trips")); - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); - $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right // New page $pdf->AddPage(); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; $this->_pagehead($pdf, $object, 1, $outputlangs); $pdf->SetFont('', '', $default_font_size - 1); - $pdf->MultiCell(0, 3, ''); // Set interline to 3 + $pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->SetTextColor(0, 0, 0); $tab_top = 95; - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?65:10); + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 65 : 10); $tab_height = 130; $tab_height_newpage = 150; // Show notes - $notetoshow=empty($object->note_public)?'':$object->note_public; - if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) + $notetoshow = empty($object->note_public) ? '' : $object->note_public; + if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) { // Get first sale rep if (is_object($object->thirdparty)) { - $salereparray=$object->thirdparty->getSalesRepresentatives($user); - $salerepobj=new User($this->db); + $salereparray = $object->thirdparty->getSalesRepresentatives($user); + $salerepobj = new User($this->db); $salerepobj->fetch($salereparray[0]['id']); - if (! empty($salerepobj->signature)) $notetoshow=dol_concatdesc($notetoshow, $salerepobj->signature); + if (!empty($salerepobj->signature)) $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature); } } if ($notetoshow) { - $substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object); + $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object); $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs); $notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow); @@ -328,20 +328,20 @@ class pdf_standard extends ModeleExpenseReport $tab_top = 95; $pdf->SetFont('', '', $default_font_size - 1); - $pdf->writeHTMLCell(190, 3, $this->posxpiece-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); + $pdf->writeHTMLCell(190, 3, $this->posxpiece - 1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); $nexY = $pdf->GetY(); - $height_note=$nexY-$tab_top; + $height_note = $nexY - $tab_top; // Rect takes a length in 3rd parameter $pdf->SetDrawColor(192, 192, 192); - $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1); + $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); $tab_height = $tab_height - $height_note; - $tab_top = $nexY+6; + $tab_top = $nexY + 6; } else { - $height_note=0; + $height_note = 0; } $iniY = $tab_top + 7; @@ -349,41 +349,41 @@ class pdf_standard extends ModeleExpenseReport $nexY = $tab_top + 7; // Loop on each lines - for ($i = 0 ; $i < $nblines ; $i++) { - $pdf->SetFont('', '', $default_font_size - 2); // Into loop to work with multipage + for ($i = 0; $i < $nblines; $i++) { + $pdf->SetFont('', '', $default_font_size - 2); // Into loop to work with multipage $pdf->SetTextColor(0, 0, 0); $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore = $pdf->getPage(); $curY = $nexY; $pdf->startTransaction(); $this->printLine($pdf, $object, $i, $curY, $default_font_size, $outputlangs, $hidedetails); - $pageposafter=$pdf->getPage(); + $pageposafter = $pdf->getPage(); if ($pageposafter > $pageposbefore) { // There is a pagebreak $pdf->rollbackTransaction(true); $pageposafter = $pageposbefore; //print $pageposafter.'-'.$pageposbefore;exit; - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $this->printLine($pdf, $object, $i, $curY, $default_font_size, $outputlangs, $hidedetails); $pageposafter = $pdf->getPage(); $posyafter = $pdf->GetY(); //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; - if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) { + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text - if ($i == ($nblines-1)) { + if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page $pdf->AddPage('', '', true); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - $pdf->setPage($pageposafter+1); + $pdf->setPage($pageposafter + 1); } } else { // We found a page break - $showpricebeforepagebreak=0; + $showpricebeforepagebreak = 0; } } else // No pagebreak @@ -413,7 +413,7 @@ class pdf_standard extends ModeleExpenseReport // } //$nexY+=$nblineFollowComment*($pdf->getFontSize()*1.3); // Add space between lines - $nexY += ($pdf->getFontSize()*1.3); // Add space between lines + $nexY += ($pdf->getFontSize() * 1.3); // Add space between lines // Detect if some page were added automatically and output _tableau for past pages while ($pagenb < $pageposafter) @@ -509,31 +509,31 @@ class pdf_standard extends ModeleExpenseReport // Add pdfgeneration hook $hookmanager->initHooks(array('pdfgeneration')); - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); global $action; - $reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; } - if (! empty($conf->global->MAIN_UMASK)) + if (!empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); $this->result = array('fullpath'=>$file); - return 1; // No error + return 1; // No error } else { - $this->error=$langs->trans("ErrorCanNotCreateDir", $dir); + $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); return 0; } } else { - $this->error=$langs->trans("ErrorConstantNotDefined", "EXPENSEREPORT_OUTPUTDIR"); + $this->error = $langs->trans("ErrorConstantNotDefined", "EXPENSEREPORT_OUTPUTDIR"); return 0; } } @@ -592,30 +592,30 @@ class pdf_standard extends ModeleExpenseReport if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { $vat_rate = pdf_getlinevatrate($object, $linenumber, $outputlangs, $hidedetails); $pdf->SetXY($this->posxtva, $curY); - $pdf->MultiCell($this->posxup-$this->posxtva-0.8, 4, $vat_rate, 0, 'R'); + $pdf->MultiCell($this->posxup - $this->posxtva - 0.8, 4, $vat_rate, 0, 'R'); } // Unit price $pdf->SetXY($this->posxup, $curY); - $pdf->MultiCell($this->posxqty-$this->posxup-0.8, 4, price($object->lines[$linenumber]->value_unit), 0, 'R'); + $pdf->MultiCell($this->posxqty - $this->posxup - 0.8, 4, price($object->lines[$linenumber]->value_unit), 0, 'R'); // Quantity $pdf->SetXY($this->posxqty, $curY); - $pdf->MultiCell($this->postotalttc-$this->posxqty-0.8, 4, $object->lines[$linenumber]->qty, 0, 'R'); + $pdf->MultiCell($this->postotalttc - $this->posxqty - 0.8, 4, $object->lines[$linenumber]->qty, 0, 'R'); // Total with all taxes - $pdf->SetXY($this->postotalttc-1, $curY); - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 4, price($object->lines[$linenumber]->total_ttc), 0, 'R'); + $pdf->SetXY($this->postotalttc - 1, $curY); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalttc, 4, price($object->lines[$linenumber]->total_ttc), 0, 'R'); // Comments $pdf->SetXY($this->posxcomment, $curY); - $comment = $outputlangs->trans("Date").':'. dol_print_date($object->lines[$linenumber]->date, "day", false, $outputlangs).' '; - $comment .= $outputlangs->trans("Type").':'. $expensereporttypecodetoshow.'
'; - if (! empty($object->lines[$linenumber]->projet_ref)) { - $comment .= $outputlangs->trans("Project").':'. $object->lines[$linenumber]->projet_ref.'
'; + $comment = $outputlangs->trans("Date").':'.dol_print_date($object->lines[$linenumber]->date, "day", false, $outputlangs).' '; + $comment .= $outputlangs->trans("Type").':'.$expensereporttypecodetoshow.'
'; + if (!empty($object->lines[$linenumber]->projet_ref)) { + $comment .= $outputlangs->trans("Project").':'.$object->lines[$linenumber]->projet_ref.'
'; } $comment .= $object->lines[$linenumber]->comments; - $pdf->writeHTMLCell($this->posxtva-$this->posxcomment-0.8, 4, $this->posxcomment-1, $curY, $comment, 0, 1); + $pdf->writeHTMLCell($this->posxtva - $this->posxcomment - 0.8, 4, $this->posxcomment - 1, $curY, $comment, 0, 1); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore @@ -751,96 +751,96 @@ class pdf_standard extends ModeleExpenseReport // Show sender information if (empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) { - $pdf->SetXY($posx+2, $posy+3); + $pdf->SetXY($posx + 2, $posy + 3); $pdf->SetFont('', 'B', $default_font_size); $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); - $pdf->SetXY($posx+2, $posy+8); + $pdf->SetXY($posx + 2, $posy + 8); $pdf->SetFont('', '', $default_font_size - 1); $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); } else { - $pdf->SetXY($posx+2, $posy+3); + $pdf->SetXY($posx + 2, $posy + 3); $pdf->SetFont('', 'B', $default_font_size); $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset(dolGetFirstLastname($receiver->firstname, $receiver->lastname)), 0, 'L'); - $pdf->SetXY($posx+2, $posy+8); + $pdf->SetXY($posx + 2, $posy + 8); $pdf->SetFont('', '', $default_font_size - 1); $pdf->MultiCell(80, 4, $expense_receiver, 0, 'L'); } // Show recipient - $posy=50; - $posx=100; - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; + $posy = 50; + $posx = 100; + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche; // Show recipient frame $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('', 'B', 8); - $pdf->SetXY($posx, $posy-5); + $pdf->SetXY($posx, $posy - 5); $pdf->MultiCell(80, 5, $outputlangs->transnoentities("TripNDF")." :", 0, 'L'); $pdf->rect($posx, $posy, $this->page_largeur - $this->marge_gauche - $posx, $hautcadre); // Informations for trip (dates and users workflow) if ($object->fk_user_author > 0) { - $userfee=new User($this->db); + $userfee = new User($this->db); $userfee->fetch($object->fk_user_author); - $posy+=3; - $pdf->SetXY($posx+2, $posy); + $posy += 3; + $pdf->SetXY($posx + 2, $posy); $pdf->SetFont('', '', 10); $pdf->MultiCell(96, 4, $outputlangs->transnoentities("AUTHOR")." : ".dolGetFirstLastname($userfee->firstname, $userfee->lastname), 0, 'L'); - $posy+=5; - $pdf->SetXY($posx+2, $posy); + $posy += 5; + $pdf->SetXY($posx + 2, $posy); $pdf->MultiCell(96, 4, $outputlangs->transnoentities("DateCreation")." : ".dol_print_date($object->date_create, "day", false, $outputlangs), 0, 'L'); } - if ($object->fk_statut==99) { + if ($object->fk_statut == 99) { if ($object->fk_user_refuse > 0) { - $userfee=new User($this->db); - $userfee->fetch($object->fk_user_refuse); $posy+=6; - $pdf->SetXY($posx+2, $posy); + $userfee = new User($this->db); + $userfee->fetch($object->fk_user_refuse); $posy += 6; + $pdf->SetXY($posx + 2, $posy); $pdf->MultiCell(96, 4, $outputlangs->transnoentities("REFUSEUR")." : ".dolGetFirstLastname($userfee->firstname, $userfee->lastname), 0, 'L'); - $posy+=5; - $pdf->SetXY($posx+2, $posy); + $posy += 5; + $pdf->SetXY($posx + 2, $posy); $pdf->MultiCell(96, 4, $outputlangs->transnoentities("MOTIF_REFUS")." : ".$outputlangs->convToOutputCharset($object->detail_refuse), 0, 'L'); - $posy+=5; - $pdf->SetXY($posx+2, $posy); + $posy += 5; + $pdf->SetXY($posx + 2, $posy); $pdf->MultiCell(96, 4, $outputlangs->transnoentities("DATE_REFUS")." : ".dol_print_date($object->date_refuse, "day", false, $outputlangs), 0, 'L'); } } - elseif($object->fk_statut==4) + elseif ($object->fk_statut == 4) { if ($object->fk_user_cancel > 0) { - $userfee=new User($this->db); - $userfee->fetch($object->fk_user_cancel); $posy+=6; - $pdf->SetXY($posx+2, $posy); + $userfee = new User($this->db); + $userfee->fetch($object->fk_user_cancel); $posy += 6; + $pdf->SetXY($posx + 2, $posy); $pdf->MultiCell(96, 4, $outputlangs->transnoentities("CANCEL_USER")." : ".dolGetFirstLastname($userfee->firstname, $userfee->lastname), 0, 'L'); - $posy+=5; - $pdf->SetXY($posx+2, $posy); + $posy += 5; + $pdf->SetXY($posx + 2, $posy); $pdf->MultiCell(96, 4, $outputlangs->transnoentities("MOTIF_CANCEL")." : ".$outputlangs->convToOutputCharset($object->detail_cancel), 0, 'L'); - $posy+=5; - $pdf->SetXY($posx+2, $posy); + $posy += 5; + $pdf->SetXY($posx + 2, $posy); $pdf->MultiCell(96, 4, $outputlangs->transnoentities("DATE_CANCEL")." : ".dol_print_date($object->date_cancel, "day", false, $outputlangs), 0, 'L'); } } else { if ($object->fk_user_approve > 0) { - $userfee=new User($this->db); - $userfee->fetch($object->fk_user_approve); $posy+=6; - $pdf->SetXY($posx+2, $posy); + $userfee = new User($this->db); + $userfee->fetch($object->fk_user_approve); $posy += 6; + $pdf->SetXY($posx + 2, $posy); $pdf->MultiCell(96, 4, $outputlangs->transnoentities("VALIDOR")." : ".dolGetFirstLastname($userfee->firstname, $userfee->lastname), 0, 'L'); - $posy+=5; - $pdf->SetXY($posx+2, $posy); + $posy += 5; + $pdf->SetXY($posx + 2, $posy); $pdf->MultiCell(96, 4, $outputlangs->transnoentities("DateApprove")." : ".dol_print_date($object->date_approve, "day", false, $outputlangs), 0, 'L'); } } - if($object->fk_statut==6) { + if ($object->fk_statut == 6) { if ($object->fk_user_paid > 0) { - $userfee=new User($this->db); - $userfee->fetch($object->fk_user_paid); $posy+=6; - $pdf->SetXY($posx+2, $posy); + $userfee = new User($this->db); + $userfee->fetch($object->fk_user_paid); $posy += 6; + $pdf->SetXY($posx + 2, $posy); $pdf->MultiCell(96, 4, $outputlangs->transnoentities("AUTHORPAIEMENT")." : ".dolGetFirstLastname($userfee->firstname, $userfee->lastname), 0, 'L'); - $posy+=5; - $pdf->SetXY($posx+2, $posy); + $posy += 5; + $pdf->SetXY($posx + 2, $posy); $pdf->MultiCell(96, 4, $outputlangs->transnoentities("DATE_PAIEMENT")." : ".dol_print_date($object->date_paiement, "day", false, $outputlangs), 0, 'L'); } } @@ -876,31 +876,31 @@ class pdf_standard extends ModeleExpenseReport $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('', '', $default_font_size - 2); $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency)); - $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 4), $tab_top -4); + $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 4), $tab_top - 4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); $pdf->SetDrawColor(128, 128, 128); // Rect takes a length in 3rd parameter - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height); + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height); // line prend une position y en 3eme param if (empty($hidetop)) { - $pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); + $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5); } $pdf->SetFont('', '', 8); // Accountancy piece if (empty($hidetop)) { - $pdf->SetXY($this->posxpiece-1, $tab_top+1); - $pdf->MultiCell($this->posxcomment-$this->posxpiece-1, 1, '', '', 'R'); + $pdf->SetXY($this->posxpiece - 1, $tab_top + 1); + $pdf->MultiCell($this->posxcomment - $this->posxpiece - 1, 1, '', '', 'R'); } // Comments - $pdf->line($this->posxcomment-1, $tab_top, $this->posxcomment-1, $tab_top + $tab_height); + $pdf->line($this->posxcomment - 1, $tab_top, $this->posxcomment - 1, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posxcomment-1, $tab_top+1); - $pdf->MultiCell($this->posxdate-$this->posxcomment-1, 1, $outputlangs->transnoentities("Description"), '', 'L'); + $pdf->SetXY($this->posxcomment - 1, $tab_top + 1); + $pdf->MultiCell($this->posxdate - $this->posxcomment - 1, 1, $outputlangs->transnoentities("Description"), '', 'L'); } // Date @@ -931,32 +931,32 @@ class pdf_standard extends ModeleExpenseReport // VAT if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { - $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); + $pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posxtva-1, $tab_top+1); - $pdf->MultiCell($this->posxup-$this->posxtva - 1, 2, $outputlangs->transnoentities("VAT"), '', 'C'); + $pdf->SetXY($this->posxtva - 1, $tab_top + 1); + $pdf->MultiCell($this->posxup - $this->posxtva - 1, 2, $outputlangs->transnoentities("VAT"), '', 'C'); } } // Unit price - $pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height); + $pdf->line($this->posxup - 1, $tab_top, $this->posxup - 1, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posxup-1, $tab_top+1); - $pdf->MultiCell($this->posxqty-$this->posxup-1, 2, $outputlangs->transnoentities("PriceU"), '', 'C'); + $pdf->SetXY($this->posxup - 1, $tab_top + 1); + $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceU"), '', 'C'); } // Quantity - $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); + $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posxqty-1, $tab_top+1); - $pdf->MultiCell($this->postotalttc-$this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C'); + $pdf->SetXY($this->posxqty - 1, $tab_top + 1); + $pdf->MultiCell($this->postotalttc - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C'); } // Total with all taxes $pdf->line($this->postotalttc, $tab_top, $this->postotalttc, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->postotalttc-1, $tab_top+1); - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 2, $outputlangs->transnoentities("TotalTTC"), '', 'R'); + $pdf->SetXY($this->postotalttc - 1, $tab_top + 1); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalttc, 2, $outputlangs->transnoentities("TotalTTC"), '', 'R'); } $pdf->SetTextColor(0, 0, 0); @@ -983,94 +983,94 @@ class pdf_standard extends ModeleExpenseReport $default_font_size = pdf_getPDFFontSize($outputlangs); - $title=$outputlangs->transnoentities("PaymentsAlreadyDone"); + $title = $outputlangs->transnoentities("PaymentsAlreadyDone"); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($tab3_posx, $tab3_top - 4); $pdf->SetTextColor(0, 0, 0); $pdf->MultiCell(60, 3, $title, 0, 'L', 0); - $pdf->line($tab3_posx, $tab3_top, $tab3_posx+$tab3_width+2, $tab3_top); // Top border line of table title + $pdf->line($tab3_posx, $tab3_top, $tab3_posx + $tab3_width + 2, $tab3_top); // Top border line of table title - $pdf->SetXY($tab3_posx, $tab3_top+1); + $pdf->SetXY($tab3_posx, $tab3_top + 1); $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Date"), 0, 'L', 0); - $pdf->SetXY($tab3_posx+19, $tab3_top+1); // Old value 17 + $pdf->SetXY($tab3_posx + 19, $tab3_top + 1); // Old value 17 $pdf->MultiCell(15, 3, $outputlangs->transnoentities("Amount"), 0, 'C', 0); - $pdf->SetXY($tab3_posx+35, $tab3_top+1); + $pdf->SetXY($tab3_posx + 35, $tab3_top + 1); $pdf->MultiCell(30, 3, $outputlangs->transnoentities("Type"), 0, 'L', 0); - if (! empty($conf->banque->enabled)) { - $pdf->SetXY($tab3_posx+65, $tab3_top+1); + if (!empty($conf->banque->enabled)) { + $pdf->SetXY($tab3_posx + 65, $tab3_top + 1); $pdf->MultiCell(25, 3, $outputlangs->transnoentities("BankAccount"), 0, 'L', 0); } - $pdf->line($tab3_posx, $tab3_top+$tab3_height, $tab3_posx+$tab3_width+2, $tab3_top+$tab3_height); // Bottom border line of table title + $pdf->line($tab3_posx, $tab3_top + $tab3_height, $tab3_posx + $tab3_width + 2, $tab3_top + $tab3_height); // Bottom border line of table title - $y=0; + $y = 0; // Loop on each payment // TODO create method on expensereport class to get payments // Payments already done (from payment on this expensereport) $sql = "SELECT p.rowid, p.num_payment, p.datep as dp, p.amount, p.fk_bank,"; - $sql.= "c.code as p_code, c.libelle as payment_type,"; - $sql.= "ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal"; - $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as e, ".MAIN_DB_PREFIX."payment_expensereport as p"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepayment = c.id"; - $sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank as b ON p.fk_bank = b.rowid'; - $sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank_account as ba ON b.fk_account = ba.rowid'; - $sql.= " WHERE e.rowid = '".$object->id."'"; - $sql.= " AND p.fk_expensereport = e.rowid"; - $sql.= ' AND e.entity IN ('.getEntity('expensereport').')'; - $sql.= " ORDER BY dp"; + $sql .= "c.code as p_code, c.libelle as payment_type,"; + $sql .= "ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal"; + $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as e, ".MAIN_DB_PREFIX."payment_expensereport as p"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepayment = c.id"; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid'; + $sql .= " WHERE e.rowid = '".$object->id."'"; + $sql .= " AND p.fk_expensereport = e.rowid"; + $sql .= ' AND e.entity IN ('.getEntity('expensereport').')'; + $sql .= " ORDER BY dp"; - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); $totalpaid = 0; - $i=0; + $i = 0; while ($i < $num) { - $y+=$tab3_height; + $y += $tab3_height; $row = $this->db->fetch_object($resql); - $pdf->SetXY($tab3_posx, $tab3_top+$y+1); + $pdf->SetXY($tab3_posx, $tab3_top + $y + 1); $pdf->MultiCell(20, 3, dol_print_date($this->db->jdate($row->dp), 'day', false, $outputlangs, true), 0, 'L', 0); - $pdf->SetXY($tab3_posx+17, $tab3_top+$y+1); + $pdf->SetXY($tab3_posx + 17, $tab3_top + $y + 1); $pdf->MultiCell(15, 3, price($sign * $row->amount, 0, $outputlangs), 0, 'R', 0); - $pdf->SetXY($tab3_posx+35, $tab3_top+$y+1); - $oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort" . $row->p_code); + $pdf->SetXY($tab3_posx + 35, $tab3_top + $y + 1); + $oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort".$row->p_code); $pdf->MultiCell(40, 3, $oper, 0, 'L', 0); - if (! empty($conf->banque->enabled)) { - $pdf->SetXY($tab3_posx+65, $tab3_top+$y+1); + if (!empty($conf->banque->enabled)) { + $pdf->SetXY($tab3_posx + 65, $tab3_top + $y + 1); $pdf->MultiCell(30, 3, $row->baref, 0, 'L', 0); } - $pdf->line($tab3_posx, $tab3_top+$y+$tab3_height, $tab3_posx+$tab3_width+2, $tab3_top+$y+$tab3_height); // Bottom line border of table + $pdf->line($tab3_posx, $tab3_top + $y + $tab3_height, $tab3_posx + $tab3_width + 2, $tab3_top + $y + $tab3_height); // Bottom line border of table $totalpaid += $row->amount; $i++; } if ($num > 0 && $object->paid == 0) { - $y+=$tab3_height; + $y += $tab3_height; - $pdf->SetXY($tab3_posx+17, $tab3_top+$y); + $pdf->SetXY($tab3_posx + 17, $tab3_top + $y); $pdf->MultiCell(15, 3, price($totalpaid), 0, 'R', 0); - $pdf->SetXY($tab3_posx+35, $tab3_top+$y); + $pdf->SetXY($tab3_posx + 35, $tab3_top + $y); $pdf->MultiCell(30, 4, $outputlangs->transnoentitiesnoconv("AlreadyPaid"), 0, 'L', 0); - $y+=$tab3_height-2; - $pdf->SetXY($tab3_posx+17, $tab3_top+$y); + $y += $tab3_height - 2; + $pdf->SetXY($tab3_posx + 17, $tab3_top + $y); $pdf->MultiCell(15, 3, price($object->total_ttc), 0, 'R', 0); - $pdf->SetXY($tab3_posx+35, $tab3_top+$y); + $pdf->SetXY($tab3_posx + 35, $tab3_top + $y); $pdf->MultiCell(30, 4, $outputlangs->transnoentitiesnoconv("AmountExpected"), 0, 'L', 0); - $y+=$tab3_height-2; + $y += $tab3_height - 2; $remaintopay = $object->total_ttc - $totalpaid; - $pdf->SetXY($tab3_posx+17, $tab3_top+$y); + $pdf->SetXY($tab3_posx + 17, $tab3_top + $y); $pdf->MultiCell(15, 3, price($remaintopay), 0, 'R', 0); - $pdf->SetXY($tab3_posx+35, $tab3_top+$y); + $pdf->SetXY($tab3_posx + 35, $tab3_top + $y); $pdf->MultiCell(30, 4, $outputlangs->transnoentitiesnoconv("RemainderToPay"), 0, 'L', 0); } } else { - $this->error=$this->db->lasterror(); + $this->error = $this->db->lasterror(); return -1; } } diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 50a4a4e6a0a..603ffbbd3d6 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1632,7 +1632,7 @@ class pdf_crabe extends ModelePDFFactures if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; - if (! empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index efe009bbafc..1c59a9839b3 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -147,48 +147,48 @@ class pdf_sponge extends ModelePDFFactures $this->db = $db; $this->name = "sponge"; $this->description = $langs->trans('PDFSpongeDescription'); - $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template + $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template // Dimension page $this->type = 'pdf'; - $formatarray=pdf_getFormat(); + $formatarray = pdf_getFormat(); $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; - $this->format = array($this->page_largeur,$this->page_hauteur); - $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; - $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; - $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; - $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; + $this->format = array($this->page_largeur, $this->page_hauteur); + $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; + $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; + $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; + $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; - $this->option_logo = 1; // Display logo - $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION - $this->option_modereg = 1; // Display payment mode - $this->option_condreg = 1; // Display payment terms - $this->option_codeproduitservice = 1; // Display product-service code - $this->option_multilang = 1; // Available in several languages - $this->option_escompte = 1; // Displays if there has been a discount - $this->option_credit_note = 1; // Support credit notes - $this->option_freetext = 1; // Support add of a personalised text - $this->option_draft_watermark = 1; // Support add of a watermark on drafts + $this->option_logo = 1; // Display logo + $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION + $this->option_modereg = 1; // Display payment mode + $this->option_condreg = 1; // Display payment terms + $this->option_codeproduitservice = 1; // Display product-service code + $this->option_multilang = 1; // Available in several languages + $this->option_escompte = 1; // Displays if there has been a discount + $this->option_credit_note = 1; // Support credit notes + $this->option_freetext = 1; // Support add of a personalised text + $this->option_draft_watermark = 1; // Support add of a watermark on drafts // Get source company - $this->emetteur=$mysoc; - if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default, if was not defined + $this->emetteur = $mysoc; + if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined // Define position of columns - $this->posxdesc=$this->marge_gauche+1; // used for notes ans other stuff + $this->posxdesc = $this->marge_gauche + 1; // used for notes ans other stuff $this->tabTitleHeight = 5; // default height // Use new system for position of columns, view $this->defineColumnField() - $this->tva=array(); - $this->localtax1=array(); - $this->localtax2=array(); - $this->atleastoneratenotnull=0; - $this->atleastonediscount=0; - $this->situationinvoice=false; + $this->tva = array(); + $this->localtax1 = array(); + $this->localtax2 = array(); + $this->atleastoneratenotnull = 0; + $this->atleastonediscount = 0; + $this->situationinvoice = false; } @@ -211,14 +211,14 @@ class pdf_sponge extends ModelePDFFactures dol_syslog("write_file outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang : 'null')); - if (! is_object($outputlangs)) $outputlangs=$langs; + if (!is_object($outputlangs)) $outputlangs = $langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO - if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; + if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; // Load translation files required by the page $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies")); - if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) { + if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) { global $outputlangsbis; $outputlangsbis = new Translate('', $conf); $outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE); @@ -227,39 +227,39 @@ class pdf_sponge extends ModelePDFFactures $nblines = count($object->lines); - $hidetop=0; - if(!empty($conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE)){ - $hidetop=$conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE; + $hidetop = 0; + if (!empty($conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE)) { + $hidetop = $conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE; } // Loop on each lines to detect if there is at least one image to show - $realpatharray=array(); + $realpatharray = array(); $this->atleastonephoto = false; - if (! empty($conf->global->MAIN_GENERATE_INVOICES_WITH_PICTURE)) + if (!empty($conf->global->MAIN_GENERATE_INVOICES_WITH_PICTURE)) { $objphoto = new Product($this->db); - for ($i = 0 ; $i < $nblines ; $i++) + for ($i = 0; $i < $nblines; $i++) { if (empty($object->lines[$i]->fk_product)) continue; $objphoto->fetch($object->lines[$i]->fk_product); //var_dump($objphoto->ref);exit; - if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) + if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { - $pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product') . $objphoto->id ."/photos/"; - $pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product') . dol_sanitizeFileName($objphoto->ref).'/'; + $pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; + $pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; } else { - $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product') . dol_sanitizeFileName($objphoto->ref).'/'; // default - $pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product') . $objphoto->id ."/photos/"; // alternative + $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; // default + $pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative } $arephoto = false; foreach ($pdir as $midir) { - if (! $arephoto) + if (!$arephoto) { $dir = $conf->product->dir_output.'/'.$midir; @@ -326,28 +326,28 @@ class pdf_sponge extends ModelePDFFactures if (file_exists($dir)) { // Add pdfgeneration hook - if (! is_object($hookmanager)) + if (!is_object($hookmanager)) { include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager=new HookManager($this->db); + $hookmanager = new HookManager($this->db); } $hookmanager->initHooks(array('pdfgeneration')); - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); global $action; - $reshook=$hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks + $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks // Set nblines with the new facture lines content after hook $nblines = count($object->lines); $nbpayments = count($object->getListOfPayments()); // Create pdf instance - $pdf=pdf_getInstance($this->format); - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance + $pdf = pdf_getInstance($this->format); + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance $pdf->SetAutoPageBreak(1, 0); - $heightforinfotot = 50+(4*$nbpayments); // Height reserved to output the info and total part and payment part - $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page - $heightforfooter = $this->marge_basse + (empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 12 : 22); // Height reserved to output the footer (value include bottom margin) + $heightforinfotot = 50 + (4 * $nbpayments); // Height reserved to output the info and total part and payment part + $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + (empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 12 : 22); // Height reserved to output the footer (value include bottom margin) if (class_exists('TCPDF')) { @@ -357,14 +357,14 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetFont(pdf_getPDFFont($outputlangs)); // Set path to the background PDF File - if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) + if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) { $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); $tplidx = $pdf->importPage(1); } $pdf->Open(); - $pagenb=0; + $pagenb = 0; $pdf->SetDrawColor(128, 128, 128); $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); @@ -372,9 +372,9 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfInvoiceTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); - $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right // Does we have at least one line with discount $this->atleastonediscount foreach ($object->lines as $line) { @@ -417,30 +417,30 @@ class pdf_sponge extends ModelePDFFactures $tab_top -= 2; $pdf->SetFont('', '', $default_font_size - 1); - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($desc_incoterms), 0, 1); $nexY = max($pdf->GetY(), $nexY); - $height_incoterms=$nexY-$tab_top; + $height_incoterms = $nexY - $tab_top; // Rect takes a length in 3rd parameter $pdf->SetDrawColor(192, 192, 192); - $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1); + $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1); - $tab_top = $nexY+6; + $tab_top = $nexY + 6; $height_incoterms += 4; } } // Display notes - $notetoshow=empty($object->note_public)?'':$object->note_public; - if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) + $notetoshow = empty($object->note_public) ? '' : $object->note_public; + if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) { // Get first sale rep if (is_object($object->thirdparty)) { - $salereparray=$object->thirdparty->getSalesRepresentatives($user); - $salerepobj=new User($this->db); + $salereparray = $object->thirdparty->getSalesRepresentatives($user); + $salerepobj = new User($this->db); $salerepobj->fetch($salereparray[0]['id']); - if (! empty($salerepobj->signature)) $notetoshow=dol_concatdesc($notetoshow, $salerepobj->signature); + if (!empty($salerepobj->signature)) $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature); } } @@ -577,44 +577,44 @@ class pdf_sponge extends ModelePDFFactures $nexY = $tab_top + $this->tabTitleHeight + 2; // Loop on each lines - $pageposbeforeprintlines=$pdf->getPage(); + $pageposbeforeprintlines = $pdf->getPage(); $pagenb = $pageposbeforeprintlines; for ($i = 0; $i < $nblines; $i++) { $curY = $nexY; - $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage + $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage $pdf->SetTextColor(0, 0, 0); // Define size of image if we need it - $imglinesize=array(); - if (! empty($realpatharray[$i])) $imglinesize=pdf_getSizeForImage($realpatharray[$i]); + $imglinesize = array(); + if (!empty($realpatharray[$i])) $imglinesize = pdf_getSizeForImage($realpatharray[$i]); $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. - $pageposbefore=$pdf->getPage(); + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pageposbefore = $pdf->getPage(); - $showpricebeforepagebreak=1; - $posYAfterImage=0; - $posYAfterDescription=0; + $showpricebeforepagebreak = 1; + $posYAfterImage = 0; + $posYAfterDescription = 0; - if($this->getColumnStatus('photo')) + if ($this->getColumnStatus('photo')) { // We start with Photo of product line - if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur-($heightforfooter+$heightforfreetext+$heightforinfotot))) // If photo too high, we moved completely on new page + if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // If photo too high, we moved completely on new page { $pdf->AddPage('', '', true); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); - $pdf->setPage($pageposbefore+1); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); + $pdf->setPage($pageposbefore + 1); $curY = $tab_top_newpage; - $showpricebeforepagebreak=0; + $showpricebeforepagebreak = 0; } if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) { - $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi + $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi // $pdf->Image does not increase value return by getY, so we save it manually - $posYAfterImage=$curY+$imglinesize['height']; + $posYAfterImage = $curY + $imglinesize['height']; } } @@ -623,51 +623,51 @@ class pdf_sponge extends ModelePDFFactures { $pdf->startTransaction(); pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc); - $pageposafter=$pdf->getPage(); + $pageposafter = $pdf->getPage(); if ($pageposafter > $pageposbefore) // There is a pagebreak { $pdf->rollbackTransaction(true); - $pageposafter=$pageposbefore; + $pageposafter = $pageposbefore; //print $pageposafter.'-'.$pageposbefore;exit; - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc); - $pageposafter=$pdf->getPage(); - $posyafter=$pdf->GetY(); + $pageposafter = $pdf->getPage(); + $posyafter = $pdf->GetY(); //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; - if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text { - if ($i == ($nblines-1)) // No more lines, and no space left to show total, so we create a new page + if ($i == ($nblines - 1)) // No more lines, and no space left to show total, so we create a new page { $pdf->AddPage('', '', true); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); - $pdf->setPage($pageposafter+1); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); + $pdf->setPage($pageposafter + 1); } } else { // We found a page break - $showpricebeforepagebreak=0; + $showpricebeforepagebreak = 0; } } else // No pagebreak { $pdf->commitTransaction(); } - $posYAfterDescription=$pdf->GetY(); + $posYAfterDescription = $pdf->GetY(); } $nexY = $pdf->GetY(); - $pageposafter=$pdf->getPage(); + $pageposafter = $pdf->getPage(); $pdf->setPage($pageposbefore); $pdf->setTopMargin($this->marge_haute); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { $pdf->setPage($pageposafter); $curY = $tab_top_newpage; } - $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut + $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut // VAT Rate if ($this->getColumnStatus('vat')) @@ -749,56 +749,56 @@ class pdf_sponge extends ModelePDFFactures if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne = $sign * $object->lines[$i]->multicurrency_total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent; else $tvaligne = $sign * $object->lines[$i]->total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent; } else { - if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne= $sign * $object->lines[$i]->multicurrency_total_tva; - else $tvaligne= $sign * $object->lines[$i]->total_tva; + if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne = $sign * $object->lines[$i]->multicurrency_total_tva; + else $tvaligne = $sign * $object->lines[$i]->total_tva; } - $localtax1ligne=$object->lines[$i]->total_localtax1; - $localtax2ligne=$object->lines[$i]->total_localtax2; - $localtax1_rate=$object->lines[$i]->localtax1_tx; - $localtax2_rate=$object->lines[$i]->localtax2_tx; - $localtax1_type=$object->lines[$i]->localtax1_type; - $localtax2_type=$object->lines[$i]->localtax2_type; + $localtax1ligne = $object->lines[$i]->total_localtax1; + $localtax2ligne = $object->lines[$i]->total_localtax2; + $localtax1_rate = $object->lines[$i]->localtax1_tx; + $localtax2_rate = $object->lines[$i]->localtax2_tx; + $localtax1_type = $object->lines[$i]->localtax1_type; + $localtax2_type = $object->lines[$i]->localtax2_type; - if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100; - if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100; - if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100; + if ($object->remise_percent) $tvaligne -= ($tvaligne * $object->remise_percent) / 100; + if ($object->remise_percent) $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100; + if ($object->remise_percent) $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100; - $vatrate=(string) $object->lines[$i]->tva_tx; + $vatrate = (string) $object->lines[$i]->tva_tx; // Retrieve type from database for backward compatibility with old records - if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined - && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax + if ((!isset($localtax1_type) || $localtax1_type == '' || !isset($localtax2_type) || $localtax2_type == '') // if tax type not defined + && (!empty($localtax1_rate) || !empty($localtax2_rate))) // and there is local tax { - $localtaxtmp_array=getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc); + $localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc); $localtax1_type = $localtaxtmp_array[0]; $localtax2_type = $localtaxtmp_array[2]; } // retrieve global local tax if ($localtax1_type && $localtax1ligne != 0) { - $this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne; + $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne; } if ($localtax2_type && $localtax2ligne != 0) { - $this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne; + $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne; } - if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; - if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=0; + if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate .= '*'; + if (!isset($this->tva[$vatrate])) $this->tva[$vatrate] = 0; $this->tva[$vatrate] += $tvaligne; $nexY = max($nexY, $posYAfterImage); // Add line - if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) { + if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) { $pdf->setPage($pageposafter); - $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80))); + $pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80))); //$pdf->SetDrawColor(190,190,200); - $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); + $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1); $pdf->SetLineStyle(array('dash'=>0)); } - $nexY+=2; // Add space between lines + $nexY += 2; // Add space between lines // Detect if some page were added automatically and output _tableau for past pages while ($pagenb < $pageposafter) { @@ -813,11 +813,11 @@ class pdf_sponge extends ModelePDFFactures $this->_pagefoot($pdf, $object, $outputlangs, 1); $pagenb++; $pdf->setPage($pagenb); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); } - if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) { + if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { if ($pagenb == $pageposafter) { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code); } @@ -828,7 +828,7 @@ class pdf_sponge extends ModelePDFFactures $this->_pagefoot($pdf, $object, $outputlangs, 1); // New page $pdf->AddPage(); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); } @@ -838,24 +838,24 @@ class pdf_sponge extends ModelePDFFactures if ($pagenb == $pageposbeforeprintlines) { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code); - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } // Display infos area - $posy=$this->drawInfoTable($pdf, $object, $bottomlasttab, $outputlangs); + $posy = $this->drawInfoTable($pdf, $object, $bottomlasttab, $outputlangs); // Display total zone - $posy=$this->drawTotalTable($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); + $posy = $this->drawTotalTable($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); // Display payment area if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && empty($conf->global->INVOICE_NO_PAYMENT_DETAILS)) { - $posy=$this->drawPaymentsTable($pdf, $object, $posy, $outputlangs); + $posy = $this->drawPaymentsTable($pdf, $object, $posy, $outputlangs); } // Pagefoot @@ -1236,15 +1236,15 @@ class pdf_sponge extends ModelePDFFactures $col1x = 120; $col2x = 170; if ($this->page_largeur < 210) // To work with US executive format { - $col2x-=20; + $col2x -= 20; } $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x); - $useborder=0; + $useborder = 0; $index = 0; $outputlangsbis = null; - if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) { + if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) { $outputlangsbis = new Translate('', $conf); $outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE); $outputlangsbis->loadLangs(array("main", "dict", "companies", "bills", "products", "propal")); @@ -1252,18 +1252,18 @@ class pdf_sponge extends ModelePDFFactures // overall percentage of advancement $percent = 0; - $i=0; + $i = 0; foreach ($object->lines as $line) { - if(!class_exists('TSubtotal') || !TSubtotal::isModSubtotalLine($line)){ + if (!class_exists('TSubtotal') || !TSubtotal::isModSubtotalLine($line)) { $percent += $line->situation_percent; $i++; } } - if(!empty($i)){ - $avancementGlobal = $percent/$i; + if (!empty($i)) { + $avancementGlobal = $percent / $i; } - else{ + else { $avancementGlobal = 0; } @@ -1272,18 +1272,18 @@ class pdf_sponge extends ModelePDFFactures $total_a_payer = 0; $total_a_payer_ttc = 0; - foreach ($TPreviousIncoice as &$fac){ + foreach ($TPreviousIncoice as &$fac) { $total_a_payer += $fac->total_ht; $total_a_payer_ttc += $fac->total_ttc; } $total_a_payer += $object->total_ht; $total_a_payer_ttc += $object->total_ttc; - if(!empty($avancementGlobal)){ + if (!empty($avancementGlobal)) { $total_a_payer = $total_a_payer * 100 / $avancementGlobal; - $total_a_payer_ttc = $total_a_payer_ttc * 100 / $avancementGlobal; + $total_a_payer_ttc = $total_a_payer_ttc * 100 / $avancementGlobal; } - else{ + else { $total_a_payer = 0; $total_a_payer_ttc = 0; } @@ -1295,7 +1295,7 @@ class pdf_sponge extends ModelePDFFactures $posy = $pdf->GetY(); foreach ($TPreviousIncoice as &$fac) { - if($posy > $this->page_hauteur - 4 ) { + if ($posy > $this->page_hauteur - 4) { $this->_pagefoot($pdf, $object, $outputlangs, 1); $pdf->addPage(); $pdf->setY($this->marge_haute); @@ -1306,13 +1306,13 @@ class pdf_sponge extends ModelePDFFactures $index++; $pdf->SetFillColor(255, 255, 255); $pdf->SetXY($col1x, $posy); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $fac->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', 1); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $fac->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', 1); $pdf->SetXY($col2x, $posy); $facSign = ''; - if ($i>1) { - $facSign = $fac->total_ht>=0?'+':''; + if ($i > 1) { + $facSign = $fac->total_ht >= 0 ? '+' : ''; } $displayAmount = ' '.$facSign.' '.price($fac->total_ht, 0, $outputlangs); @@ -1329,12 +1329,12 @@ class pdf_sponge extends ModelePDFFactures // Display current total $pdf->SetFillColor(255, 255, 255); $pdf->SetXY($col1x, $posy); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $object->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', 1); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $object->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', 1); $pdf->SetXY($col2x, $posy); $facSign = ''; - if ($i>1) { - $facSign = $object->total_ht>=0?'+':''; // management of a particular customer case + if ($i > 1) { + $facSign = $object->total_ht >= 0 ? '+' : ''; // management of a particular customer case } if ($fac->type === facture::TYPE_CREDIT_NOTE) { @@ -1351,22 +1351,22 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetFont('', '', $default_font_size - 1); $pdf->SetFillColor(255, 255, 255); $pdf->SetXY($col1x, $posy); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("SituationTotalProgress", $avancementGlobal), 0, 'L', 1); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("SituationTotalProgress", $avancementGlobal), 0, 'L', 1); $pdf->SetXY($col2x, $posy); - $pdf->MultiCell($largcol2, $tab2_hl, price($total_a_payer*$avancementGlobal/100, 0, $outputlangs), 0, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($total_a_payer * $avancementGlobal / 100, 0, $outputlangs), 0, 'R', 1); $pdf->SetFont('', '', $default_font_size - 2); $posy += $tab2_hl; - if($posy > $this->page_hauteur - 4 ) { + if ($posy > $this->page_hauteur - 4) { $pdf->addPage(); $pdf->setY($this->marge_haute); $posy = $pdf->GetY(); } $tab2_top = $posy; - $index=0; + $index = 0; } $tab2_top += 3; @@ -1375,27 +1375,27 @@ class pdf_sponge extends ModelePDFFactures $total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); // Total remise - $total_line_remise=0; - foreach($object->lines as $i => $line) { - $total_line_remise+= pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this methode to core/lib/pdf.lib + $total_line_remise = 0; + foreach ($object->lines as $i => $line) { + $total_line_remise += pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this methode to core/lib/pdf.lib // Gestion remise sous forme de ligne négative - if($line->total_ht < 0) $total_line_remise += -$line->total_ht; + if ($line->total_ht < 0) $total_line_remise += -$line->total_ht; } - if($total_line_remise > 0) { - if (! empty($conf->global->MAIN_SHOW_AMOUNT_DISCOUNT)) { + if ($total_line_remise > 0) { + if (!empty($conf->global->MAIN_SHOW_AMOUNT_DISCOUNT)) { $pdf->SetFillColor(255, 255, 255); $pdf->SetXY($col1x, $tab2_top + $tab2_hl); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalDiscount") : ''), 0, 'L', 1); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalDiscount") : ''), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl); $pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise, 0, $outputlangs), 0, 'R', 1); $index++; } // Show total NET before discount - if (! empty($conf->global->MAIN_SHOW_AMOUNT_BEFORE_DISCOUNT)) { + if (!empty($conf->global->MAIN_SHOW_AMOUNT_BEFORE_DISCOUNT)) { $pdf->SetFillColor(255, 255, 255); $pdf->SetXY($col1x, $tab2_top + 0); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHTBeforeDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHTBeforeDiscount") : ''), 0, 'L', 1); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHTBeforeDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHTBeforeDiscount") : ''), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + 0); $pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise + $total_ht, 0, $outputlangs), 0, 'R', 1); @@ -1406,22 +1406,22 @@ class pdf_sponge extends ModelePDFFactures // Total HT $pdf->SetFillColor(255, 255, 255); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHT") : ''), 0, 'L', 1); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHT") : ''), 0, 'L', 1); $total_ht = (($conf->multicurrency->enabled && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($sign * ($total_ht + (! empty($object->remise)?$object->remise:0)), 0, $outputlangs), 0, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($sign * ($total_ht + (!empty($object->remise) ? $object->remise : 0)), 0, $outputlangs), 0, 'R', 1); // Show VAT by rates and total $pdf->SetFillColor(248, 248, 248); $total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; - $this->atleastoneratenotnull=0; + $this->atleastoneratenotnull = 0; if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { - $tvaisnull=((! empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false); - if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL) && $tvaisnull) + $tvaisnull = ((!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false); + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL) && $tvaisnull) { // Nothing to do } @@ -1432,30 +1432,30 @@ class pdf_sponge extends ModelePDFFactures //Local tax 1 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach ($this->localtax1 as $localtax_type => $localtax_rate) { if (in_array((string) $localtax_type, array('1', '3', '5'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + foreach ($localtax_rate as $tvakey => $tvaval) { - if ($tvakey!=0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT1", $mysoc->country_code) : ''); - $totalvat.=' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat .= ' '; + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); @@ -1466,29 +1466,29 @@ class pdf_sponge extends ModelePDFFactures //Local tax 2 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach ($this->localtax2 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('1','3','5'))) continue; + if (in_array((string) $localtax_type, array('1', '3', '5'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + foreach ($localtax_rate as $tvakey => $tvaval) { - if ($tvakey!=0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : ''); - $totalvat.=' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat .= ' '; + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); @@ -1501,12 +1501,12 @@ class pdf_sponge extends ModelePDFFactures // Situations totals migth be wrong on huge amounts if ($object->situation_cycle_ref && $object->situation_counter > 1) { $sum_pdf_tva = 0; - foreach($this->tva as $tvakey => $tvaval){ - $sum_pdf_tva+=$tvaval; // sum VAT amounts to compare to object + foreach ($this->tva as $tvakey => $tvaval) { + $sum_pdf_tva += $tvaval; // sum VAT amounts to compare to object } - if($sum_pdf_tva!=$object->total_tva) { // apply coef to recover the VAT object amount (the good one) - if(!empty($sum_pdf_tva)) + if ($sum_pdf_tva != $object->total_tva) { // apply coef to recover the VAT object amount (the good one) + if (!empty($sum_pdf_tva)) { $coef_fix_tva = $object->total_tva / $sum_pdf_tva; } @@ -1515,13 +1515,13 @@ class pdf_sponge extends ModelePDFFactures } - foreach($this->tva as $tvakey => $tvaval) { - $this->tva[$tvakey]=$tvaval * $coef_fix_tva; + foreach ($this->tva as $tvakey => $tvaval) { + $this->tva[$tvakey] = $tvaval * $coef_fix_tva; } } } - foreach($this->tva as $tvakey => $tvaval) + foreach ($this->tva as $tvakey => $tvaval) { if ($tvakey != 0) // On affiche pas taux 0 { @@ -1537,7 +1537,7 @@ class pdf_sponge extends ModelePDFFactures $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalVAT", $mysoc->country_code) : ''); - $totalvat.=' '; + $totalvat .= ' '; $totalvat .= vatrate($tvakey, 1).$tvacompl; $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -1549,11 +1549,11 @@ class pdf_sponge extends ModelePDFFactures //Local tax 1 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach ($this->localtax1 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; + if (in_array((string) $localtax_type, array('2', '4', '6'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + foreach ($localtax_rate as $tvakey => $tvaval) { if ($tvakey != 0) // On affiche pas taux 0 { @@ -1562,17 +1562,17 @@ class pdf_sponge extends ModelePDFFactures $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT1", $mysoc->country_code) : ''); - $totalvat.=' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= ' '; + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } @@ -1582,11 +1582,11 @@ class pdf_sponge extends ModelePDFFactures //Local tax 2 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach ($this->localtax2 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; + if (in_array((string) $localtax_type, array('2', '4', '6'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + foreach ($localtax_rate as $tvakey => $tvaval) { // retrieve global local tax if ($tvakey != 0) // On affiche pas taux 0 @@ -1596,17 +1596,17 @@ class pdf_sponge extends ModelePDFFactures $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : ''); - $totalvat.=' '; + $totalvat .= ' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); @@ -1652,31 +1652,31 @@ class pdf_sponge extends ModelePDFFactures // Retained warranty - if( !empty($object->situation_final) && ( $object->type == Facture::TYPE_SITUATION && (!empty($object->retained_warranty) ) ) ) + if (!empty($object->situation_final) && ($object->type == Facture::TYPE_SITUATION && (!empty($object->retained_warranty)))) { $displayWarranty = false; // Check if this situation invoice is 100% for real - if(!empty($object->situation_final)){ + if (!empty($object->situation_final)) { $displayWarranty = true; } - elseif(!empty($object->lines) && $object->status == Facture::STATUS_DRAFT ){ + elseif (!empty($object->lines) && $object->status == Facture::STATUS_DRAFT) { // $object->situation_final need validation to be done so this test is need for draft $displayWarranty = true; - foreach($object->lines as $i => $line){ - if($line->product_type < 2 && $line->situation_percent < 100){ + foreach ($object->lines as $i => $line) { + if ($line->product_type < 2 && $line->situation_percent < 100) { $displayWarranty = false; break; } } } - if($displayWarranty){ + if ($displayWarranty) { $pdf->SetTextColor(40, 40, 40); $pdf->SetFillColor(255, 255, 255); $retainedWarranty = $total_a_payer_ttc * $object->retained_warranty / 100; - $billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty ; + $billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty; // Billed - retained warranty $index++; @@ -1690,10 +1690,10 @@ class pdf_sponge extends ModelePDFFactures $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $retainedWarrantyToPayOn = $outputlangs->transnoentities("PDFEVOLRetainedWarranty") . ' ('.$object->retained_warranty.'%)'; - $retainedWarrantyToPayOn .= !empty($object->retained_warranty_date_limit)?' '.$outputlangs->transnoentities("PDFEVOLtoPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')):''; + $retainedWarrantyToPayOn = $outputlangs->transnoentities("PDFEVOLRetainedWarranty").' ('.$object->retained_warranty.'%)'; + $retainedWarrantyToPayOn .= !empty($object->retained_warranty_date_limit) ? ' '.$outputlangs->transnoentities("PDFEVOLtoPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')) : ''; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($retainedWarranty), $useborder, 'R', 1); } @@ -1714,7 +1714,7 @@ class pdf_sponge extends ModelePDFFactures // Already paid + Deposits $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("Paid").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("Paid") : ''), 0, 'L', 0); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("Paid").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("Paid") : ''), 0, 'L', 0); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle + $depositsamount, 0, $outputlangs), 0, 'R', 0); @@ -1806,12 +1806,12 @@ class pdf_sponge extends ModelePDFFactures if (empty($hidetop)) { $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency)); - $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4); + $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; - if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) { + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); } } @@ -1819,13 +1819,13 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetFont('', '', $default_font_size - 1); // Output Rect - $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter + $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter $this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop); - if (empty($hidetop)){ - $pdf->line($this->marge_gauche, $tab_top+$this->tabTitleHeight, $this->page_largeur-$this->marge_droite, $tab_top+$this->tabTitleHeight); // line takes a position y in 2nd parameter and 4th parameter + if (empty($hidetop)) { + $pdf->line($this->marge_gauche, $tab_top + $this->tabTitleHeight, $this->page_largeur - $this->marge_droite, $tab_top + $this->tabTitleHeight); // line takes a position y in 2nd parameter and 4th parameter } } @@ -1861,8 +1861,8 @@ class pdf_sponge extends ModelePDFFactures $w = 110; - $posy=$this->marge_haute; - $posx=$this->page_largeur-$this->marge_droite-$w; + $posy = $this->marge_haute; + $posx = $this->page_largeur - $this->marge_droite - $w; $pdf->SetXY($this->marge_gauche, $posy); @@ -1872,7 +1872,7 @@ class pdf_sponge extends ModelePDFFactures if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; - if (! empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; @@ -1882,8 +1882,8 @@ class pdf_sponge extends ModelePDFFactures } if (is_readable($logo)) { - $height=pdf_getHeightForLogo($logo); - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) + $height = pdf_getHeightForLogo($logo); + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } else { diff --git a/htdocs/core/modules/facture/modules_facture.php b/htdocs/core/modules/facture/modules_facture.php index f27f086ec7d..56379a0c492 100644 --- a/htdocs/core/modules/facture/modules_facture.php +++ b/htdocs/core/modules/facture/modules_facture.php @@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Required because used in classes that inherit +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Required because used in classes that inherit /** @@ -40,7 +40,7 @@ abstract class ModelePDFFactures extends CommonDocGenerator /** * @var string Error code (or message) */ - public $error=''; + public $error = ''; public $atleastonediscount = 0; public $atleastoneratenotnull = 0; @@ -59,11 +59,11 @@ abstract class ModelePDFFactures extends CommonDocGenerator // phpcs:enable global $conf; - $type='invoice'; - $liste=array(); + $type = 'invoice'; + $liste = array(); include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $liste=getListOfModels($db, $type, $maxfilenamelength); + $liste = getListOfModels($db, $type, $maxfilenamelength); return $liste; } @@ -77,7 +77,7 @@ abstract class ModeleNumRefFactures /** * @var string Error code (or message) */ - public $error=''; + public $error = ''; /** * Return if a module can be used or not diff --git a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php index fca1df1386d..1b6ddf143e0 100644 --- a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php @@ -118,7 +118,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder */ public function __construct($db) { - global $conf,$langs,$mysoc; + global $conf, $langs, $mysoc; // Translations $langs->loadLangs(array("main", "bills", "sendings", "companies")); @@ -129,45 +129,45 @@ class pdf_typhon extends ModelePDFDeliveryOrder // Page size for A4 format $this->type = 'pdf'; - $formatarray=pdf_getFormat(); + $formatarray = pdf_getFormat(); $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; - $this->format = array($this->page_largeur,$this->page_hauteur); - $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; - $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; - $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; - $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; + $this->format = array($this->page_largeur, $this->page_hauteur); + $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; + $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; + $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; + $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; - $this->option_logo = 1; // Display logo FAC_PDF_LOGO - $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION - $this->option_codeproduitservice = 1; // Display product-service code + $this->option_logo = 1; // Display logo FAC_PDF_LOGO + $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION + $this->option_codeproduitservice = 1; // Display product-service code // Get source company - $this->emetteur=$mysoc; - if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default, if was not defined + $this->emetteur = $mysoc; + if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined // Define position of columns - $this->posxdesc=$this->marge_gauche+1; - $this->posxcomm=112; + $this->posxdesc = $this->marge_gauche + 1; + $this->posxcomm = 112; //$this->posxtva=112; //$this->posxup=126; - $this->posxqty=165; - $this->posxremainingqty=185; + $this->posxqty = 165; + $this->posxremainingqty = 185; //$this->posxdiscount=162; //$this->postotalht=174; if ($this->page_largeur < 210) // To work with US executive format { - $this->posxcomm-=20; + $this->posxcomm -= 20; //$this->posxtva-=20; //$this->posxup-=20; - $this->posxqty-=20; + $this->posxqty -= 20; //$this->posxdiscount-=20; //$this->postotalht-=20; } - $this->tva=array(); - $this->atleastoneratenotnull=0; - $this->atleastonediscount=0; + $this->tva = array(); + $this->atleastoneratenotnull = 0; + $this->atleastonediscount = 0; } @@ -186,11 +186,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable - global $user,$langs,$conf,$mysoc,$hookmanager; + global $user, $langs, $conf, $mysoc, $hookmanager; - if (! is_object($outputlangs)) $outputlangs=$langs; + if (!is_object($outputlangs)) $outputlangs = $langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO - if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; + if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; // Load translation files required by the page $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "sendings", "deliveries")); @@ -203,20 +203,20 @@ class pdf_typhon extends ModelePDFDeliveryOrder if ($object->specimen) { $dir = $conf->expedition->dir_output."/receipt"; - $file = $dir . "/SPECIMEN.pdf"; + $file = $dir."/SPECIMEN.pdf"; } else { $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->expedition->dir_output."/receipt/" . $objectref; - $file = $dir . "/" . $objectref . ".pdf"; + $dir = $conf->expedition->dir_output."/receipt/".$objectref; + $file = $dir."/".$objectref.".pdf"; } - if (! file_exists($dir)) + if (!file_exists($dir)) { if (dol_mkdir($dir) < 0) { - $this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir); + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; } } @@ -224,25 +224,25 @@ class pdf_typhon extends ModelePDFDeliveryOrder if (file_exists($dir)) { // Add pdfgeneration hook - if (! is_object($hookmanager)) + if (!is_object($hookmanager)) { include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager=new HookManager($this->db); + $hookmanager = new HookManager($this->db); } $hookmanager->initHooks(array('pdfgeneration')); - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); global $action; - $reshook=$hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks + $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $nblines = count($object->lines); // Create pdf instance - $pdf=pdf_getInstance($this->format); - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance - $heightforinfotot = 30; // Height reserved to output the info and total part - $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6; + $pdf = pdf_getInstance($this->format); + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance + $heightforinfotot = 30; // Height reserved to output the info and total part + $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) + if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -252,14 +252,14 @@ class pdf_typhon extends ModelePDFDeliveryOrder } $pdf->SetFont(pdf_getPDFFont($outputlangs)); // Set path to the background PDF File - if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) + if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) { $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); $tplidx = $pdf->importPage(1); } // We get the shipment that is the origin of delivery receipt - $expedition=new Expedition($this->db); + $expedition = new Expedition($this->db); $result = $expedition->fetch($object->origin_id); // Now we get the order that is origin of shipment $commande = new Commande($this->db); @@ -267,12 +267,12 @@ class pdf_typhon extends ModelePDFDeliveryOrder { $commande->fetch($expedition->origin_id); } - $object->commande=$commande; // We set order of shipment onto delivery. + $object->commande = $commande; // We set order of shipment onto delivery. $object->commande->loadExpeditions(); $pdf->Open(); - $pagenb=0; + $pagenb = 0; $pdf->SetDrawColor(128, 128, 128); $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); @@ -280,9 +280,9 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("DeliveryOrder")); - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); - $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right /* // Positionne $this->atleastonediscount si on a au moins une remise @@ -306,15 +306,15 @@ class pdf_typhon extends ModelePDFDeliveryOrder // New page $pdf->AddPage(); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; $this->_pagehead($pdf, $object, 1, $outputlangs); $pdf->SetFont('', '', $default_font_size - 1); - $pdf->MultiCell(0, 3, ''); // Set interline to 3 + $pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->SetTextColor(0, 0, 0); $tab_top = 90; - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10); $tab_height = 130; $tab_height_newpage = 150; @@ -328,39 +328,39 @@ class pdf_typhon extends ModelePDFDeliveryOrder $tab_top = 88; $pdf->SetFont('', '', $default_font_size - 1); - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($desc_incoterms), 0, 1); $nexY = $pdf->GetY(); - $height_incoterms=$nexY-$tab_top; + $height_incoterms = $nexY - $tab_top; // Rect takes a length in 3rd parameter $pdf->SetDrawColor(192, 192, 192); - $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1); + $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1); - $tab_top = $nexY+6; + $tab_top = $nexY + 6; $height_incoterms += 4; } } // Affiche notes - if (! empty($object->note_public)) + if (!empty($object->note_public)) { $tab_top = 88 + $height_incoterms; $pdf->SetFont('', '', $default_font_size - 1); - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1); $nexY = $pdf->GetY(); - $height_note=$nexY-$tab_top; + $height_note = $nexY - $tab_top; // Rect takes a length in 3rd parameter $pdf->SetDrawColor(192, 192, 192); - $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1); + $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); $tab_height = $tab_height - $height_note; - $tab_top = $nexY+6; + $tab_top = $nexY + 6; } else { - $height_note=0; + $height_note = 0; } $iniY = $tab_top + 11; @@ -368,46 +368,46 @@ class pdf_typhon extends ModelePDFDeliveryOrder $nexY = $tab_top + 11; // Loop on each lines - for ($i = 0 ; $i < $nblines ; $i++) + for ($i = 0; $i < $nblines; $i++) { $curY = $nexY; - $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage + $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage $pdf->SetTextColor(0, 0, 0); $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. - $pageposbefore=$pdf->getPage(); + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pageposbefore = $pdf->getPage(); // Description of product line - $curX = $this->posxdesc-1; + $curX = $this->posxdesc - 1; - $showpricebeforepagebreak=1; + $showpricebeforepagebreak = 1; $pdf->startTransaction(); - pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxcomm-$curX, 3, $curX, $curY, $hideref, $hidedesc); - $pageposafter=$pdf->getPage(); + pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxcomm - $curX, 3, $curX, $curY, $hideref, $hidedesc); + $pageposafter = $pdf->getPage(); if ($pageposafter > $pageposbefore) // There is a pagebreak { $pdf->rollbackTransaction(true); - $pageposafter=$pageposbefore; + $pageposafter = $pageposbefore; //print $pageposafter.'-'.$pageposbefore;exit; - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. - pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxcomm-$curX, 4, $curX, $curY, $hideref, $hidedesc); - $posyafter=$pdf->GetY(); - if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxcomm - $curX, 4, $curX, $curY, $hideref, $hidedesc); + $posyafter = $pdf->GetY(); + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text { - if ($i == ($nblines-1)) // No more lines, and no space left to show total, so we create a new page + if ($i == ($nblines - 1)) // No more lines, and no space left to show total, so we create a new page { $pdf->AddPage('', '', true); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - $pdf->setPage($pageposafter+1); + $pdf->setPage($pageposafter + 1); } } else { // We found a page break - $showpricebeforepagebreak=0; + $showpricebeforepagebreak = 0; } } else // No pagebreak @@ -416,17 +416,17 @@ class pdf_typhon extends ModelePDFDeliveryOrder } $nexY = $pdf->GetY(); - $pageposafter=$pdf->getPage(); + $pageposafter = $pdf->getPage(); $pdf->setPage($pageposbefore); $pdf->setTopMargin($this->marge_haute); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { $pdf->setPage($pageposafter); $curY = $tab_top_newpage; } - $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut + $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut /* // TVA @@ -445,7 +445,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder // Remaining to ship $pdf->SetXY($this->posxremainingqty, $curY); $qtyRemaining = $object->lines[$i]->qty_asked - $object->commande->expeditions[$object->lines[$i]->fk_origin_line]; - $pdf->MultiCell($this->page_largeur-$this->marge_droite - $this->posxremainingqty, 3, $qtyRemaining, 0, 'R'); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxremainingqty, 3, $qtyRemaining, 0, 'R'); /* // Remise sur ligne $pdf->SetXY($this->posxdiscount, $curY); @@ -467,16 +467,16 @@ class pdf_typhon extends ModelePDFDeliveryOrder */ // Add line - if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) + if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) { $pdf->setPage($pageposafter); - $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80))); + $pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80))); //$pdf->SetDrawColor(190,190,200); - $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); + $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1); $pdf->SetLineStyle(array('dash'=>0)); } - $nexY+=2; // Add space between lines + $nexY += 2; // Add space between lines // Detect if some page were added automatically and output _tableau for past pages while ($pagenb < $pageposafter) @@ -493,10 +493,10 @@ class pdf_typhon extends ModelePDFDeliveryOrder $this->_pagefoot($pdf, $object, $outputlangs, 1); $pagenb++; $pdf->setPage($pagenb); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); } - if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) + if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { if ($pagenb == 1) { @@ -509,7 +509,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $this->_pagefoot($pdf, $object, $outputlangs, 1); // New page $pdf->AddPage(); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); } @@ -519,12 +519,12 @@ class pdf_typhon extends ModelePDFDeliveryOrder if ($pagenb == 1) { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } // Affiche zone infos @@ -601,36 +601,36 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->Output($file, 'F'); // Add pdfgeneration hook - if (! is_object($hookmanager)) + if (!is_object($hookmanager)) { include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager=new HookManager($this->db); + $hookmanager = new HookManager($this->db); } $hookmanager->initHooks(array('pdfgeneration')); - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); global $action; - $reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; } - if (! empty($conf->global->MAIN_UMASK)) + if (!empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); $this->result = array('fullpath'=>$file); - return 1; // No error + return 1; // No error } else { - $this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir); + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; } } - $this->error=$langs->transnoentities("ErrorConstantNotDefined", "LIVRAISON_OUTPUTDIR"); + $this->error = $langs->transnoentities("ErrorConstantNotDefined", "LIVRAISON_OUTPUTDIR"); return 0; } @@ -648,19 +648,19 @@ class pdf_typhon extends ModelePDFDeliveryOrder protected function _tableau_info(&$pdf, $object, $posy, $outputlangs) { // phpcs:enable - global $conf,$mysoc; + global $conf, $mysoc; $default_font_size = pdf_getPDFFontSize($outputlangs); $pdf->SetFont('', '', $default_font_size); $pdf->SetXY($this->marge_gauche, $posy); - $larg_sign = ($this->page_largeur-$this->marge_gauche-$this->marge_droite)/3; + $larg_sign = ($this->page_largeur - $this->marge_gauche - $this->marge_droite) / 3; $pdf->Rect($this->marge_gauche, $posy + 1, $larg_sign, 25); $pdf->SetXY($this->marge_gauche + 2, $posy + 2); $pdf->MultiCell($larg_sign, 2, $outputlangs->trans("For").' '.$outputlangs->convToOutputCharset($mysoc->name).":", '', 'L'); - $pdf->Rect(2*$larg_sign+$this->marge_gauche, $posy + 1, $larg_sign, 25); - $pdf->SetXY(2*$larg_sign+$this->marge_gauche + 2, $posy + 2); + $pdf->Rect(2 * $larg_sign + $this->marge_gauche, $posy + 1, $larg_sign, 25); + $pdf->SetXY(2 * $larg_sign + $this->marge_gauche + 2, $posy + 2); $pdf->MultiCell($larg_sign, 2, $outputlangs->trans("ForCustomer").':', '', 'L'); } @@ -679,11 +679,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder */ protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0) { - global $conf,$mysoc; + global $conf, $mysoc; // Force to disable hidetop and hidebottom - $hidebottom=0; - if ($hidetop) $hidetop=-1; + $hidebottom = 0; + if ($hidetop) $hidetop = -1; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -692,11 +692,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->SetFont('', '', $default_font_size - 2); // Output Rec - $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter + $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter if (empty($hidetop)) { - $pdf->line($this->marge_gauche, $tab_top+10, $this->page_largeur-$this->marge_droite, $tab_top+10); + $pdf->line($this->marge_gauche, $tab_top + 10, $this->page_largeur - $this->marge_droite, $tab_top + 10); } $pdf->SetDrawColor(128, 128, 128); @@ -704,29 +704,29 @@ class pdf_typhon extends ModelePDFDeliveryOrder if (empty($hidetop)) { - $pdf->SetXY($this->posxdesc-1, $tab_top+1); + $pdf->SetXY($this->posxdesc - 1, $tab_top + 1); $pdf->MultiCell($this->posxcomm - $this->posxdesc, 2, $outputlangs->transnoentities("Designation"), '', 'L'); } // Modif SEB pour avoir une col en plus pour les commentaires clients $pdf->line($this->posxcomm, $tab_top, $this->posxcomm, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posxcomm, $tab_top+1); + $pdf->SetXY($this->posxcomm, $tab_top + 1); $pdf->MultiCell($this->posxqty - $this->posxcomm, 2, $outputlangs->transnoentities("Comments"), '', 'L'); } // Qty $pdf->line($this->posxqty, $tab_top, $this->posxqty, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posxqty, $tab_top+1); + $pdf->SetXY($this->posxqty, $tab_top + 1); $pdf->MultiCell($this->posxremainingqty - $this->posxqty, 2, $outputlangs->transnoentities("QtyShippedShort"), '', 'R'); } // Remain to ship $pdf->line($this->posxremainingqty, $tab_top, $this->posxremainingqty, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posxremainingqty, $tab_top+1); - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxremainingqty, 2, $outputlangs->transnoentities("KeepToShipShort"), '', 'R'); + $pdf->SetXY($this->posxremainingqty, $tab_top + 1); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxremainingqty, 2, $outputlangs->transnoentities("KeepToShipShort"), '', 'R'); } } @@ -742,14 +742,14 @@ class pdf_typhon extends ModelePDFDeliveryOrder */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { - global $conf,$langs,$hookmanager; + global $conf, $langs, $hookmanager; $default_font_size = pdf_getPDFFontSize($outputlangs); pdf_pagehead($pdf, $outputlangs, $this->page_hauteur); // Show Draft Watermark - if($object->statut==0 && (! empty($conf->global->COMMANDE_DRAFT_WATERMARK)) ) + if ($object->statut == 0 && (!empty($conf->global->COMMANDE_DRAFT_WATERMARK))) { pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->COMMANDE_DRAFT_WATERMARK); } @@ -757,19 +757,19 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->SetTextColor(0, 0, 60); $pdf->SetFont('', 'B', $default_font_size + 3); - $posy=$this->marge_haute; - $posx=$this->page_largeur-$this->marge_droite-100; + $posy = $this->marge_haute; + $posx = $this->page_largeur - $this->marge_droite - 100; $pdf->SetXY($this->marge_gauche, $posy); // Logo - $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; + $logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; if ($this->emetteur->logo) { if (is_readable($logo)) { - $height=pdf_getHeightForLogo($logo); - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) + $height = pdf_getHeightForLogo($logo); + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } else { @@ -788,12 +788,12 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->SetFont('', '', $default_font_size + 2); - $posy+=5; + $posy += 5; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); if ($object->date_valid) { - $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date_delivery, "%d %b %Y", false, $outputlangs, true), '', 'R'); + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->date_delivery, "%d %b %Y", false, $outputlangs, true), '', 'R'); } else { @@ -804,15 +804,15 @@ class pdf_typhon extends ModelePDFDeliveryOrder if ($object->thirdparty->code_client) { - $posy+=5; + $posy += 5; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); } $pdf->SetTextColor(0, 0, 60); - $posy+=2; + $posy += 2; // Show list of linked objects $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size); @@ -823,15 +823,15 @@ class pdf_typhon extends ModelePDFDeliveryOrder $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object); // Show sender - $posy=42; - $posx=$this->marge_gauche; - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80; - $hautcadre=40; + $posy = 42; + $posx = $this->marge_gauche; + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80; + $hautcadre = 40; // Show sender frame $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('', '', $default_font_size - 2); - $pdf->SetXY($posx, $posy-5); + $pdf->SetXY($posx, $posy - 5); $pdf->MultiCell(66, 5, $outputlangs->transnoentities("BillFrom").":", 0, 'L'); $pdf->SetXY($posx, $posy); $pdf->SetFillColor(230, 230, 230); @@ -839,32 +839,32 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->SetTextColor(0, 0, 60); // Show sender name - $pdf->SetXY($posx+2, $posy+3); + $pdf->SetXY($posx + 2, $posy + 3); $pdf->SetFont('', 'B', $default_font_size); $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); - $posy=$pdf->getY(); + $posy = $pdf->getY(); // Show sender information - $pdf->SetXY($posx+2, $posy); + $pdf->SetXY($posx + 2, $posy); $pdf->SetFont('', '', $default_font_size - 1); $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); // Client destinataire - $posy=42; - $posx=102; - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; + $posy = 42; + $posx = 102; + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche; $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('', '', $default_font_size - 2); - $pdf->SetXY($posx, $posy-5); + $pdf->SetXY($posx, $posy - 5); $pdf->MultiCell(80, 5, $outputlangs->transnoentities("DeliveryAddress").":", 0, 'L'); // If SHIPPING contact defined on order, we use it - $usecontact=false; - $arrayidcontact=$object->commande->getIdContact('external', 'SHIPPING'); + $usecontact = false; + $arrayidcontact = $object->commande->getIdContact('external', 'SHIPPING'); if (count($arrayidcontact) > 0) { - $usecontact=true; - $result=$object->fetch_contact($arrayidcontact[0]); + $usecontact = true; + $result = $object->fetch_contact($arrayidcontact[0]); } //Recipient name @@ -875,26 +875,26 @@ class pdf_typhon extends ModelePDFDeliveryOrder $thirdparty = $object->thirdparty; } - $carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs); + $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); - $carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact?$object->contact:''), $usecontact, 'target', $object); + $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target', $object); // Show recipient - $widthrecbox=100; - if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format - $posy=42; - $posx=$this->page_largeur-$this->marge_droite-$widthrecbox; - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; + $widthrecbox = 100; + if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format + $posy = 42; + $posx = $this->page_largeur - $this->marge_droite - $widthrecbox; + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche; // Show recipient frame $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('', '', $default_font_size - 2); - $pdf->SetXY($posx+2, $posy-5); + $pdf->SetXY($posx + 2, $posy - 5); //$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":",0,'L'); $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre); // Show recipient name - $pdf->SetXY($posx+2, $posy+3); + $pdf->SetXY($posx + 2, $posy + 3); $pdf->SetFont('', 'B', $default_font_size); $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L'); @@ -902,7 +902,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder // Show recipient information $pdf->SetFont('', '', $default_font_size - 1); - $pdf->SetXY($posx+2, $posy); + $pdf->SetXY($posx + 2, $posy); $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); } @@ -922,7 +922,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'DELIVERY_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/modCashDesk.class.php b/htdocs/core/modules/modCashDesk.class.php index afb5185fb51..9bff4afdaf8 100644 --- a/htdocs/core/modules/modCashDesk.class.php +++ b/htdocs/core/modules/modCashDesk.class.php @@ -22,7 +22,7 @@ * \ingroup pos * \brief File to enable/disable module Point Of Sales */ -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; /** @@ -64,13 +64,13 @@ class modCashDesk extends DolibarrModules $this->config_page_url = array("cashdesk.php@cashdesk"); // Dependencies - $this->hidden = false; // A condition to hide module - $this->depends = array('always'=>"modBanque", 'always'=>"modFacture", 'always'=>"modProduct", 'FR'=>'modBlockedLog'); // List of modules id that must be enabled if this module is enabled - $this->requiredby = array(); // List of modules id to disable if this one is disabled - $this->phpmin = array(5,4); // Minimum version of PHP required by module - $this->need_dolibarr_version = array(2,4); // Minimum version of Dolibarr required by module + $this->hidden = false; // A condition to hide module + $this->depends = array('always'=>"modBanque", 'always'=>"modFacture", 'always'=>"modProduct", 'FR'=>'modBlockedLog'); // List of modules id that must be enabled if this module is enabled + $this->requiredby = array(); // List of modules id to disable if this one is disabled + $this->phpmin = array(5, 4); // Minimum version of PHP required by module + $this->need_dolibarr_version = array(2, 4); // Minimum version of Dolibarr required by module $this->langfiles = array("cashdesk"); - $this->warnings_activation = array('FR'=>'WarningNoteModulePOSForFrenchLaw'); // Warning to show when we activate module. array('always'='text') or array('FR'='text') + $this->warnings_activation = array('FR'=>'WarningNoteModulePOSForFrenchLaw'); // Warning to show when we activate module. array('always'='text') or array('FR'='text') //$this->warnings_activation_ext = array('FR'=>'WarningInstallationMayBecomeNotCompliantWithLaw'); // Warning to show when we activate an external module. array('always'='text') or array('FR'='text') // Constants @@ -81,7 +81,7 @@ class modCashDesk extends DolibarrModules // Permissions $this->rights = array(); - $r=0; + $r = 0; $r++; $this->rights[$r][0] = 50101; @@ -91,21 +91,21 @@ class modCashDesk extends DolibarrModules $this->rights[$r][4] = 'run'; // Main menu entries - $this->menus = array(); // List of menus to add - $r=0; + $this->menus = array(); // List of menus to add + $r = 0; // This is to declare the Top Menu entry: - $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu - 'type'=>'top', // This is a Top menu entry + $this->menu[$r] = array('fk_menu'=>0, // Put 0 if this is a top menu + 'type'=>'top', // This is a Top menu entry 'titre'=>'PointOfSaleShort', 'mainmenu'=>'cashdesk', 'url'=>'/cashdesk/index.php?user=__USER_LOGIN__', - 'langs'=>'cashdesk', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'langs'=>'cashdesk', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>900, 'enabled'=>'$conf->cashdesk->enabled', - 'perms'=>'$user->rights->cashdesk->run', // Use 'perms'=>'1' if you want your menu with no permission rules + 'perms'=>'$user->rights->cashdesk->run', // Use 'perms'=>'1' if you want your menu with no permission rules 'target'=>'pointofsale', - 'user'=>0); // 0=Menu for internal users, 1=external users, 2=both + 'user'=>0); // 0=Menu for internal users, 1=external users, 2=both $r++; diff --git a/htdocs/core/modules/modMrp.class.php b/htdocs/core/modules/modMrp.class.php index a5d58bd8333..1ca8e380aa4 100644 --- a/htdocs/core/modules/modMrp.class.php +++ b/htdocs/core/modules/modMrp.class.php @@ -26,7 +26,7 @@ * \ingroup mrp * \brief Description and activation file for module Mrp */ -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; /** * Description and activation class for module Mrp @@ -40,7 +40,7 @@ class modMrp extends DolibarrModules */ public function __construct($db) { - global $langs,$conf; + global $langs, $conf; $this->db = $db; // Id for module (must be unique). @@ -71,7 +71,7 @@ class modMrp extends DolibarrModules // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' - $this->picto='mrp'; + $this->picto = 'mrp'; // Define some features supported by module (triggers, login, substitutions, menus, css, etc...) $this->module_parts = array( // Set this to 1 if module has its own trigger directory (core/triggers) @@ -119,13 +119,13 @@ class modMrp extends DolibarrModules $this->hidden = false; // List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...) $this->depends = array('modBom'); - $this->requiredby = array(); // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...) - $this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...) + $this->requiredby = array(); // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...) + $this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...) $this->langfiles = array("mrp"); - $this->phpmin = array(5,5); // Minimum version of PHP required by module - $this->need_dolibarr_version = array(8,0); // Minimum version of Dolibarr required by module - $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) - $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) + $this->phpmin = array(5, 5); // Minimum version of PHP required by module + $this->need_dolibarr_version = array(8, 0); // Minimum version of Dolibarr required by module + $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) + $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) //$this->automatic_activation = array('FR'=>'MrpWasAutomaticallyActivatedBecauseOfYourCountryChoice'); //$this->always_enabled = true; // If true, can't be disabled @@ -146,9 +146,9 @@ class modMrp extends DolibarrModules 'fr_FR:ParentCompany'=>'Maison mère ou revendeur' )*/ - if (! isset($conf->mrp) || ! isset($conf->mrp->enabled)) { - $conf->mrp=new stdClass(); - $conf->mrp->enabled=0; + if (!isset($conf->mrp) || !isset($conf->mrp->enabled)) { + $conf->mrp = new stdClass(); + $conf->mrp->enabled = 0; } // Array to add new pages in new tabs @@ -180,7 +180,7 @@ class modMrp extends DolibarrModules // 'user' to add a tab in user view // Dictionaries - $this->dictionaries=array(); + $this->dictionaries = array(); /* Example: $this->dictionaries=array( 'langs'=>'mylangfile@mrp', @@ -236,35 +236,35 @@ class modMrp extends DolibarrModules // Permissions provided by this module $this->rights = array(); - $r=0; + $r = 0; // Add here entries to declare new permissions /* BEGIN MODULEBUILDER PERMISSIONS */ - $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) - $this->rights[$r][1] = 'Read Manufacturing Order'; // Permission label - $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2) - $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2) + $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][1] = 'Read Manufacturing Order'; // Permission label + $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2) + $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2) $r++; - $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) - $this->rights[$r][1] = 'Create/Update Manufacturing Order'; // Permission label - $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2) - $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2) + $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][1] = 'Create/Update Manufacturing Order'; // Permission label + $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2) + $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2) $r++; - $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) - $this->rights[$r][1] = 'Delete Manufacturing Order'; // Permission label - $this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2) - $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2) + $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][1] = 'Delete Manufacturing Order'; // Permission label + $this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2) + $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2) $r++; /* END MODULEBUILDER PERMISSIONS */ // Main menu entries to add $this->menu = array(); - $r=0; + $r = 0; // Add here entries to declare new menus /* BEGIN MODULEBUILDER TOPMENU */ /* END MODULEBUILDER LEFTMENU MO */ // Exports profiles provided by this module - $r=1; + $r = 1; /* BEGIN MODULEBUILDER EXPORT MO */ /* $langs->load("mrp"); @@ -284,7 +284,7 @@ class modMrp extends DolibarrModules /* END MODULEBUILDER EXPORT MO */ // Imports profiles provided by this module - $r=1; + $r = 1; /* BEGIN MODULEBUILDER IMPORT MO */ /* $langs->load("mrp"); @@ -316,7 +316,7 @@ class modMrp extends DolibarrModules { global $conf, $langs; - $result=$this->_load_tables('/mrp/sql/'); + $result = $this->_load_tables('/mrp/sql/'); if ($result < 0) return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default') // Create extrafields during init @@ -334,19 +334,19 @@ class modMrp extends DolibarrModules $sql = array(); // ODT template - $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/mrps/template_mo.odt'; - $dirodt=DOL_DATA_ROOT.'/doctemplates/mrps'; - $dest=$dirodt.'/template_mo.odt'; + $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/mrps/template_mo.odt'; + $dirodt = DOL_DATA_ROOT.'/doctemplates/mrps'; + $dest = $dirodt.'/template_mo.odt'; - if (file_exists($src) && ! file_exists($dest)) + if (file_exists($src) && !file_exists($dest)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; dol_mkdir($dirodt); - $result=dol_copy($src, $dest, 0, 0); + $result = dol_copy($src, $dest, 0, 0); if ($result < 0) { $langs->load("errors"); - $this->error=$langs->trans('ErrorFailToCopyFile', $src, $dest); + $this->error = $langs->trans('ErrorFailToCopyFile', $src, $dest); return 0; } } diff --git a/htdocs/core/modules/modTakePos.class.php b/htdocs/core/modules/modTakePos.class.php index 515f18cf690..804ce8152ab 100644 --- a/htdocs/core/modules/modTakePos.class.php +++ b/htdocs/core/modules/modTakePos.class.php @@ -24,7 +24,7 @@ * \ingroup takepos * \brief Description and activation file for module TakePos */ -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; /** @@ -39,7 +39,7 @@ class modTakePos extends DolibarrModules */ public function __construct($db) { - global $langs,$conf; + global $langs, $conf; $this->db = $db; @@ -71,21 +71,21 @@ class modTakePos extends DolibarrModules // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' - $this->picto='list'; + $this->picto = 'list'; // Defined all module parts (triggers, login, substitutions, menus, css, etc...) // for default path (eg: /takepos/core/xxxxx) (0=disable, 1=enable) // for specific path of parts (eg: /takepos/core/modules/barcode) // for specific css file (eg: /takepos/css/takepos.css.php) $this->module_parts = array( - 'triggers' => 0, // Set this to 1 if module has its own trigger directory (core/triggers) - 'login' => 0, // Set this to 1 if module has its own login method file (core/login) - 'substitutions' => 1, // Set this to 1 if module has its own substitution function file (core/substitutions) - 'menus' => 0, // Set this to 1 if module has its own menus handler directory (core/menus) - 'theme' => 0, // Set this to 1 if module has its own theme directory (theme) - 'tpl' => 0, // Set this to 1 if module overwrite template dir (core/tpl) - 'barcode' => 0, // Set this to 1 if module has its own barcode directory (core/modules/barcode) - 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx) + 'triggers' => 0, // Set this to 1 if module has its own trigger directory (core/triggers) + 'login' => 0, // Set this to 1 if module has its own login method file (core/login) + 'substitutions' => 1, // Set this to 1 if module has its own substitution function file (core/substitutions) + 'menus' => 0, // Set this to 1 if module has its own menus handler directory (core/menus) + 'theme' => 0, // Set this to 1 if module has its own theme directory (theme) + 'tpl' => 0, // Set this to 1 if module overwrite template dir (core/tpl) + 'barcode' => 0, // Set this to 1 if module has its own barcode directory (core/modules/barcode) + 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx) 'hooks' => array() // Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context 'all' ); @@ -97,15 +97,15 @@ class modTakePos extends DolibarrModules $this->config_page_url = array("setup.php@takepos"); // Dependencies - $this->hidden = false; // A condition to hide module - $this->depends = array('always1'=>"modBanque", 'always2'=>"modFacture", 'always3'=>"modProduct", 'always4'=>'modCategorie', 'FR1'=>'modBlockedLog'); // List of module class names as string that must be enabled if this module is enabled - $this->requiredby = array(); // List of module ids to disable if this one is disabled - $this->conflictwith = array(); // List of module class names as string this module is in conflict with + $this->hidden = false; // A condition to hide module + $this->depends = array('always1'=>"modBanque", 'always2'=>"modFacture", 'always3'=>"modProduct", 'always4'=>'modCategorie', 'FR1'=>'modBlockedLog'); // List of module class names as string that must be enabled if this module is enabled + $this->requiredby = array(); // List of module ids to disable if this one is disabled + $this->conflictwith = array(); // List of module class names as string this module is in conflict with $this->langfiles = array("cashdesk"); - $this->phpmin = array(5,4); // Minimum version of PHP required by module - $this->need_dolibarr_version = array(4,0); // Minimum version of Dolibarr required by module - $this->warnings_activation = array('FR'=>'WarningNoteModulePOSForFrenchLaw'); // Warning to show when we activate module. array('always'='text') or array('FR'='text') - $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) + $this->phpmin = array(5, 4); // Minimum version of PHP required by module + $this->need_dolibarr_version = array(4, 0); // Minimum version of Dolibarr required by module + $this->warnings_activation = array('FR'=>'WarningNoteModulePOSForFrenchLaw'); // Warning to show when we activate module. array('always'='text') or array('FR'='text') + $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) //$this->automatic_activation = array('FR'=>'TakePosWasAutomaticallyActivatedBecauseOfYourCountryChoice'); //$this->always_enabled = true; // If true, can't be disabled @@ -119,10 +119,10 @@ class modTakePos extends DolibarrModules ); - if (! isset($conf->takepos) || ! isset($conf->takepos->enabled)) + if (!isset($conf->takepos) || !isset($conf->takepos->enabled)) { - $conf->takepos=new stdClass(); - $conf->takepos->enabled=0; + $conf->takepos = new stdClass(); + $conf->takepos->enabled = 0; } @@ -156,7 +156,7 @@ class modTakePos extends DolibarrModules // Dictionaries - $this->dictionaries=array(); + $this->dictionaries = array(); /* Example: $this->dictionaries=array( 'langs'=>'mylangfile@takepos', @@ -193,9 +193,9 @@ class modTakePos extends DolibarrModules // Permissions - $this->rights = array(); // Permission array used by this module + $this->rights = array(); // Permission array used by this module - $r=0; + $r = 0; $r++; $this->rights[$r][0] = 50151; @@ -206,24 +206,24 @@ class modTakePos extends DolibarrModules // Main menu entries - $this->menu = array(); // List of menus to add - $r=0; + $this->menu = array(); // List of menus to add + $r = 0; // Add here entries to declare new menus /* BEGIN MODULEBUILDER TOPMENU */ - $this->menu[$r++]=array('fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'top', // This is a Top menu entry + $this->menu[$r++] = array('fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type'=>'top', // This is a Top menu entry 'titre'=>'PointOfSaleShort', 'mainmenu'=>'takepos', 'leftmenu'=>'', 'url'=>'/takepos/takepos.php', - 'langs'=>'cashdesk', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>1000+$r, - 'enabled'=>'$conf->takepos->enabled', // Define condition to show or hide menu entry. Use '$conf->takepos->enabled' if entry must be visible if module is enabled. - 'perms'=>'$user->rights->takepos->run', // Use 'perms'=>'$user->rights->takepos->level1->level2' if you want your menu with a permission rules + 'langs'=>'cashdesk', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position'=>1000 + $r, + 'enabled'=>'$conf->takepos->enabled', // Define condition to show or hide menu entry. Use '$conf->takepos->enabled' if entry must be visible if module is enabled. + 'perms'=>'$user->rights->takepos->run', // Use 'perms'=>'$user->rights->takepos->level1->level2' if you want your menu with a permission rules 'target'=>'takepos', - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both + 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both /* END MODULEBUILDER TOPMENU */ diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index d8790c54eee..a14c087dbf7 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -135,45 +135,45 @@ class pdf_cyan extends ModelePDFPropales $this->db = $db; $this->name = "cyan"; $this->description = $langs->trans('DocModelCyanDescription'); - $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template + $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template // Dimension page $this->type = 'pdf'; - $formatarray=pdf_getFormat(); + $formatarray = pdf_getFormat(); $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; - $this->format = array($this->page_largeur,$this->page_hauteur); - $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; - $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; - $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; - $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; + $this->format = array($this->page_largeur, $this->page_hauteur); + $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; + $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; + $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; + $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; - $this->option_logo = 1; // Display logo - $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION - $this->option_modereg = 1; // Display payment mode - $this->option_condreg = 1; // Display payment terms - $this->option_codeproduitservice = 1; // Display product-service code - $this->option_multilang = 1; // Available in several languages - $this->option_escompte = 0; // Displays if there has been a discount - $this->option_credit_note = 0; // Support credit notes - $this->option_freetext = 1; // Support add of a personalised text - $this->option_draft_watermark = 1; // Support add of a watermark on drafts + $this->option_logo = 1; // Display logo + $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION + $this->option_modereg = 1; // Display payment mode + $this->option_condreg = 1; // Display payment terms + $this->option_codeproduitservice = 1; // Display product-service code + $this->option_multilang = 1; // Available in several languages + $this->option_escompte = 0; // Displays if there has been a discount + $this->option_credit_note = 0; // Support credit notes + $this->option_freetext = 1; // Support add of a personalised text + $this->option_draft_watermark = 1; // Support add of a watermark on drafts // Get source company - $this->emetteur=$mysoc; - if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default, if was not defined + $this->emetteur = $mysoc; + if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined // Define position of columns - $this->posxdesc=$this->marge_gauche+1; + $this->posxdesc = $this->marge_gauche + 1; $this->tabTitleHeight = 5; // default height - $this->tva=array(); - $this->localtax1=array(); - $this->localtax2=array(); - $this->atleastoneratenotnull=0; - $this->atleastonediscount=0; + $this->tva = array(); + $this->localtax1 = array(); + $this->localtax2 = array(); + $this->atleastoneratenotnull = 0; + $this->atleastonediscount = 0; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -191,16 +191,16 @@ class pdf_cyan extends ModelePDFPropales public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable - global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblines; + global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines; - if (! is_object($outputlangs)) $outputlangs=$langs; + if (!is_object($outputlangs)) $outputlangs = $langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO - if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; + if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; // Load traductions files required by page $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "propal")); - if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) { + if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) { global $outputlangsbis; $outputlangsbis = new Translate('', $conf); $outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE); @@ -209,39 +209,39 @@ class pdf_cyan extends ModelePDFPropales $nblines = count($object->lines); - $hidetop=0; - if(!empty($conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE)){ - $hidetop=$conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE; + $hidetop = 0; + if (!empty($conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE)) { + $hidetop = $conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE; } // Loop on each lines to detect if there is at least one image to show - $realpatharray=array(); + $realpatharray = array(); $this->atleastonephoto = false; - if (! empty($conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE)) + if (!empty($conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE)) { $objphoto = new Product($this->db); - for ($i = 0 ; $i < $nblines ; $i++) + for ($i = 0; $i < $nblines; $i++) { if (empty($object->lines[$i]->fk_product)) continue; $objphoto->fetch($object->lines[$i]->fk_product); //var_dump($objphoto->ref);exit; - if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) + if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { - $pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product') . $objphoto->id ."/photos/"; - $pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product') . dol_sanitizeFileName($objphoto->ref).'/'; + $pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; + $pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; } else { - $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product') . dol_sanitizeFileName($objphoto->ref).'/'; // default - $pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product') . $objphoto->id ."/photos/"; // alternative + $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; // default + $pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative } $arephoto = false; foreach ($pdir as $midir) { - if (! $arephoto) + if (!$arephoto) { if ($conf->product->entity != $objphoto->entity) { $dir = $conf->product->multidir_output[$objphoto->entity].'/'.$midir; //Check repertories of current entities @@ -333,14 +333,14 @@ class pdf_cyan extends ModelePDFPropales } $pdf->SetFont(pdf_getPDFFont($outputlangs)); // Set path to the background PDF File - if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) + if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) { $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); $tplidx = $pdf->importPage(1); } $pdf->Open(); - $pagenb=0; + $pagenb = 0; $pdf->SetDrawColor(128, 128, 128); $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); @@ -393,38 +393,38 @@ class pdf_cyan extends ModelePDFPropales $tab_top -= 2; $pdf->SetFont('', '', $default_font_size - 1); - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($desc_incoterms), 0, 1); $nexY = $pdf->GetY(); - $height_incoterms=$nexY-$tab_top; + $height_incoterms = $nexY - $tab_top; // Rect takes a length in 3rd parameter $pdf->SetDrawColor(192, 192, 192); - $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1); + $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1); - $tab_top = $nexY+6; + $tab_top = $nexY + 6; } } // Affiche notes - $notetoshow=empty($object->note_public)?'':$object->note_public; - if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) + $notetoshow = empty($object->note_public) ? '' : $object->note_public; + if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) { // Get first sale rep if (is_object($object->thirdparty)) { - $salereparray=$object->thirdparty->getSalesRepresentatives($user); - $salerepobj=new User($this->db); + $salereparray = $object->thirdparty->getSalesRepresentatives($user); + $salerepobj = new User($this->db); $salerepobj->fetch($salereparray[0]['id']); - if (! empty($salerepobj->signature)) $notetoshow=dol_concatdesc($notetoshow, $salerepobj->signature); + if (!empty($salerepobj->signature)) $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature); } } - if (! empty($conf->global->MAIN_ADD_CREATOR_IN_NOTE) && $object->user_author_id > 0) + if (!empty($conf->global->MAIN_ADD_CREATOR_IN_NOTE) && $object->user_author_id > 0) { - $tmpuser=new User($this->db); + $tmpuser = new User($this->db); $tmpuser->fetch($object->user_author_id); $notetoshow .= $langs->trans("CaseFollowedBy").' '.$tmpuser->getFullName($langs); - if ($tmpuser->email) $notetoshow.=', Mail: '.$tmpuser->email; - if ($tmpuser->office_phone) $notetoshow.=', Tel: '.$tmpuser->office_phone; + if ($tmpuser->email) $notetoshow .= ', Mail: '.$tmpuser->email; + if ($tmpuser->office_phone) $notetoshow .= ', Tel: '.$tmpuser->office_phone; } $tab_height = $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter; @@ -561,102 +561,102 @@ class pdf_cyan extends ModelePDFPropales $nexY = $tab_top + $this->tabTitleHeight + 2; // Loop on each lines - $pageposbeforeprintlines=$pdf->getPage(); + $pageposbeforeprintlines = $pdf->getPage(); $pagenb = $pageposbeforeprintlines; for ($i = 0; $i < $nblines; $i++) { $curY = $nexY; - $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage + $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage $pdf->SetTextColor(0, 0, 0); // Define size of image if we need it - $imglinesize=array(); - if (! empty($realpatharray[$i])) $imglinesize=pdf_getSizeForImage($realpatharray[$i]); + $imglinesize = array(); + if (!empty($realpatharray[$i])) $imglinesize = pdf_getSizeForImage($realpatharray[$i]); $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforsignature+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. - $pageposbefore=$pdf->getPage(); + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pageposbefore = $pdf->getPage(); - $showpricebeforepagebreak=1; - $posYAfterImage=0; - $posYAfterDescription=0; + $showpricebeforepagebreak = 1; + $posYAfterImage = 0; + $posYAfterDescription = 0; - if($this->getColumnStatus('photo')) + if ($this->getColumnStatus('photo')) { // We start with Photo of product line - if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur-($heightforfooter+$heightforfreetext+$heightforsignature+$heightforinfotot))) // If photo too high, we moved completely on new page + if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) // If photo too high, we moved completely on new page { $pdf->AddPage('', '', true); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); //if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - $pdf->setPage($pageposbefore+1); + $pdf->setPage($pageposbefore + 1); $curY = $tab_top_newpage; - $showpricebeforepagebreak=0; + $showpricebeforepagebreak = 0; } if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) { - $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi + $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi // $pdf->Image does not increase value return by getY, so we save it manually - $posYAfterImage=$curY+$imglinesize['height']; + $posYAfterImage = $curY + $imglinesize['height']; } } // Description of product line - if($this->getColumnStatus('desc')) + if ($this->getColumnStatus('desc')) { $pdf->startTransaction(); pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc); - $pageposafter=$pdf->getPage(); + $pageposafter = $pdf->getPage(); if ($pageposafter > $pageposbefore) // There is a pagebreak { $pdf->rollbackTransaction(true); - $pageposafter=$pageposbefore; + $pageposafter = $pageposbefore; //print $pageposafter.'-'.$pageposbefore;exit; - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc); - $pageposafter=$pdf->getPage(); - $posyafter=$pdf->GetY(); + $pageposafter = $pdf->getPage(); + $posyafter = $pdf->GetY(); //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; - if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforsignature+$heightforinfotot))) // There is no space left for total+free text + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) // There is no space left for total+free text { - if ($i == ($nblines-1)) // No more lines, and no space left to show total, so we create a new page + if ($i == ($nblines - 1)) // No more lines, and no space left to show total, so we create a new page { $pdf->AddPage('', '', true); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); //if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - $pdf->setPage($pageposafter+1); + $pdf->setPage($pageposafter + 1); } } else { // We found a page break - $showpricebeforepagebreak=0; + $showpricebeforepagebreak = 0; } } else // No pagebreak { $pdf->commitTransaction(); } - $posYAfterDescription=$pdf->GetY(); + $posYAfterDescription = $pdf->GetY(); } $nexY = $pdf->GetY(); - $pageposafter=$pdf->getPage(); + $pageposafter = $pdf->getPage(); $pdf->setPage($pageposbefore); $pdf->setTopMargin($this->marge_haute); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { $pdf->setPage($pageposafter); $curY = $tab_top_newpage; } - $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut + $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut // VAT Rate if ($this->getColumnStatus('vat')) @@ -718,59 +718,59 @@ class pdf_cyan extends ModelePDFPropales 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails ); - $reshook=$hookmanager->executeHooks('printPDFline', $parameters, $this); // Note that $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printPDFline', $parameters, $this); // Note that $object may have been modified by hook // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva - if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; - else $tvaligne=$object->lines[$i]->total_tva; + if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne = $object->lines[$i]->multicurrency_total_tva; + else $tvaligne = $object->lines[$i]->total_tva; - $localtax1ligne=$object->lines[$i]->total_localtax1; - $localtax2ligne=$object->lines[$i]->total_localtax2; - $localtax1_rate=$object->lines[$i]->localtax1_tx; - $localtax2_rate=$object->lines[$i]->localtax2_tx; - $localtax1_type=$object->lines[$i]->localtax1_type; - $localtax2_type=$object->lines[$i]->localtax2_type; + $localtax1ligne = $object->lines[$i]->total_localtax1; + $localtax2ligne = $object->lines[$i]->total_localtax2; + $localtax1_rate = $object->lines[$i]->localtax1_tx; + $localtax2_rate = $object->lines[$i]->localtax2_tx; + $localtax1_type = $object->lines[$i]->localtax1_type; + $localtax2_type = $object->lines[$i]->localtax2_type; - if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100; - if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100; - if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100; + if ($object->remise_percent) $tvaligne -= ($tvaligne * $object->remise_percent) / 100; + if ($object->remise_percent) $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100; + if ($object->remise_percent) $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100; - $vatrate=(string) $object->lines[$i]->tva_tx; + $vatrate = (string) $object->lines[$i]->tva_tx; // Retrieve type from database for backward compatibility with old records - if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined - && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax + if ((!isset($localtax1_type) || $localtax1_type == '' || !isset($localtax2_type) || $localtax2_type == '') // if tax type not defined + && (!empty($localtax1_rate) || !empty($localtax2_rate))) // and there is local tax { - $localtaxtmp_array=getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc); + $localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc); $localtax1_type = $localtaxtmp_array[0]; $localtax2_type = $localtaxtmp_array[2]; } // retrieve global local tax if ($localtax1_type && $localtax1ligne != 0) - $this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne; + $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne; if ($localtax2_type && $localtax2ligne != 0) - $this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne; + $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne; - if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; - if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=0; + if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate .= '*'; + if (!isset($this->tva[$vatrate])) $this->tva[$vatrate] = 0; $this->tva[$vatrate] += $tvaligne; - if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage; + if ($posYAfterImage > $posYAfterDescription) $nexY = $posYAfterImage; // Add line - if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) + if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) { $pdf->setPage($pageposafter); - $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80))); + $pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80))); //$pdf->SetDrawColor(190,190,200); - $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); + $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1); $pdf->SetLineStyle(array('dash'=>0)); } - $nexY+=2; // Add space between lines + $nexY += 2; // Add space between lines // Detect if some page were added automatically and output _tableau for past pages while ($pagenb < $pageposafter) @@ -867,41 +867,41 @@ class pdf_cyan extends ModelePDFPropales $product = new Product($this->db); $product->fetch($line->fk_product); - if ($product->entity!=$conf->entity) { - $entity_product_file=$product->entity; + if ($product->entity != $conf->entity) { + $entity_product_file = $product->entity; } else { - $entity_product_file=$conf->entity; + $entity_product_file = $conf->entity; } // If PDF is selected and file is not empty if (count($filetomerge->lines) > 0) { foreach ($filetomerge->lines as $linefile) { - if (! empty($linefile->id) && ! empty($linefile->file_name)) { - if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) + if (!empty($linefile->id) && !empty($linefile->file_name)) { + if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { - if (! empty($conf->product->enabled)) { - $filetomerge_dir = $conf->product->multidir_output[$entity_product_file] . '/' . get_exdir($product->id, 2, 0, 0, $product, 'product') . $product->id ."/photos"; - } elseif (! empty($conf->service->enabled)) { - $filetomerge_dir = $conf->service->multidir_output[$entity_product_file] . '/' . get_exdir($product->id, 2, 0, 0, $product, 'product') . $product->id ."/photos"; + if (!empty($conf->product->enabled)) { + $filetomerge_dir = $conf->product->multidir_output[$entity_product_file].'/'.get_exdir($product->id, 2, 0, 0, $product, 'product').$product->id."/photos"; + } elseif (!empty($conf->service->enabled)) { + $filetomerge_dir = $conf->service->multidir_output[$entity_product_file].'/'.get_exdir($product->id, 2, 0, 0, $product, 'product').$product->id."/photos"; } } else { - if (! empty($conf->product->enabled)) { - $filetomerge_dir = $conf->product->multidir_output[$entity_product_file] . '/' . get_exdir(0, 0, 0, 0, $product, 'product') . dol_sanitizeFileName($product->ref); - } elseif (! empty($conf->service->enabled)) { - $filetomerge_dir = $conf->service->multidir_output[$entity_product_file] . '/' . get_exdir(0, 0, 0, 0, $product, 'product') . dol_sanitizeFileName($product->ref); + if (!empty($conf->product->enabled)) { + $filetomerge_dir = $conf->product->multidir_output[$entity_product_file].'/'.get_exdir(0, 0, 0, 0, $product, 'product').dol_sanitizeFileName($product->ref); + } elseif (!empty($conf->service->enabled)) { + $filetomerge_dir = $conf->service->multidir_output[$entity_product_file].'/'.get_exdir(0, 0, 0, 0, $product, 'product').dol_sanitizeFileName($product->ref); } } - dol_syslog(get_class($this) . ':: upload_dir=' . $filetomerge_dir, LOG_DEBUG); + dol_syslog(get_class($this).':: upload_dir='.$filetomerge_dir, LOG_DEBUG); - $infile = $filetomerge_dir . '/' . $linefile->file_name; + $infile = $filetomerge_dir.'/'.$linefile->file_name; if (file_exists($infile) && is_readable($infile)) { $pagecount = $pdf->setSourceFile($infile); - for($i = 1; $i <= $pagecount; $i ++) { + for ($i = 1; $i <= $pagecount; $i++) { $tplIdx = $pdf->importPage($i); - if ($tplIdx!==false) { + if ($tplIdx !== false) { $s = $pdf->getTemplatesize($tplIdx); $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); $pdf->useTemplate($tplIdx); @@ -923,31 +923,31 @@ class pdf_cyan extends ModelePDFPropales //Add pdfgeneration hook $hookmanager->initHooks(array('pdfgeneration')); - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); global $action; - $reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; } - if (! empty($conf->global->MAIN_UMASK)) + if (!empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); $this->result = array('fullpath'=>$file); - return 1; // No error + return 1; // No error } else { - $this->error=$langs->trans("ErrorCanNotCreateDir", $dir); + $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); return 0; } } else { - $this->error=$langs->trans("ErrorConstantNotDefined", "PROP_OUTPUTDIR"); + $this->error = $langs->trans("ErrorConstantNotDefined", "PROP_OUTPUTDIR"); return 0; } } @@ -1176,7 +1176,7 @@ class pdf_cyan extends ModelePDFPropales $index = 0; $outputlangsbis = null; - if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) { + if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) { $outputlangsbis = new Translate('', $conf); $outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE); $outputlangsbis->loadLangs(array("main", "dict", "companies", "bills", "products", "propal")); @@ -1209,29 +1209,29 @@ class pdf_cyan extends ModelePDFPropales //Local tax 1 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach ($this->localtax1 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('1','3','5'))) continue; + if (in_array((string) $localtax_type, array('1', '3', '5'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + foreach ($localtax_rate as $tvakey => $tvaval) { - if ($tvakey!=0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT1", $mysoc->country_code) : ''); - $totalvat.=' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat .= ' '; + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); @@ -1242,13 +1242,13 @@ class pdf_cyan extends ModelePDFPropales //Local tax 2 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach ($this->localtax2 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('1','3','5'))) continue; + if (in_array((string) $localtax_type, array('1', '3', '5'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + foreach ($localtax_rate as $tvakey => $tvaval) { - if ($tvakey!=0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -1257,16 +1257,16 @@ class pdf_cyan extends ModelePDFPropales $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : ''); - $totalvat.=' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat .= ' '; + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); @@ -1291,7 +1291,7 @@ class pdf_cyan extends ModelePDFPropales $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalVAT", $mysoc->country_code) : ''); - $totalvat.=' '; + $totalvat .= ' '; $totalvat .= vatrate($tvakey, 1).$tvacompl; $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -1303,11 +1303,11 @@ class pdf_cyan extends ModelePDFPropales //Local tax 1 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach ($this->localtax1 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; + if (in_array((string) $localtax_type, array('2', '4', '6'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + foreach ($localtax_rate as $tvakey => $tvaval) { if ($tvakey != 0) // On affiche pas taux 0 { @@ -1316,17 +1316,17 @@ class pdf_cyan extends ModelePDFPropales $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT1", $mysoc->country_code) : ''); - $totalvat.=' '; + $totalvat .= ' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } @@ -1336,11 +1336,11 @@ class pdf_cyan extends ModelePDFPropales //Local tax 2 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach ($this->localtax2 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; + if (in_array((string) $localtax_type, array('2', '4', '6'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + foreach ($localtax_rate as $tvakey => $tvaval) { // retrieve global local tax if ($tvakey != 0) // On affiche pas taux 0 @@ -1350,17 +1350,17 @@ class pdf_cyan extends ModelePDFPropales $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : ''); - $totalvat.= ' '; + $totalvat .= ' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); @@ -1464,12 +1464,12 @@ class pdf_cyan extends ModelePDFPropales if (empty($hidetop)) { $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency)); - $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4); + $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; - if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) { + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); } } @@ -1477,12 +1477,12 @@ class pdf_cyan extends ModelePDFPropales $pdf->SetFont('', '', $default_font_size - 1); // Output Rect - $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter + $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter $this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop); - if (empty($hidetop)){ - $pdf->line($this->marge_gauche, $tab_top+$this->tabTitleHeight, $this->page_largeur-$this->marge_droite, $tab_top+$this->tabTitleHeight); // line takes a position y in 2nd parameter and 4th parameter + if (empty($hidetop)) { + $pdf->line($this->marge_gauche, $tab_top + $this->tabTitleHeight, $this->page_largeur - $this->marge_droite, $tab_top + $this->tabTitleHeight); // line takes a position y in 2nd parameter and 4th parameter } } @@ -1516,8 +1516,8 @@ class pdf_cyan extends ModelePDFPropales $pdf->SetTextColor(0, 0, 60); $pdf->SetFont('', 'B', $default_font_size + 3); - $posy=$this->marge_haute; - $posx=$this->page_largeur-$this->marge_droite-100; + $posy = $this->marge_haute; + $posx = $this->page_largeur - $this->marge_droite - 100; $pdf->SetXY($this->marge_gauche, $posy); @@ -1527,7 +1527,7 @@ class pdf_cyan extends ModelePDFPropales if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; - if (! empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; @@ -1537,8 +1537,8 @@ class pdf_cyan extends ModelePDFPropales } if (is_readable($logo)) { - $height=pdf_getHeightForLogo($logo); - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) + $height = pdf_getHeightForLogo($logo); + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } else { diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 2fbeb7ccdca..2a2916cf253 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -183,16 +183,16 @@ class pdf_cornas extends ModelePDFSuppliersOrders public function write_file($object, $outputlangs = '', $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable - global $user,$langs,$conf,$hookmanager,$mysoc,$nblines; + global $user, $langs, $conf, $hookmanager, $mysoc, $nblines; - if (! is_object($outputlangs)) $outputlangs=$langs; + if (!is_object($outputlangs)) $outputlangs = $langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO - if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; + if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; // Load translation files required by the page $outputlangs->loadLangs(array("main", "orders", "companies", "bills", "dict", "products")); - if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) { + if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) { global $outputlangsbis; $outputlangsbis = new Translate('', $conf); $outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE); @@ -201,46 +201,46 @@ class pdf_cornas extends ModelePDFSuppliersOrders $nblines = count($object->lines); - $hidetop=0; - if(!empty($conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE)){ - $hidetop=$conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE; + $hidetop = 0; + if (!empty($conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE)) { + $hidetop = $conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE; } // Loop on each lines to detect if there is at least one image to show - $realpatharray=array(); - if (! empty($conf->global->MAIN_GENERATE_SUPPLIER_ORDER_WITH_PICTURE)) + $realpatharray = array(); + if (!empty($conf->global->MAIN_GENERATE_SUPPLIER_ORDER_WITH_PICTURE)) { - for ($i = 0 ; $i < $nblines ; $i++) + for ($i = 0; $i < $nblines; $i++) { if (empty($object->lines[$i]->fk_product)) continue; $objphoto = new Product($this->db); $objphoto->fetch($object->lines[$i]->fk_product); - if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) + if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { - $pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product') . $object->lines[$i]->fk_product ."/photos/"; + $pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product').$object->lines[$i]->fk_product."/photos/"; $dir = $conf->product->dir_output.'/'.$pdir; } else { - $pdir = get_exdir(0, 2, 0, 0, $objphoto, 'product') . dol_sanitizeFileName($objphoto->ref).'/'; + $pdir = get_exdir(0, 2, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; $dir = $conf->product->dir_output.'/'.$pdir; } - $realpath=''; + $realpath = ''; foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) { - $filename=$obj['photo']; + $filename = $obj['photo']; //if ($obj['photo_vignette']) $filename='thumbs/'.$obj['photo_vignette']; $realpath = $dir.$filename; break; } - if ($realpath) $realpatharray[$i]=$realpath; + if ($realpath) $realpatharray[$i] = $realpath; } } - if (count($realpatharray) == 0) $this->posxpicture=$this->posxtva; + if (count($realpatharray) == 0) $this->posxpicture = $this->posxtva; if ($conf->fournisseur->commande->dir_output) { @@ -279,24 +279,24 @@ class pdf_cornas extends ModelePDFSuppliersOrders if (file_exists($dir)) { // Add pdfgeneration hook - if (! is_object($hookmanager)) + if (!is_object($hookmanager)) { include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager=new HookManager($this->db); + $hookmanager = new HookManager($this->db); } $hookmanager->initHooks(array('pdfgeneration')); - $parameters=array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); global $action; - $reshook=$hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks + $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $nblines = count($object->lines); - $pdf=pdf_getInstance($this->format); - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance - $heightforinfotot = 50; // Height reserved to output the info and total part - $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6; + $pdf = pdf_getInstance($this->format); + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance + $heightforinfotot = 50; // Height reserved to output the info and total part + $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) + if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -354,28 +354,28 @@ class pdf_cornas extends ModelePDFSuppliersOrders $tab_top -= 2; $pdf->SetFont('', '', $default_font_size - 1); - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($desc_incoterms), 0, 1); $nexY = $pdf->GetY(); - $height_incoterms=$nexY-$tab_top; + $height_incoterms = $nexY - $tab_top; // Rect takes a length in 3rd parameter $pdf->SetDrawColor(192, 192, 192); - $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1); + $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1); - $tab_top = $nexY+6; + $tab_top = $nexY + 6; } } // Affiche notes - $notetoshow=empty($object->note_public)?'':$object->note_public; + $notetoshow = empty($object->note_public) ? '' : $object->note_public; $pagenb = $pdf->getPage(); if ($notetoshow) { - $tab_width = $this->page_largeur-$this->marge_gauche-$this->marge_droite; + $tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite; $pageposbeforenote = $pagenb; - $substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object); + $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object); $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs); $notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow); @@ -497,98 +497,98 @@ class pdf_cornas extends ModelePDFSuppliersOrders $this->prepareArrayColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref); // Loop on each lines - $pageposbeforeprintlines=$pdf->getPage(); + $pageposbeforeprintlines = $pdf->getPage(); $pagenb = $pageposbeforeprintlines; - for ($i = 0 ; $i < $nblines ; $i++) + for ($i = 0; $i < $nblines; $i++) { $curY = $nexY; - $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage + $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage $pdf->SetTextColor(0, 0, 0); // Define size of image if we need it - $imglinesize=array(); - if (! empty($realpatharray[$i])) $imglinesize=pdf_getSizeForImage($realpatharray[$i]); + $imglinesize = array(); + if (!empty($realpatharray[$i])) $imglinesize = pdf_getSizeForImage($realpatharray[$i]); $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. - $pageposbefore=$pdf->getPage(); + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pageposbefore = $pdf->getPage(); - $showpricebeforepagebreak=1; - $posYAfterImage=0; - $posYAfterDescription=0; + $showpricebeforepagebreak = 1; + $posYAfterImage = 0; + $posYAfterDescription = 0; // We start with Photo of product line - if (!empty($imglinesize['width']) && !empty($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur-($heightforfooter+$heightforfreetext+$heightforinfotot))) // If photo too high, we moved completely on new page + if (!empty($imglinesize['width']) && !empty($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // If photo too high, we moved completely on new page { $pdf->AddPage('', '', true); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - $pdf->setPage($pageposbefore+1); + $pdf->setPage($pageposbefore + 1); $curY = $tab_top_newpage; - $showpricebeforepagebreak=0; + $showpricebeforepagebreak = 0; } if (!empty($imglinesize['width']) && !empty($imglinesize['height'])) { - $curX = $this->posxpicture-1; - $pdf->Image($realpatharray[$i], $curX + (($this->posxtva-$this->posxpicture-$imglinesize['width'])/2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi + $curX = $this->posxpicture - 1; + $pdf->Image($realpatharray[$i], $curX + (($this->posxtva - $this->posxpicture - $imglinesize['width']) / 2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi // $pdf->Image does not increase value return by getY, so we save it manually - $posYAfterImage=$curY+$imglinesize['height']; + $posYAfterImage = $curY + $imglinesize['height']; } // Description of product line - $curX = $this->posxdesc-1; - $showpricebeforepagebreak=1; + $curX = $this->posxdesc - 1; + $showpricebeforepagebreak = 1; - if($this->getColumnStatus('desc')) + if ($this->getColumnStatus('desc')) { $pdf->startTransaction(); pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc); - $pageposafter=$pdf->getPage(); + $pageposafter = $pdf->getPage(); if ($pageposafter > $pageposbefore) // There is a pagebreak { $pdf->rollbackTransaction(true); - $pageposafter=$pageposbefore; + $pageposafter = $pageposbefore; //print $pageposafter.'-'.$pageposbefore;exit; - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc); - $pageposafter=$pdf->getPage(); - $posyafter=$pdf->GetY(); - if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text + $pageposafter = $pdf->getPage(); + $posyafter = $pdf->GetY(); + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text { - if ($i == ($nblines-1)) // No more lines, and no space left to show total, so we create a new page + if ($i == ($nblines - 1)) // No more lines, and no space left to show total, so we create a new page { $pdf->AddPage('', '', true); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); //if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - $pdf->setPage($pageposafter+1); + $pdf->setPage($pageposafter + 1); } } else { // We found a page break - $showpricebeforepagebreak=0; + $showpricebeforepagebreak = 0; } } else // No pagebreak { $pdf->commitTransaction(); } - $posYAfterDescription=$pdf->GetY(); + $posYAfterDescription = $pdf->GetY(); } $nexY = $pdf->GetY(); - $pageposafter=$pdf->getPage(); + $pageposafter = $pdf->getPage(); $pdf->setPage($pageposbefore); $pdf->setTopMargin($this->marge_haute); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { $pdf->setPage($pageposafter); $curY = $tab_top_newpage; } - $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut + $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut // VAT Rate if ($this->getColumnStatus('vat')) @@ -641,7 +641,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders } - $parameters=array( + $parameters = array( 'object' => $object, 'i' => $i, 'pdf' =>& $pdf, @@ -650,58 +650,58 @@ class pdf_cornas extends ModelePDFSuppliersOrders 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails ); - $reshook=$hookmanager->executeHooks('printPDFline', $parameters, $this); // Note that $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printPDFline', $parameters, $this); // Note that $object may have been modified by hook // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva - if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; - else $tvaligne=$object->lines[$i]->total_tva; + if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne = $object->lines[$i]->multicurrency_total_tva; + else $tvaligne = $object->lines[$i]->total_tva; - $localtax1ligne=$object->lines[$i]->total_localtax1; - $localtax2ligne=$object->lines[$i]->total_localtax2; - $localtax1_rate=$object->lines[$i]->localtax1_tx; - $localtax2_rate=$object->lines[$i]->localtax2_tx; - $localtax1_type=$object->lines[$i]->localtax1_type; - $localtax2_type=$object->lines[$i]->localtax2_type; + $localtax1ligne = $object->lines[$i]->total_localtax1; + $localtax2ligne = $object->lines[$i]->total_localtax2; + $localtax1_rate = $object->lines[$i]->localtax1_tx; + $localtax2_rate = $object->lines[$i]->localtax2_tx; + $localtax1_type = $object->lines[$i]->localtax1_type; + $localtax2_type = $object->lines[$i]->localtax2_type; - if (! empty($object->remise_percent)) $tvaligne-=($tvaligne*$object->remise_percent)/100; - if (! empty($object->remise_percent)) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100; - if (! empty($object->remise_percent)) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100; + if (!empty($object->remise_percent)) $tvaligne -= ($tvaligne * $object->remise_percent) / 100; + if (!empty($object->remise_percent)) $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100; + if (!empty($object->remise_percent)) $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100; - $vatrate=(string) $object->lines[$i]->tva_tx; + $vatrate = (string) $object->lines[$i]->tva_tx; // Retrieve type from database for backward compatibility with old records - if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined - && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax + if ((!isset($localtax1_type) || $localtax1_type == '' || !isset($localtax2_type) || $localtax2_type == '') // if tax type not defined + && (!empty($localtax1_rate) || !empty($localtax2_rate))) // and there is local tax { - $localtaxtmp_array=getLocalTaxesFromRate($vatrate, 0, $mysoc, $object->thirdparty); + $localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $mysoc, $object->thirdparty); $localtax1_type = $localtaxtmp_array[0]; $localtax2_type = $localtaxtmp_array[2]; } // retrieve global local tax if ($localtax1_type && $localtax1ligne != 0) - $this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne; + $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne; if ($localtax2_type && $localtax2ligne != 0) - $this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne; + $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne; - if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; - if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=0; + if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate .= '*'; + if (!isset($this->tva[$vatrate])) $this->tva[$vatrate] = 0; $this->tva[$vatrate] += $tvaligne; - if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage; + if ($posYAfterImage > $posYAfterDescription) $nexY = $posYAfterImage; // Add line - if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) + if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) { $pdf->setPage($pageposafter); - $pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80,80,80))); + $pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80))); //$pdf->SetDrawColor(190,190,200); - $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); + $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1); $pdf->SetLineStyle(array('dash'=>0)); } - $nexY+=2; // Add space between lines + $nexY += 2; // Add space between lines // Detect if some page were added automatically and output _tableau for past pages while ($pagenb < $pageposafter) @@ -774,31 +774,31 @@ class pdf_cornas extends ModelePDFSuppliersOrders // Add pdfgeneration hook $hookmanager->initHooks(array('pdfgeneration')); - $parameters=array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); global $action; - $reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; } - if (! empty($conf->global->MAIN_UMASK)) + if (!empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); $this->result = array('fullpath'=>$file); - return 1; // No error + return 1; // No error } else { - $this->error=$langs->trans("ErrorCanNotCreateDir", $dir); + $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); return 0; } } else { - $this->error=$langs->trans("ErrorConstantNotDefined", "SUPPLIER_OUTPUTDIR"); + $this->error = $langs->trans("ErrorConstantNotDefined", "SUPPLIER_OUTPUTDIR"); return 0; } } @@ -858,11 +858,11 @@ class pdf_cornas extends ModelePDFSuppliersOrders $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement); - $lib_condition_paiement=str_replace('\n', "\n", $lib_condition_paiement); + $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement); + $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); $pdf->MultiCell(80, 4, $lib_condition_paiement, 0, 'L'); - $posy=$pdf->GetY()+3; + $posy = $pdf->GetY() + 3; } // Show payment mode @@ -993,7 +993,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders //Local tax 1 foreach ($this->localtax1 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; + if (in_array((string) $localtax_type, array('2', '4', '6'))) continue; foreach ($localtax_rate as $tvakey => $tvaval) { @@ -1004,15 +1004,15 @@ class pdf_cornas extends ModelePDFSuppliersOrders $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat =$outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); @@ -1133,12 +1133,12 @@ class pdf_cornas extends ModelePDFSuppliersOrders if (empty($hidetop)) { $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency)); - $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4); + $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; - if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) { + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); } } @@ -1146,17 +1146,17 @@ class pdf_cornas extends ModelePDFSuppliersOrders $pdf->SetFont('', '', $default_font_size - 1); // Output Rect - $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter + $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter foreach ($this->cols as $colKey => $colDef) { - if(!$this->getColumnStatus($colKey)) continue; + if (!$this->getColumnStatus($colKey)) continue; // get title label - $colDef['title']['label'] = !empty($colDef['title']['label'])?$colDef['title']['label']:$outputlangs->transnoentities($colDef['title']['textkey']); + $colDef['title']['label'] = !empty($colDef['title']['label']) ? $colDef['title']['label'] : $outputlangs->transnoentities($colDef['title']['textkey']); // Add column separator - if(!empty($colDef['border-left'])){ + if (!empty($colDef['border-left'])) { $pdf->line($colDef['xStartPos'], $tab_top, $colDef['xStartPos'], $tab_top + $tab_height); } @@ -1164,13 +1164,13 @@ class pdf_cornas extends ModelePDFSuppliersOrders { $pdf->SetXY($colDef['xStartPos'] + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0]); - $textWidth = $colDef['width'] - $colDef['title']['padding'][3] -$colDef['title']['padding'][1]; + $textWidth = $colDef['width'] - $colDef['title']['padding'][3] - $colDef['title']['padding'][1]; $pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $colDef['title']['align']); } } - if (empty($hidetop)){ - $pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line takes a position y in 2nd parameter and 4th parameter + if (empty($hidetop)) { + $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5); // line takes a position y in 2nd parameter and 4th parameter } } @@ -1206,19 +1206,19 @@ class pdf_cornas extends ModelePDFSuppliersOrders $pdf->SetTextColor(0, 0, 60); $pdf->SetFont('', 'B', $default_font_size + 3); - $posx=$this->page_largeur-$this->marge_droite-100; - $posy=$this->marge_haute; + $posx = $this->page_largeur - $this->marge_droite - 100; + $posy = $this->marge_haute; $pdf->SetXY($this->marge_gauche, $posy); // Logo - $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; + $logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; if ($this->emetteur->logo) { if (is_readable($logo)) { - $height=pdf_getHeightForLogo($logo); - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) + $height = pdf_getHeightForLogo($logo); + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } else { @@ -1230,91 +1230,91 @@ class pdf_cornas extends ModelePDFSuppliersOrders } else { - $text=$this->emetteur->name; + $text = $this->emetteur->name; $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } $pdf->SetFont('', 'B', $default_font_size + 3); $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $title=$outputlangs->transnoentities("SupplierOrder")." ".$outputlangs->convToOutputCharset($object->ref); + $title = $outputlangs->transnoentities("SupplierOrder")." ".$outputlangs->convToOutputCharset($object->ref); $pdf->MultiCell(100, 3, $title, '', 'R'); - $posy+=1; + $posy += 1; if ($object->ref_supplier) { - $posy+=4; + $posy += 4; $pdf->SetFont('', 'B', $default_font_size); $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefSupplier")." : " . $outputlangs->convToOutputCharset($object->ref_supplier), '', 'R'); - $posy+=1; + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefSupplier")." : ".$outputlangs->convToOutputCharset($object->ref_supplier), '', 'R'); + $posy += 1; } - $pdf->SetFont('', '', $default_font_size -1); + $pdf->SetFont('', '', $default_font_size - 1); - if (! empty($conf->global->PDF_SHOW_PROJECT)) + if (!empty($conf->global->PDF_SHOW_PROJECT)) { $object->fetch_projet(); - if (! empty($object->project->ref)) + if (!empty($object->project->ref)) { - $posy+=4; + $posy += 4; $pdf->SetXY($posx, $posy); $langs->load("projects"); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R'); } } - if (! empty($object->date_commande)) + if (!empty($object->date_commande)) { - $posy+=5; + $posy += 5; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : " . dol_print_date($object->date_commande, "day", false, $outputlangs, true), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($object->date_commande, "day", false, $outputlangs, true), '', 'R'); } else { - $posy+=5; + $posy += 5; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(255, 0, 0); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderToProcess"), '', 'R'); } $pdf->SetTextColor(0, 0, 60); - $usehourmin='day'; - if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin='dayhour'; - if (! empty($object->date_livraison)) + $usehourmin = 'day'; + if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin = 'dayhour'; + if (!empty($object->date_livraison)) { - $posy+=4; - $pdf->SetXY($posx-90, $posy); - $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : " . dol_print_date($object->date_livraison, $usehourmin, false, $outputlangs, true), '', 'R'); + $posy += 4; + $pdf->SetXY($posx - 90, $posy); + $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_livraison, $usehourmin, false, $outputlangs, true), '', 'R'); } if ($object->thirdparty->code_fournisseur) { - $posy+=4; + $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_fournisseur), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_fournisseur), '', 'R'); } // Get contact if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP)) { - $arrayidcontact=$object->getIdContact('internal', 'SALESREPFOLL'); + $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL'); if (count($arrayidcontact) > 0) { - $usertmp=new User($this->db); + $usertmp = new User($this->db); $usertmp->fetch($arrayidcontact[0]); - $posy+=4; + $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); $pdf->MultiCell(100, 3, $langs->trans("BuyerName")." : ".$usertmp->getFullName($langs), '', 'R'); } } - $posy+=1; + $posy += 1; $pdf->SetTextColor(0, 0, 60); $top_shift = 0; @@ -1666,10 +1666,10 @@ class pdf_cornas extends ModelePDFSuppliersOrders uasort($this->cols, array($this, 'columnSort')); // Positionning - $curX = $this->page_largeur-$this->marge_droite; // start from right + $curX = $this->page_largeur - $this->marge_droite; // start from right // Array width - $arrayWidth = $this->page_largeur-$this->marge_droite-$this->marge_gauche; + $arrayWidth = $this->page_largeur - $this->marge_droite - $this->marge_gauche; // Count flexible column $totalDefinedColWidth = 0; @@ -1818,16 +1818,16 @@ class pdf_cornas extends ModelePDFSuppliersOrders { global $hookmanager; - $parameters=array( + $parameters = array( 'curY' =>& $curY, 'columnText' => $columnText, 'colKey' => $colKey ); - $reshook=$hookmanager->executeHooks('printStdColumnContent', $parameters, $this); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printStdColumnContent', $parameters, $this); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (!$reshook) { - if(empty($columnText)) return; + if (empty($columnText)) return; $pdf->SetXY($this->getColumnContentXStart($colKey), $curY); // Set curent position $colDef = $this->cols[$colKey]; $pdf->MultiCell($this->getColumnContentWidth($colKey), 2, $columnText, '', $colDef['content']['align']); diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index 2da47c09205..395e461e807 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -133,66 +133,66 @@ class pdf_muscadet extends ModelePDFSuppliersOrders // Page size for A4 format $this->type = 'pdf'; - $formatarray=pdf_getFormat(); + $formatarray = pdf_getFormat(); $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; - $this->format = array($this->page_largeur,$this->page_hauteur); - $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; - $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; - $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; - $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; + $this->format = array($this->page_largeur, $this->page_hauteur); + $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; + $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; + $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; + $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; - $this->option_logo = 1; // Affiche logo - $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION - $this->option_modereg = 1; // Affiche mode reglement - $this->option_condreg = 1; // Affiche conditions reglement - $this->option_codeproduitservice = 1; // Affiche code produit-service - $this->option_multilang = 1; // Dispo en plusieurs langues - $this->option_escompte = 0; // Affiche si il y a eu escompte - $this->option_credit_note = 0; // Support credit notes - $this->option_freetext = 1; // Support add of a personalised text - $this->option_draft_watermark = 1; // Support add of a watermark on drafts + $this->option_logo = 1; // Affiche logo + $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION + $this->option_modereg = 1; // Affiche mode reglement + $this->option_condreg = 1; // Affiche conditions reglement + $this->option_codeproduitservice = 1; // Affiche code produit-service + $this->option_multilang = 1; // Dispo en plusieurs langues + $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_credit_note = 0; // Support credit notes + $this->option_freetext = 1; // Support add of a personalised text + $this->option_draft_watermark = 1; // Support add of a watermark on drafts // Get source company - $this->emetteur=$mysoc; - if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default, if was not defined + $this->emetteur = $mysoc; + if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined // Define position of columns - $this->posxdesc=$this->marge_gauche+1; - $this->posxdiscount=162; - $this->postotalht=174; + $this->posxdesc = $this->marge_gauche + 1; + $this->posxdiscount = 162; + $this->postotalht = 174; if ($conf->global->PRODUCT_USE_UNITS) { - $this->posxtva=95; - $this->posxup=114; - $this->posxqty=132; - $this->posxunit=147; + $this->posxtva = 95; + $this->posxup = 114; + $this->posxqty = 132; + $this->posxunit = 147; } else { - $this->posxtva=110; - $this->posxup=126; - $this->posxqty=145; - $this->posxunit=162; + $this->posxtva = 110; + $this->posxup = 126; + $this->posxqty = 145; + $this->posxunit = 162; } - if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxup = $this->posxtva; // posxtva is picture position reference - $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxup = $this->posxtva; // posxtva is picture position reference + $this->posxpicture = $this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images if ($this->page_largeur < 210) // To work with US executive format { - $this->posxpicture-=20; - $this->posxtva-=20; - $this->posxup-=20; - $this->posxqty-=20; - $this->posxunit-=20; - $this->posxdiscount-=20; - $this->postotalht-=20; + $this->posxpicture -= 20; + $this->posxtva -= 20; + $this->posxup -= 20; + $this->posxqty -= 20; + $this->posxunit -= 20; + $this->posxdiscount -= 20; + $this->postotalht -= 20; } - $this->tva=array(); - $this->localtax1=array(); - $this->localtax2=array(); - $this->atleastoneratenotnull=0; - $this->atleastonediscount=0; + $this->tva = array(); + $this->localtax1 = array(); + $this->localtax2 = array(); + $this->atleastoneratenotnull = 0; + $this->atleastonediscount = 0; } @@ -211,11 +211,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders public function write_file($object, $outputlangs = '', $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable - global $user,$langs,$conf,$hookmanager,$mysoc,$nblines; + global $user, $langs, $conf, $hookmanager, $mysoc, $nblines; - if (! is_object($outputlangs)) $outputlangs=$langs; + if (!is_object($outputlangs)) $outputlangs = $langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO - if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; + if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; // Load translation files required by the page $outputlangs->loadLangs(array("main", "orders", "companies", "bills", "dict", "products")); @@ -223,40 +223,40 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $nblines = count($object->lines); // Loop on each lines to detect if there is at least one image to show - $realpatharray=array(); - if (! empty($conf->global->MAIN_GENERATE_SUPPLIER_ORDER_WITH_PICTURE)) + $realpatharray = array(); + if (!empty($conf->global->MAIN_GENERATE_SUPPLIER_ORDER_WITH_PICTURE)) { - for ($i = 0 ; $i < $nblines ; $i++) + for ($i = 0; $i < $nblines; $i++) { if (empty($object->lines[$i]->fk_product)) continue; $objphoto = new Product($this->db); $objphoto->fetch($object->lines[$i]->fk_product); - if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) + if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { - $pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product') . $object->lines[$i]->fk_product ."/photos/"; + $pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product').$object->lines[$i]->fk_product."/photos/"; $dir = $conf->product->dir_output.'/'.$pdir; } else { - $pdir = get_exdir(0, 2, 0, 0, $objphoto, 'product') . dol_sanitizeFileName($objphoto->ref).'/'; + $pdir = get_exdir(0, 2, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; $dir = $conf->product->dir_output.'/'.$pdir; } - $realpath=''; + $realpath = ''; foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) { - $filename=$obj['photo']; + $filename = $obj['photo']; //if ($obj['photo_vignette']) $filename='thumbs/'.$obj['photo_vignette']; $realpath = $dir.$filename; break; } - if ($realpath) $realpatharray[$i]=$realpath; + if ($realpath) $realpatharray[$i] = $realpath; } } - if (count($realpatharray) == 0) $this->posxpicture=$this->posxtva; + if (count($realpatharray) == 0) $this->posxpicture = $this->posxtva; if ($conf->fournisseur->commande->dir_output) { @@ -272,22 +272,22 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if ($object->specimen) { $dir = $conf->fournisseur->commande->dir_output; - $file = $dir . "/SPECIMEN.pdf"; + $file = $dir."/SPECIMEN.pdf"; } else { $objectref = dol_sanitizeFileName($object->ref); $objectrefsupplier = dol_sanitizeFileName($object->ref_supplier); - $dir = $conf->fournisseur->commande->dir_output . '/'. $objectref; - $file = $dir . "/" . $objectref . ".pdf"; - if (! empty($conf->global->SUPPLIER_REF_IN_NAME)) $file = $dir . "/" . $objectref . ($objectrefsupplier?"_".$objectrefsupplier:"").".pdf"; + $dir = $conf->fournisseur->commande->dir_output.'/'.$objectref; + $file = $dir."/".$objectref.".pdf"; + if (!empty($conf->global->SUPPLIER_REF_IN_NAME)) $file = $dir."/".$objectref.($objectrefsupplier ? "_".$objectrefsupplier : "").".pdf"; } - if (! file_exists($dir)) + if (!file_exists($dir)) { if (dol_mkdir($dir) < 0) { - $this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir); + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; } } @@ -295,24 +295,24 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if (file_exists($dir)) { // Add pdfgeneration hook - if (! is_object($hookmanager)) + if (!is_object($hookmanager)) { include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager=new HookManager($this->db); + $hookmanager = new HookManager($this->db); } $hookmanager->initHooks(array('pdfgeneration')); - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); global $action; - $reshook=$hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks + $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $nblines = count($object->lines); - $pdf=pdf_getInstance($this->format); - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance - $heightforinfotot = 50; // Height reserved to output the info and total part - $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6; + $pdf = pdf_getInstance($this->format); + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance + $heightforinfotot = 50; // Height reserved to output the info and total part + $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) + if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -322,14 +322,14 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } $pdf->SetFont(pdf_getPDFFont($outputlangs)); // Set path to the background PDF File - if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) + if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) { $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); $tplidx = $pdf->importPage(1); } $pdf->Open(); - $pagenb=0; + $pagenb = 0; $pdf->SetDrawColor(128, 128, 128); $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); @@ -337,12 +337,12 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); - $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right // Positionne $this->atleastonediscount si on a au moins une remise - for ($i = 0 ; $i < $nblines ; $i++) + for ($i = 0; $i < $nblines; $i++) { if ($object->lines[$i]->remise_percent) { @@ -352,26 +352,26 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if (empty($this->atleastonediscount)) { $delta = ($this->postotalht - $this->posxdiscount); - $this->posxpicture+=$delta; - $this->posxtva+=$delta; - $this->posxup+=$delta; - $this->posxqty+=$delta; - $this->posxunit+=$delta; - $this->posxdiscount+=$delta; + $this->posxpicture += $delta; + $this->posxtva += $delta; + $this->posxup += $delta; + $this->posxqty += $delta; + $this->posxunit += $delta; + $this->posxdiscount += $delta; // post of fields after are not modified, stay at same position } // New page $pdf->AddPage(); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs); $pdf->SetFont('', '', $default_font_size - 1); - $pdf->MultiCell(0, 3, ''); // Set interline to 3 + $pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->SetTextColor(0, 0, 0); - $tab_top = 90+$top_shift; - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42+$top_shift:10); + $tab_top = 90 + $top_shift; + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); // Incoterm if ($conf->incoterm->enabled) @@ -382,33 +382,33 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $tab_top -= 2; $pdf->SetFont('', '', $default_font_size - 1); - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($desc_incoterms), 0, 1); $nexY = $pdf->GetY(); - $height_incoterms=$nexY-$tab_top; + $height_incoterms = $nexY - $tab_top; // Rect takes a length in 3rd parameter $pdf->SetDrawColor(192, 192, 192); - $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1); + $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1); - $tab_top = $nexY+6; + $tab_top = $nexY + 6; } } // Affiche notes - if (! empty($object->note_public)) + if (!empty($object->note_public)) { $tab_top -= 2; $pdf->SetFont('', '', $default_font_size - 1); - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($object->note_public), 0, 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($object->note_public), 0, 1); $nexY = $pdf->GetY(); - $height_note=$nexY-$tab_top; + $height_note = $nexY - $tab_top; // Rect takes a length in 3rd parameter $pdf->SetDrawColor(192, 192, 192); - $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1); + $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); - $tab_top = $nexY+6; + $tab_top = $nexY + 6; } $iniY = $tab_top + 7; @@ -416,81 +416,81 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $nexY = $tab_top + 7; // Loop on each lines - for ($i = 0 ; $i < $nblines ; $i++) + for ($i = 0; $i < $nblines; $i++) { $curY = $nexY; - $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage + $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage $pdf->SetTextColor(0, 0, 0); // Define size of image if we need it - $imglinesize=array(); - if (! empty($realpatharray[$i])) $imglinesize=pdf_getSizeForImage($realpatharray[$i]); + $imglinesize = array(); + if (!empty($realpatharray[$i])) $imglinesize = pdf_getSizeForImage($realpatharray[$i]); $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. - $pageposbefore=$pdf->getPage(); + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pageposbefore = $pdf->getPage(); - $showpricebeforepagebreak=1; - $posYAfterImage=0; - $posYAfterDescription=0; + $showpricebeforepagebreak = 1; + $posYAfterImage = 0; + $posYAfterDescription = 0; // We start with Photo of product line - if (!empty($imglinesize['width']) && !empty($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur-($heightforfooter+$heightforfreetext+$heightforinfotot))) // If photo too high, we moved completely on new page + if (!empty($imglinesize['width']) && !empty($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // If photo too high, we moved completely on new page { $pdf->AddPage('', '', true); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - $pdf->setPage($pageposbefore+1); + $pdf->setPage($pageposbefore + 1); $curY = $tab_top_newpage; - $showpricebeforepagebreak=0; + $showpricebeforepagebreak = 0; } if (!empty($imglinesize['width']) && !empty($imglinesize['height'])) { - $curX = $this->posxpicture-1; - $pdf->Image($realpatharray[$i], $curX + (($this->posxtva-$this->posxpicture-$imglinesize['width'])/2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi + $curX = $this->posxpicture - 1; + $pdf->Image($realpatharray[$i], $curX + (($this->posxtva - $this->posxpicture - $imglinesize['width']) / 2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi // $pdf->Image does not increase value return by getY, so we save it manually - $posYAfterImage=$curY+$imglinesize['height']; + $posYAfterImage = $curY + $imglinesize['height']; } // Description of product line - $curX = $this->posxdesc-1; - $showpricebeforepagebreak=1; + $curX = $this->posxdesc - 1; + $showpricebeforepagebreak = 1; $pdf->startTransaction(); if ($posYAfterImage > 0) { - $descWidth = $this->posxpicture-$curX; + $descWidth = $this->posxpicture - $curX; } else { - $descWidth = $this->posxtva-$curX; + $descWidth = $this->posxtva - $curX; } pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc, 1); - $pageposafter=$pdf->getPage(); + $pageposafter = $pdf->getPage(); if ($pageposafter > $pageposbefore) // There is a pagebreak { $pdf->rollbackTransaction(true); - $pageposafter=$pageposbefore; + $pageposafter = $pageposbefore; //print $pageposafter.'-'.$pageposbefore;exit; - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc, 1); - $posyafter=$pdf->GetY(); - if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text + $posyafter = $pdf->GetY(); + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text { - if ($i == ($nblines-1)) // No more lines, and no space left to show total, so we create a new page + if ($i == ($nblines - 1)) // No more lines, and no space left to show total, so we create a new page { $pdf->AddPage('', '', true); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - $pdf->setPage($pageposafter+1); + $pdf->setPage($pageposafter + 1); } } else { // We found a page break - $showpricebeforepagebreak=0; + $showpricebeforepagebreak = 0; } } else // No pagebreak @@ -499,42 +499,42 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } $nexY = $pdf->GetY(); - $pageposafter=$pdf->getPage(); + $pageposafter = $pdf->getPage(); $pdf->setPage($pageposbefore); $pdf->setTopMargin($this->marge_haute); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { $pdf->setPage($pageposafter); $curY = $tab_top_newpage; } - $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut + $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut // VAT Rate if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->posxtva, $curY); - $pdf->MultiCell($this->posxup-$this->posxtva-1, 3, $vat_rate, 0, 'R'); + $pdf->MultiCell($this->posxup - $this->posxtva - 1, 3, $vat_rate, 0, 'R'); } // Unit price before discount $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->posxup, $curY); - $pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, $up_excl_tax, 0, 'R', 0); + $pdf->MultiCell($this->posxqty - $this->posxup - 0.8, 3, $up_excl_tax, 0, 'R', 0); // Quantity $qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->posxqty, $curY); - $pdf->MultiCell($this->posxunit-$this->posxqty-0.8, 4, $qty, 0, 'R'); // Enough for 6 chars + $pdf->MultiCell($this->posxunit - $this->posxqty - 0.8, 4, $qty, 0, 'R'); // Enough for 6 chars // Unit - if($conf->global->PRODUCT_USE_UNITS) + if ($conf->global->PRODUCT_USE_UNITS) { $unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager); $pdf->SetXY($this->posxunit, $curY); - $pdf->MultiCell($this->posxdiscount-$this->posxunit-0.8, 4, $unit, 0, 'L'); + $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 4, $unit, 0, 'L'); } // Discount on line @@ -542,63 +542,63 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if ($object->lines[$i]->remise_percent) { $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails); - $pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 3, $remise_percent, 0, 'R'); + $pdf->MultiCell($this->postotalht - $this->posxdiscount - 1, 3, $remise_percent, 0, 'R'); } // Total HT line $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs); $pdf->SetXY($this->postotalht, $curY); - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0, 'R', 0); // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva - if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; - else $tvaligne=$object->lines[$i]->total_tva; + if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne = $object->lines[$i]->multicurrency_total_tva; + else $tvaligne = $object->lines[$i]->total_tva; - $localtax1ligne=$object->lines[$i]->total_localtax1; - $localtax2ligne=$object->lines[$i]->total_localtax2; - $localtax1_rate=$object->lines[$i]->localtax1_tx; - $localtax2_rate=$object->lines[$i]->localtax2_tx; - $localtax1_type=$object->lines[$i]->localtax1_type; - $localtax2_type=$object->lines[$i]->localtax2_type; + $localtax1ligne = $object->lines[$i]->total_localtax1; + $localtax2ligne = $object->lines[$i]->total_localtax2; + $localtax1_rate = $object->lines[$i]->localtax1_tx; + $localtax2_rate = $object->lines[$i]->localtax2_tx; + $localtax1_type = $object->lines[$i]->localtax1_type; + $localtax2_type = $object->lines[$i]->localtax2_type; - if (! empty($object->remise_percent)) $tvaligne-=($tvaligne*$object->remise_percent)/100; - if (! empty($object->remise_percent)) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100; - if (! empty($object->remise_percent)) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100; + if (!empty($object->remise_percent)) $tvaligne -= ($tvaligne * $object->remise_percent) / 100; + if (!empty($object->remise_percent)) $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100; + if (!empty($object->remise_percent)) $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100; - $vatrate=(string) $object->lines[$i]->tva_tx; + $vatrate = (string) $object->lines[$i]->tva_tx; // Retrieve type from database for backward compatibility with old records - if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined - && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax + if ((!isset($localtax1_type) || $localtax1_type == '' || !isset($localtax2_type) || $localtax2_type == '') // if tax type not defined + && (!empty($localtax1_rate) || !empty($localtax2_rate))) // and there is local tax { - $localtaxtmp_array=getLocalTaxesFromRate($vatrate, 0, $mysoc, $object->thirdparty); + $localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $mysoc, $object->thirdparty); $localtax1_type = $localtaxtmp_array[0]; $localtax2_type = $localtaxtmp_array[2]; } // retrieve global local tax if ($localtax1_type && $localtax1ligne != 0) - $this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne; + $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne; if ($localtax2_type && $localtax2ligne != 0) - $this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne; + $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne; - if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; - if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=0; + if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate .= '*'; + if (!isset($this->tva[$vatrate])) $this->tva[$vatrate] = 0; $this->tva[$vatrate] += $tvaligne; - if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage; + if ($posYAfterImage > $posYAfterDescription) $nexY = $posYAfterImage; // Add line - if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) + if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) { $pdf->setPage($pageposafter); - $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80))); + $pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80))); //$pdf->SetDrawColor(190,190,200); - $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); + $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1); $pdf->SetLineStyle(array('dash'=>0)); } - $nexY+=2; // Add space between lines + $nexY += 2; // Add space between lines // Detect if some page were added automatically and output _tableau for past pages while ($pagenb < $pageposafter) @@ -615,10 +615,10 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $this->_pagefoot($pdf, $object, $outputlangs, 1); $pagenb++; $pdf->setPage($pagenb); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); } - if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) + if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { if ($pagenb == 1) { @@ -631,7 +631,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $this->_pagefoot($pdf, $object, $outputlangs, 1); // New page $pdf->AddPage(); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); } @@ -641,24 +641,24 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if ($pagenb == 1) { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code); - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } // Affiche zone infos - $posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); + $posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); // Affiche zone totaux - $posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); + $posy = $this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); // Affiche zone versements if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included) { - $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs); + $posy = $this->_tableau_versements($pdf, $object, $posy, $outputlangs); } // Pied de page @@ -671,31 +671,31 @@ class pdf_muscadet extends ModelePDFSuppliersOrders // Add pdfgeneration hook $hookmanager->initHooks(array('pdfgeneration')); - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); global $action; - $reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; } - if (! empty($conf->global->MAIN_UMASK)) + if (!empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); $this->result = array('fullpath'=>$file); - return 1; // No error + return 1; // No error } else { - $this->error=$langs->trans("ErrorCanNotCreateDir", $dir); + $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); return 0; } } else { - $this->error=$langs->trans("ErrorConstantNotDefined", "SUPPLIER_OUTPUTDIR"); + $this->error = $langs->trans("ErrorConstantNotDefined", "SUPPLIER_OUTPUTDIR"); return 0; } } @@ -740,10 +740,10 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetXY($this->marge_gauche, $posy); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); - $posy=$pdf->GetY()+4; + $posy = $pdf->GetY() + 4; } - $posxval=52; + $posxval = 52; // Show payments conditions if (!empty($object->cond_reglement_code) || $object->cond_reglement) @@ -755,11 +755,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement); - $lib_condition_paiement=str_replace('\n', "\n", $lib_condition_paiement); + $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement); + $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); $pdf->MultiCell(80, 4, $lib_condition_paiement, 0, 'L'); - $posy=$pdf->GetY()+3; + $posy = $pdf->GetY() + 3; } // Show payment mode @@ -772,10 +772,10 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $lib_mode_reg=$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code)!=('PaymentType'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code):$outputlangs->convToOutputCharset($object->mode_reglement); + $lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement); $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L'); - $posy=$pdf->GetY()+2; + $posy = $pdf->GetY() + 2; } @@ -797,7 +797,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { // phpcs:enable - global $conf,$mysoc; + global $conf, $mysoc; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -809,27 +809,27 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $col1x = 120; $col2x = 170; if ($this->page_largeur < 210) // To work with US executive format { - $col2x-=20; + $col2x -= 20; } $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x); - $useborder=0; + $useborder = 0; $index = 0; // Total HT $pdf->SetFillColor(255, 255, 255); $pdf->SetXY($col1x, $tab2_top + 0); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); $total_ht = (($conf->multicurrency->enabled && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); $pdf->SetXY($col2x, $tab2_top + 0); - $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (! empty($object->remise)?$object->remise:0)), 0, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (!empty($object->remise) ? $object->remise : 0)), 0, 'R', 1); // Show VAT by rates and total $pdf->SetFillColor(248, 248, 248); - $this->atleastoneratenotnull=0; - foreach($this->tva as $tvakey => $tvaval) + $this->atleastoneratenotnull = 0; + foreach ($this->tva as $tvakey => $tvaval) { if ($tvakey > 0) // On affiche pas taux 0 { @@ -838,47 +838,47 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat =$outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).' '; - $totalvat.=vatrate($tvakey, 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).' '; + $totalvat .= vatrate($tvakey, 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); } } - if (! $this->atleastoneratenotnull) // If no vat at all + if (!$this->atleastoneratenotnull) // If no vat at all { $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code), 0, 'L', 1); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_tva), 0, 'R', 1); // Total LocalTax1 - if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on' && $object->total_localtax1>0) + if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION == 'localtax1on' && $object->total_localtax1 > 0) { $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code), 0, 'L', 1); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), $useborder, 'R', 1); } // Total LocalTax2 - if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on' && $object->total_localtax2>0) + if (!empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION == 'localtax2on' && $object->total_localtax2 > 0) { $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code), 0, 'L', 1); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1); } @@ -888,11 +888,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ //Local tax 1 - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach ($this->localtax1 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; + if (in_array((string) $localtax_type, array('2', '4', '6'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + foreach ($localtax_rate as $tvakey => $tvaval) { if ($tvakey != 0) // On affiche pas taux 0 { @@ -901,15 +901,15 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat =$outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); @@ -920,11 +920,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ //Local tax 2 - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach ($this->localtax2 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; + if (in_array((string) $localtax_type, array('2', '4', '6'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + foreach ($localtax_rate as $tvakey => $tvaval) { if ($tvakey != 0) // On affiche pas taux 0 { @@ -933,15 +933,15 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat =$outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); @@ -955,7 +955,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetTextColor(0, 0, 60); $pdf->SetFillColor(224, 224, 224); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); $total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); @@ -963,13 +963,13 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetFont('', '', $default_font_size - 1); $pdf->SetTextColor(0, 0, 0); - $creditnoteamount=0; - $depositsamount=0; + $creditnoteamount = 0; + $depositsamount = 0; //$creditnoteamount=$object->getSumCreditNotesUsed(); //$depositsamount=$object->getSumDepositsUsed(); //print "x".$creditnoteamount."-".$depositsamount;exit; $resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT'); - if (! empty($object->paye)) $resteapayer=0; + if (!empty($object->paye)) $resteapayer = 0; if ($deja_regle > 0) { @@ -977,7 +977,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid"), 0, 'L', 0); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid"), 0, 'L', 0); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle), 0, 'R', 0); @@ -985,7 +985,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetTextColor(0, 0, 60); $pdf->SetFillColor(224, 224, 224); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer), $useborder, 'R', 1); @@ -1017,8 +1017,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders global $conf; // Force to disable hidetop and hidebottom - $hidebottom=0; - if ($hidetop) $hidetop=-1; + $hidebottom = 0; + if ($hidetop) $hidetop = -1; $currency = !empty($currency) ? $currency : $conf->currency; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -1030,24 +1030,24 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if (empty($hidetop)) { $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency)); - $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4); + $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; - if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); } $pdf->SetDrawColor(128, 128, 128); $pdf->SetFont('', '', $default_font_size - 1); // Output Rect - $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter + $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter if (empty($hidetop)) { - $pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line takes a position y in 2nd parameter and 4th parameter + $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5); // line takes a position y in 2nd parameter and 4th parameter - $pdf->SetXY($this->posxdesc-1, $tab_top+1); + $pdf->SetXY($this->posxdesc - 1, $tab_top + 1); $pdf->MultiCell(108, 2, $outputlangs->transnoentities("Designation"), '', 'L'); } @@ -1056,26 +1056,26 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->line($this->posxtva, $tab_top, $this->posxtva, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posxtva-3, $tab_top+1); - $pdf->MultiCell($this->posxup-$this->posxtva+3, 2, $outputlangs->transnoentities("VAT"), '', 'C'); + $pdf->SetXY($this->posxtva - 3, $tab_top + 1); + $pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities("VAT"), '', 'C'); } } $pdf->line($this->posxup, $tab_top, $this->posxup, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posxup-1, $tab_top+1); - $pdf->MultiCell($this->posxqty-$this->posxup-1, 2, $outputlangs->transnoentities("PriceUHT"), '', 'C'); + $pdf->SetXY($this->posxup - 1, $tab_top + 1); + $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceUHT"), '', 'C'); } - $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); + $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posxqty-1, $tab_top+1); - $pdf->MultiCell($this->posxunit-$this->posxqty-1, 2, $outputlangs->transnoentities("Qty"), '', 'C'); + $pdf->SetXY($this->posxqty - 1, $tab_top + 1); + $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C'); } - if($conf->global->PRODUCT_USE_UNITS) { + if ($conf->global->PRODUCT_USE_UNITS) { $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxunit - 1, $tab_top + 1); @@ -1083,13 +1083,13 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } } - $pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height); + $pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height); if (empty($hidetop)) { if ($this->atleastonediscount) { - $pdf->SetXY($this->posxdiscount-1, $tab_top+1); - $pdf->MultiCell($this->postotalht-$this->posxdiscount+1, 2, $outputlangs->transnoentities("ReductionShort"), '', 'C'); + $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1); + $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities("ReductionShort"), '', 'C'); } } @@ -1099,7 +1099,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } if (empty($hidetop)) { - $pdf->SetXY($this->postotalht-1, $tab_top+1); + $pdf->SetXY($this->postotalht - 1, $tab_top + 1); $pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHTShort"), '', 'C'); } } @@ -1136,19 +1136,19 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetTextColor(0, 0, 60); $pdf->SetFont('', 'B', $default_font_size + 3); - $posx=$this->page_largeur-$this->marge_droite-100; - $posy=$this->marge_haute; + $posx = $this->page_largeur - $this->marge_droite - 100; + $posy = $this->marge_haute; $pdf->SetXY($this->marge_gauche, $posy); // Logo - $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; + $logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; if ($this->emetteur->logo) { if (is_readable($logo)) { - $height=pdf_getHeightForLogo($logo); - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) + $height = pdf_getHeightForLogo($logo); + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } else { @@ -1160,91 +1160,91 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } else { - $text=$this->emetteur->name; + $text = $this->emetteur->name; $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } $pdf->SetFont('', 'B', $default_font_size + 3); $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $title=$outputlangs->transnoentities("SupplierOrder")." ".$outputlangs->convToOutputCharset($object->ref); + $title = $outputlangs->transnoentities("SupplierOrder")." ".$outputlangs->convToOutputCharset($object->ref); $pdf->MultiCell(100, 3, $title, '', 'R'); - $posy+=1; + $posy += 1; if ($object->ref_supplier) { - $posy+=4; + $posy += 4; $pdf->SetFont('', 'B', $default_font_size); $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefSupplier")." : " . $outputlangs->convToOutputCharset($object->ref_supplier), '', 'R'); - $posy+=1; + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefSupplier")." : ".$outputlangs->convToOutputCharset($object->ref_supplier), '', 'R'); + $posy += 1; } - $pdf->SetFont('', '', $default_font_size -1); + $pdf->SetFont('', '', $default_font_size - 1); - if (! empty($conf->global->PDF_SHOW_PROJECT)) + if (!empty($conf->global->PDF_SHOW_PROJECT)) { $object->fetch_projet(); - if (! empty($object->project->ref)) + if (!empty($object->project->ref)) { - $posy+=4; + $posy += 4; $pdf->SetXY($posx, $posy); $langs->load("projects"); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R'); } } - if (! empty($object->date_commande)) + if (!empty($object->date_commande)) { - $posy+=5; + $posy += 5; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : " . dol_print_date($object->date_commande, "day", false, $outputlangs, true), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($object->date_commande, "day", false, $outputlangs, true), '', 'R'); } else { - $posy+=5; + $posy += 5; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(255, 0, 0); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderToProcess"), '', 'R'); } $pdf->SetTextColor(0, 0, 60); - $usehourmin='day'; - if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin='dayhour'; - if (! empty($object->date_livraison)) + $usehourmin = 'day'; + if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin = 'dayhour'; + if (!empty($object->date_livraison)) { - $posy+=4; - $pdf->SetXY($posx-90, $posy); - $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : " . dol_print_date($object->date_livraison, $usehourmin, false, $outputlangs, true), '', 'R'); + $posy += 4; + $pdf->SetXY($posx - 90, $posy); + $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_livraison, $usehourmin, false, $outputlangs, true), '', 'R'); } if ($object->thirdparty->code_fournisseur) { - $posy+=4; + $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_fournisseur), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_fournisseur), '', 'R'); } // Get contact if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP)) { - $arrayidcontact=$object->getIdContact('internal', 'SALESREPFOLL'); + $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL'); if (count($arrayidcontact) > 0) { - $usertmp=new User($this->db); + $usertmp = new User($this->db); $usertmp->fetch($arrayidcontact[0]); - $posy+=4; + $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); $pdf->MultiCell(100, 3, $langs->trans("BuyerName")." : ".$usertmp->getFullName($langs), '', 'R'); } } - $posy+=1; + $posy += 1; $pdf->SetTextColor(0, 0, 60); $top_shift = 0; @@ -1259,27 +1259,27 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if ($showaddress) { // Sender properties - $carac_emetteur=''; + $carac_emetteur = ''; // Add internal contact of proposal if defined - $arrayidcontact=$object->getIdContact('internal', 'SALESREPFOLL'); + $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL'); if (count($arrayidcontact) > 0) { $object->fetch_user($arrayidcontact[0]); - $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; + $carac_emetteur .= ($carac_emetteur ? "\n" : '').$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; } $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object); // Show sender - $posy=42+$top_shift; - $posx=$this->marge_gauche; - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80; - $hautcadre=40; + $posy = 42 + $top_shift; + $posx = $this->marge_gauche; + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80; + $hautcadre = 40; // Show sender frame $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('', '', $default_font_size - 2); - $pdf->SetXY($posx, $posy-5); + $pdf->SetXY($posx, $posy - 5); $pdf->MultiCell(66, 5, $outputlangs->transnoentities("BillFrom").":", 0, 'L'); $pdf->SetXY($posx, $posy); $pdf->SetFillColor(230, 230, 230); @@ -1287,24 +1287,24 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetTextColor(0, 0, 60); // Show sender name - $pdf->SetXY($posx+2, $posy+3); + $pdf->SetXY($posx + 2, $posy + 3); $pdf->SetFont('', 'B', $default_font_size); $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); - $posy=$pdf->getY(); + $posy = $pdf->getY(); // Show sender information - $pdf->SetXY($posx+2, $posy); + $pdf->SetXY($posx + 2, $posy); $pdf->SetFont('', '', $default_font_size - 1); $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); // If CUSTOMER contact defined on order, we use it. Note: Even if this is a supplier object, the code for external contat that follow order is 'CUSTOMER' - $usecontact=false; + $usecontact = false; $arrayidcontact = $object->getIdContact('external', 'CUSTOMER'); if (count($arrayidcontact) > 0) { - $usecontact=true; - $result=$object->fetch_contact($arrayidcontact[0]); + $usecontact = true; + $result = $object->fetch_contact($arrayidcontact[0]); } //Recipient name @@ -1315,26 +1315,26 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $thirdparty = $object->thirdparty; } - $carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs); + $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); - $carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact?$object->contact:''), $usecontact, 'target', $object); + $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target', $object); // Show recipient - $widthrecbox=100; - if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format - $posy=42+$top_shift; - $posx=$this->page_largeur-$this->marge_droite-$widthrecbox; - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; + $widthrecbox = 100; + if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format + $posy = 42 + $top_shift; + $posx = $this->page_largeur - $this->marge_droite - $widthrecbox; + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche; // Show recipient frame $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('', '', $default_font_size - 2); - $pdf->SetXY($posx+2, $posy-5); + $pdf->SetXY($posx + 2, $posy - 5); $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":", 0, 'L'); $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre); // Show recipient name - $pdf->SetXY($posx+2, $posy+3); + $pdf->SetXY($posx + 2, $posy + 3); $pdf->SetFont('', 'B', $default_font_size); $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L'); @@ -1342,7 +1342,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders // Show recipient information $pdf->SetFont('', '', $default_font_size - 1); - $pdf->SetXY($posx+2, $posy); + $pdf->SetXY($posx + 2, $posy); $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); } @@ -1362,7 +1362,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php index 9979509f027..2a6112db9e2 100644 --- a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php @@ -130,47 +130,47 @@ class pdf_standard extends ModelePDFSuppliersPayments // Page size for A4 format $this->type = 'pdf'; - $formatarray=pdf_getFormat(); + $formatarray = pdf_getFormat(); $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; - $this->format = array($this->page_largeur,$this->page_hauteur); - $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; - $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; - $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; - $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; + $this->format = array($this->page_largeur, $this->page_hauteur); + $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; + $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; + $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; + $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; - $this->option_logo = 1; // Affiche logo - $this->option_multilang = 1; // Dispo en plusieurs langues + $this->option_logo = 1; // Affiche logo + $this->option_multilang = 1; // Dispo en plusieurs langues // Define column position - $this->posxdate=$this->marge_gauche+1; - $this->posxreffacturefourn=30; - $this->posxreffacture=65; - $this->posxtype=100; - $this->posxtotalht=80; - $this->posxtva=90; - $this->posxtotalttc=180; + $this->posxdate = $this->marge_gauche + 1; + $this->posxreffacturefourn = 30; + $this->posxreffacture = 65; + $this->posxtype = 100; + $this->posxtotalht = 80; + $this->posxtva = 90; + $this->posxtotalttc = 180; //if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; if ($this->page_largeur < 210) // To work with US executive format { - $this->posxreffacturefourn-=20; - $this->posxreffacture-=20; - $this->posxtype-=20; - $this->posxtotalht-=20; - $this->posxtva-=20; - $this->posxtotalttc-=20; + $this->posxreffacturefourn -= 20; + $this->posxreffacture -= 20; + $this->posxtype -= 20; + $this->posxtotalht -= 20; + $this->posxtva -= 20; + $this->posxtotalttc -= 20; } - $this->tva=array(); - $this->localtax1=array(); - $this->localtax2=array(); - $this->atleastoneratenotnull=0; - $this->atleastonediscount=0; + $this->tva = array(); + $this->localtax1 = array(); + $this->localtax2 = array(); + $this->atleastoneratenotnull = 0; + $this->atleastonediscount = 0; // Recupere emetteur - $this->emetteur=$mysoc; - if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default if not defined + $this->emetteur = $mysoc; + if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined } @@ -191,9 +191,9 @@ class pdf_standard extends ModelePDFSuppliersPayments // phpcs:enable global $user, $langs, $conf, $mysoc, $hookmanager; - if (! is_object($outputlangs)) $outputlangs=$langs; + if (!is_object($outputlangs)) $outputlangs = $langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO - if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; + if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; // Load translation files required by the page $outputlangs->loadLangs(array("main", "suppliers", "companies", "bills", "dict", "products")); @@ -211,12 +211,12 @@ class pdf_standard extends ModelePDFSuppliersPayments $sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf,'.MAIN_DB_PREFIX.'facture_fourn as f,'.MAIN_DB_PREFIX.'societe as s'; $sql .= ' WHERE pf.fk_facturefourn = f.rowid AND f.fk_soc = s.rowid'; $sql .= ' AND pf.fk_paiementfourn = '.$object->id; - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { if ($this->db->num_rows($resql) > 0) { - while($objp = $this->db->fetch_object($resql)) { + while ($objp = $this->db->fetch_object($resql)) { $objp->type = $outputlangs->trans('SupplierInvoice'); $object->lines[] = $objp; } @@ -229,22 +229,22 @@ class pdf_standard extends ModelePDFSuppliersPayments if ($object->specimen) { $dir = $conf->fournisseur->payment->dir_output; - $file = $dir . "/SPECIMEN.pdf"; + $file = $dir."/SPECIMEN.pdf"; } else { $objectref = dol_sanitizeFileName($object->ref); $objectrefsupplier = dol_sanitizeFileName($object->ref_supplier); $dir = $conf->fournisseur->payment->dir_output.'/'.$objectref; - $file = $dir . "/" . $objectref . ".pdf"; - if (! empty($conf->global->SUPPLIER_REF_IN_NAME)) $file = $dir . "/" . $objectref . ($objectrefsupplier?"_".$objectrefsupplier:"").".pdf"; + $file = $dir."/".$objectref.".pdf"; + if (!empty($conf->global->SUPPLIER_REF_IN_NAME)) $file = $dir."/".$objectref.($objectrefsupplier ? "_".$objectrefsupplier : "").".pdf"; } - if (! file_exists($dir)) + if (!file_exists($dir)) { if (dol_mkdir($dir) < 0) { - $this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir); + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; } } @@ -252,24 +252,24 @@ class pdf_standard extends ModelePDFSuppliersPayments if (file_exists($dir)) { // Add pdfgeneration hook - if (! is_object($hookmanager)) + if (!is_object($hookmanager)) { include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager=new HookManager($this->db); + $hookmanager = new HookManager($this->db); } $hookmanager->initHooks(array('pdfgeneration')); - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); global $action; - $reshook=$hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks + $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $nblines = count($object->lines); - $pdf=pdf_getInstance($this->format); - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance - $heightforinfotot = 50; // Height reserved to output the info and total part - $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6; + $pdf = pdf_getInstance($this->format); + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance + $heightforinfotot = 50; // Height reserved to output the info and total part + $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) + if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -279,14 +279,14 @@ class pdf_standard extends ModelePDFSuppliersPayments } $pdf->SetFont(pdf_getPDFFont($outputlangs)); // Set path to the background PDF File - if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) + if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) { $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); $tplidx = $pdf->importPage(1); } $pdf->Open(); - $pagenb=0; + $pagenb = 0; $pdf->SetDrawColor(128, 128, 128); $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); @@ -294,76 +294,76 @@ class pdf_standard extends ModelePDFSuppliersPayments $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); - $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right // New page $pdf->AddPage(); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; $this->_pagehead($pdf, $object, 1, $outputlangs); $pdf->SetFont('', '', $default_font_size - 1); - $pdf->MultiCell(0, 3, ''); // Set interline to 3 + $pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->SetTextColor(0, 0, 0); $tab_top = 90; - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10); $tab_height = 130; $tab_height_newpage = 150; // Incoterm $height_incoterms = 0; - $height_note=0; + $height_note = 0; $iniY = $tab_top + 7; $curY = $tab_top + 7; $nexY = $tab_top + 7; // Loop on each lines - for ($i = 0 ; $i < $nblines ; $i++) + for ($i = 0; $i < $nblines; $i++) { $curY = $nexY; - $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage + $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage $pdf->SetTextColor(0, 0, 0); $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. - $pageposbefore=$pdf->getPage(); + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pageposbefore = $pdf->getPage(); // Description of product line - $curX = $this->posxdate-1; - $showpricebeforepagebreak=1; + $curX = $this->posxdate - 1; + $showpricebeforepagebreak = 1; $pdf->startTransaction(); //pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc,1); - $pdf->writeHTMLCell($this->posxtva-$curX, 4, $curX, $curY, $object->lines[$i]->datef, 0, 1, false, true, 'J', true); - $pageposafter=$pdf->getPage(); + $pdf->writeHTMLCell($this->posxtva - $curX, 4, $curX, $curY, $object->lines[$i]->datef, 0, 1, false, true, 'J', true); + $pageposafter = $pdf->getPage(); if ($pageposafter > $pageposbefore) // There is a pagebreak { $pdf->rollbackTransaction(true); - $pageposafter=$pageposbefore; + $pageposafter = $pageposbefore; //print $pageposafter.'-'.$pageposbefore;exit; - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. //pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc,1); - $pdf->writeHTMLCell($this->posxtva-$curX, 4, $curX, $curY, $object->lines[$i]->datef, 0, 1, false, true, 'J', true); - $posyafter=$pdf->GetY(); - if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text + $pdf->writeHTMLCell($this->posxtva - $curX, 4, $curX, $curY, $object->lines[$i]->datef, 0, 1, false, true, 'J', true); + $posyafter = $pdf->GetY(); + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text { - if ($i == ($nblines-1)) // No more lines, and no space left to show total, so we create a new page + if ($i == ($nblines - 1)) // No more lines, and no space left to show total, so we create a new page { $pdf->AddPage('', '', true); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - $pdf->setPage($pageposafter+1); + $pdf->setPage($pageposafter + 1); } } else { // We found a page break - $showpricebeforepagebreak=0; + $showpricebeforepagebreak = 0; } } else // No pagebreak @@ -372,54 +372,54 @@ class pdf_standard extends ModelePDFSuppliersPayments } $nexY = $pdf->GetY(); - $pageposafter=$pdf->getPage(); + $pageposafter = $pdf->getPage(); $pdf->setPage($pageposbefore); $pdf->setTopMargin($this->marge_haute); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { $pdf->setPage($pageposafter); $curY = $tab_top_newpage; } - $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut + $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut // ref fourn $pdf->SetXY($this->posxreffacturefourn, $curY); - $pdf->MultiCell($this->posxreffacturefourn-$this->posxup-0.8, 3, $object->lines[$i]->ref_supplier, 0, 'L', 0); + $pdf->MultiCell($this->posxreffacturefourn - $this->posxup - 0.8, 3, $object->lines[$i]->ref_supplier, 0, 'L', 0); // ref facture fourn $pdf->SetXY($this->posxreffacture, $curY); - $pdf->MultiCell($this->posxreffacture-$this->posxup-0.8, 3, $object->lines[$i]->ref, 0, 'L', 0); + $pdf->MultiCell($this->posxreffacture - $this->posxup - 0.8, 3, $object->lines[$i]->ref, 0, 'L', 0); // type $pdf->SetXY($this->posxtype, $curY); - $pdf->MultiCell($this->posxtype-$this->posxup-0.8, 3, $object->lines[$i]->type, 0, 'L', 0); + $pdf->MultiCell($this->posxtype - $this->posxup - 0.8, 3, $object->lines[$i]->type, 0, 'L', 0); // Total ht $pdf->SetXY($this->posxtotalht, $curY); - $pdf->MultiCell($this->posxtotalht-$this->posxup-0.8, 3, price($object->lines[$i]->total_ht), 0, 'R', 0); + $pdf->MultiCell($this->posxtotalht - $this->posxup - 0.8, 3, price($object->lines[$i]->total_ht), 0, 'R', 0); // Total tva $pdf->SetXY($this->posxtva, $curY); - $pdf->MultiCell($this->posxtva-$this->posxup-0.8, 3, price($object->lines[$i]->total_tva), 0, 'R', 0); + $pdf->MultiCell($this->posxtva - $this->posxup - 0.8, 3, price($object->lines[$i]->total_tva), 0, 'R', 0); // Total TTC line $pdf->SetXY($this->posxtotalttc, $curY); - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxtotalttc, 3, price($object->lines[$i]->total_ttc), 0, 'R', 0); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxtotalttc, 3, price($object->lines[$i]->total_ttc), 0, 'R', 0); // Add line - if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) + if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) { $pdf->setPage($pageposafter); - $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80))); + $pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80))); //$pdf->SetDrawColor(190,190,200); - $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); + $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1); $pdf->SetLineStyle(array('dash'=>0)); } - $nexY+=2; // Add space between lines + $nexY += 2; // Add space between lines // Detect if some page were added automatically and output _tableau for past pages while ($pagenb < $pageposafter) @@ -436,10 +436,10 @@ class pdf_standard extends ModelePDFSuppliersPayments $this->_pagefoot($pdf, $object, $outputlangs, 1); $pagenb++; $pdf->setPage($pagenb); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); } - if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) + if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { if ($pagenb == 1) { @@ -452,7 +452,7 @@ class pdf_standard extends ModelePDFSuppliersPayments $this->_pagefoot($pdf, $object, $outputlangs, 1); // New page $pdf->AddPage(); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); } @@ -462,16 +462,16 @@ class pdf_standard extends ModelePDFSuppliersPayments if ($pagenb == 1) { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } // Affiche zone cheèque - $posy=$this->_tableau_cheque($pdf, $object, $bottomlasttab, $outputlangs); + $posy = $this->_tableau_cheque($pdf, $object, $bottomlasttab, $outputlangs); // Affiche zone totaux //$posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); @@ -486,31 +486,31 @@ class pdf_standard extends ModelePDFSuppliersPayments // Add pdfgeneration hook $hookmanager->initHooks(array('pdfgeneration')); - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); global $action; - $reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; } - if (! empty($conf->global->MAIN_UMASK)) + if (!empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); $this->result = array('fullpath'=>$file); - return 1; // No error + return 1; // No error } else { - $this->error=$langs->trans("ErrorCanNotCreateDir", $dir); + $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); return 0; } } else { - $this->error=$langs->trans("ErrorConstantNotDefined", "SUPPLIER_OUTPUTDIR"); + $this->error = $langs->trans("ErrorConstantNotDefined", "SUPPLIER_OUTPUTDIR"); return 0; } } @@ -529,7 +529,7 @@ class pdf_standard extends ModelePDFSuppliersPayments protected function _tableau_cheque(&$pdf, $object, $posy, $outputlangs) { // phpcs:enable - global $conf,$mysoc; + global $conf, $mysoc; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -561,7 +561,7 @@ class pdf_standard extends ModelePDFSuppliersPayments $pdf->MultiCell(150, 4, $object->thirdparty->nom, 0, 'L', 1); $pdf->SetXY($this->page_largeur - $this->marge_droite - 30, $posy); - $pdf->MultiCell(35, 4, str_pad(price($object->montant). ' '.$currency, 18, '*', STR_PAD_LEFT), 0, 'R', 1); + $pdf->MultiCell(35, 4, str_pad(price($object->montant).' '.$currency, 18, '*', STR_PAD_LEFT), 0, 'R', 1); $posy += 10; @@ -591,11 +591,11 @@ class pdf_standard extends ModelePDFSuppliersPayments */ protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '') { - global $conf,$mysoc; + global $conf, $mysoc; // Force to disable hidetop and hidebottom - $hidebottom=0; - if ($hidetop) $hidetop=-1; + $hidebottom = 0; + if ($hidetop) $hidetop = -1; $currency = !empty($currency) ? $currency : $conf->currency; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -605,7 +605,7 @@ class pdf_standard extends ModelePDFSuppliersPayments $pdf->SetFont('', '', $default_font_size - 2); $titre = strtoupper($mysoc->town).', le '.date("d").' '.$outputlangs->transnoentitiesnoconv(date("F")).' '.date("Y"); - $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3) - 60, $tab_top-6); + $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3) - 60, $tab_top - 6); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency)); @@ -645,19 +645,19 @@ class pdf_standard extends ModelePDFSuppliersPayments $pdf->SetTextColor(0, 0, 60); $pdf->SetFont('', 'B', $default_font_size + 3); - $posy=$this->marge_haute; - $posx=$this->page_largeur-$this->marge_droite-100; + $posy = $this->marge_haute; + $posx = $this->page_largeur - $this->marge_droite - 100; $pdf->SetXY($this->marge_gauche, $posy); // Logo - $logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo; + $logo = $conf->mycompany->dir_output.'/logos/'.$mysoc->logo; if ($mysoc->logo) { if (is_readable($logo)) { - $height=pdf_getHeightForLogo($logo); - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) + $height = pdf_getHeightForLogo($logo); + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } else { @@ -669,7 +669,7 @@ class pdf_standard extends ModelePDFSuppliersPayments } else { - $text=$this->emetteur->name; + $text = $this->emetteur->name; $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } /* @@ -739,15 +739,15 @@ class pdf_standard extends ModelePDFSuppliersPayments $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty); // Show payer - $posy=42; - $posx=$this->marge_gauche; - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80; - $hautcadre=40; + $posy = 42; + $posx = $this->marge_gauche; + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80; + $hautcadre = 40; // Show sender frame $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('', '', $default_font_size - 2); - $pdf->SetXY($posx, $posy-5); + $pdf->SetXY($posx, $posy - 5); $pdf->MultiCell(66, 5, $outputlangs->transnoentities("PayedBy").":", 0, 'L'); $pdf->SetXY($posx, $posy); $pdf->SetFillColor(230, 230, 230); @@ -755,39 +755,39 @@ class pdf_standard extends ModelePDFSuppliersPayments $pdf->SetTextColor(0, 0, 60); // Show sender name - $pdf->SetXY($posx+2, $posy+3); + $pdf->SetXY($posx + 2, $posy + 3); $pdf->SetFont('', 'B', $default_font_size); $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); - $posy=$pdf->getY(); + $posy = $pdf->getY(); // Show sender information - $pdf->SetXY($posx+2, $posy); + $pdf->SetXY($posx + 2, $posy); $pdf->SetFont('', '', $default_font_size - 1); $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); // Payed $thirdparty = $object->thirdparty; - $carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs); + $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); - $carac_client=pdf_build_address($outputlangs, $this->emetteur, $mysoc, ((!empty($object->contact))?$object->contact:null), $usecontact, 'target', $object); + $carac_client = pdf_build_address($outputlangs, $this->emetteur, $mysoc, ((!empty($object->contact)) ? $object->contact : null), $usecontact, 'target', $object); // Show recipient - $widthrecbox=90; - if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format - $posy=42; - $posx=$this->page_largeur-$this->marge_droite-$widthrecbox; - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; + $widthrecbox = 90; + if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format + $posy = 42; + $posx = $this->page_largeur - $this->marge_droite - $widthrecbox; + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche; // Show recipient frame $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('', '', $default_font_size - 2); - $pdf->SetXY($posx+2, $posy-5); + $pdf->SetXY($posx + 2, $posy - 5); $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("PayedTo").":", 0, 'L'); $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre); // Show recipient name - $pdf->SetXY($posx+2, $posy+3); + $pdf->SetXY($posx + 2, $posy + 3); $pdf->SetFont('', 'B', $default_font_size); $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L'); @@ -795,7 +795,7 @@ class pdf_standard extends ModelePDFSuppliersPayments // Show recipient information $pdf->SetFont('', '', $default_font_size - 1); - $pdf->SetXY($posx+2, $posy); + $pdf->SetXY($posx + 2, $posy); $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); } } @@ -813,7 +813,7 @@ class pdf_standard extends ModelePDFSuppliersPayments protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index cb73468f6fd..db5c5501d53 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -130,66 +130,66 @@ class pdf_aurore extends ModelePDFSupplierProposal // Page size for A4 format $this->type = 'pdf'; - $formatarray=pdf_getFormat(); + $formatarray = pdf_getFormat(); $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; - $this->format = array($this->page_largeur,$this->page_hauteur); - $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; - $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; - $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; - $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; + $this->format = array($this->page_largeur, $this->page_hauteur); + $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; + $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; + $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; + $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; - $this->option_logo = 1; // Affiche logo - $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION - $this->option_modereg = 1; // Affiche mode reglement - $this->option_condreg = 1; // Affiche conditions reglement - $this->option_codeproduitservice = 1; // Affiche code produit-service - $this->option_multilang = 1; // Dispo en plusieurs langues - $this->option_escompte = 1; // Affiche si il y a eu escompte - $this->option_credit_note = 1; // Support credit notes - $this->option_freetext = 1; // Support add of a personalised text - $this->option_draft_watermark = 1; //Support add of a watermark on drafts + $this->option_logo = 1; // Affiche logo + $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION + $this->option_modereg = 1; // Affiche mode reglement + $this->option_condreg = 1; // Affiche conditions reglement + $this->option_codeproduitservice = 1; // Affiche code produit-service + $this->option_multilang = 1; // Dispo en plusieurs langues + $this->option_escompte = 1; // Affiche si il y a eu escompte + $this->option_credit_note = 1; // Support credit notes + $this->option_freetext = 1; // Support add of a personalised text + $this->option_draft_watermark = 1; //Support add of a watermark on drafts // Get source company - $this->emetteur=$mysoc; - if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default, if was not defined + $this->emetteur = $mysoc; + if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined // Define position of columns - $this->posxdesc=$this->marge_gauche+1; - $this->posxdiscount=162; - $this->postotalht=174; + $this->posxdesc = $this->marge_gauche + 1; + $this->posxdiscount = 162; + $this->postotalht = 174; if ($conf->global->PRODUCT_USE_UNITS) { - $this->posxtva=101; - $this->posxup=118; - $this->posxqty=135; - $this->posxunit=151; + $this->posxtva = 101; + $this->posxup = 118; + $this->posxqty = 135; + $this->posxunit = 151; } else { - $this->posxtva=102; - $this->posxup=126; - $this->posxqty=145; - $this->posxunit=162; + $this->posxtva = 102; + $this->posxup = 126; + $this->posxqty = 145; + $this->posxunit = 162; } - if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) $this->posxup=$this->posxtva; - $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || !empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) $this->posxup = $this->posxtva; + $this->posxpicture = $this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images if ($this->page_largeur < 210) // To work with US executive format { - $this->posxpicture-=20; - $this->posxtva-=20; - $this->posxup-=20; - $this->posxqty-=20; - $this->posxunit-=20; - $this->posxdiscount-=20; - $this->postotalht-=20; + $this->posxpicture -= 20; + $this->posxtva -= 20; + $this->posxup -= 20; + $this->posxqty -= 20; + $this->posxunit -= 20; + $this->posxdiscount -= 20; + $this->postotalht -= 20; } - $this->tva=array(); - $this->localtax1=array(); - $this->localtax2=array(); - $this->atleastoneratenotnull=0; - $this->atleastonediscount=0; + $this->tva = array(); + $this->localtax1 = array(); + $this->localtax2 = array(); + $this->atleastoneratenotnull = 0; + $this->atleastonediscount = 0; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -207,11 +207,11 @@ class pdf_aurore extends ModelePDFSupplierProposal public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable - global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblines; + global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines; - if (! is_object($outputlangs)) $outputlangs=$langs; + if (!is_object($outputlangs)) $outputlangs = $langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO - if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; + if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; // Load traductions files required by page $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "supplier_proposal")); @@ -219,40 +219,40 @@ class pdf_aurore extends ModelePDFSupplierProposal $nblines = count($object->lines); // Loop on each lines to detect if there is at least one image to show - $realpatharray=array(); - if (! empty($conf->global->MAIN_GENERATE_SUPPLIER_PROPOSAL_WITH_PICTURE)) + $realpatharray = array(); + if (!empty($conf->global->MAIN_GENERATE_SUPPLIER_PROPOSAL_WITH_PICTURE)) { - for ($i = 0 ; $i < $nblines ; $i++) + for ($i = 0; $i < $nblines; $i++) { if (empty($object->lines[$i]->fk_product)) continue; $objphoto = new Product($this->db); $objphoto->fetch($object->lines[$i]->fk_product); - if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) + if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { - $pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product') . $object->lines[$i]->fk_product ."/photos/"; + $pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product').$object->lines[$i]->fk_product."/photos/"; $dir = $conf->product->dir_output.'/'.$pdir; } else { - $pdir = get_exdir(0, 2, 0, 0, $objphoto, 'product') . dol_sanitizeFileName($objphoto->ref).'/'; + $pdir = get_exdir(0, 2, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; $dir = $conf->product->dir_output.'/'.$pdir; } - $realpath=''; + $realpath = ''; foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) { - $filename=$obj['photo']; + $filename = $obj['photo']; //if ($obj['photo_vignette']) $filename='thumbs/'.$obj['photo_vignette']; $realpath = $dir.$filename; break; } - if ($realpath) $realpatharray[$i]=$realpath; + if ($realpath) $realpatharray[$i] = $realpath; } } - if (count($realpatharray) == 0) $this->posxpicture=$this->posxtva; + if (count($realpatharray) == 0) $this->posxpicture = $this->posxtva; if ($conf->supplier_proposal->dir_output) { @@ -264,20 +264,20 @@ class pdf_aurore extends ModelePDFSupplierProposal if ($object->specimen) { $dir = $conf->supplier_proposal->dir_output; - $file = $dir . "/SPECIMEN.pdf"; + $file = $dir."/SPECIMEN.pdf"; } else { $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->supplier_proposal->dir_output . "/" . $objectref; - $file = $dir . "/" . $objectref . ".pdf"; + $dir = $conf->supplier_proposal->dir_output."/".$objectref; + $file = $dir."/".$objectref.".pdf"; } - if (! file_exists($dir)) + if (!file_exists($dir)) { if (dol_mkdir($dir) < 0) { - $this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir); + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; } } @@ -285,23 +285,23 @@ class pdf_aurore extends ModelePDFSupplierProposal if (file_exists($dir)) { // Add pdfgeneration hook - if (! is_object($hookmanager)) + if (!is_object($hookmanager)) { include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager=new HookManager($this->db); + $hookmanager = new HookManager($this->db); } $hookmanager->initHooks(array('pdfgeneration')); - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); global $action; - $reshook=$hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks + $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks // Create pdf instance - $pdf=pdf_getInstance($this->format); - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance - $heightforinfotot = 50; // Height reserved to output the info and total part - $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6; + $pdf = pdf_getInstance($this->format); + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance + $heightforinfotot = 50; // Height reserved to output the info and total part + $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) + if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -311,14 +311,14 @@ class pdf_aurore extends ModelePDFSupplierProposal } $pdf->SetFont(pdf_getPDFFont($outputlangs)); // Set path to the background PDF File - if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) + if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) { $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); $tplidx = $pdf->importPage(1); } $pdf->Open(); - $pagenb=0; + $pagenb = 0; $pdf->SetDrawColor(128, 128, 128); $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); @@ -326,12 +326,12 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("CommercialAsk")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); - $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right // Positionne $this->atleastonediscount si on a au moins une remise - for ($i = 0 ; $i < $nblines ; $i++) + for ($i = 0; $i < $nblines; $i++) { if ($object->lines[$i]->remise_percent) { @@ -341,59 +341,59 @@ class pdf_aurore extends ModelePDFSupplierProposal if (empty($this->atleastonediscount)) { $delta = ($this->postotalht - $this->posxdiscount); - $this->posxpicture+=$delta; - $this->posxtva+=$delta; - $this->posxup+=$delta; - $this->posxqty+=$delta; - $this->posxunit+=$delta; - $this->posxdiscount+=$delta; + $this->posxpicture += $delta; + $this->posxtva += $delta; + $this->posxup += $delta; + $this->posxqty += $delta; + $this->posxunit += $delta; + $this->posxdiscount += $delta; // post of fields after are not modified, stay at same position } // New page $pdf->AddPage(); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs); $pdf->SetFont('', '', $default_font_size - 1); - $pdf->MultiCell(0, 3, ''); // Set interline to 3 + $pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->SetTextColor(0, 0, 0); - $tab_top = 90+$top_shift; - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42+$top_shift:10); + $tab_top = 90 + $top_shift; + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); // Affiche notes - $notetoshow=empty($object->note_public)?'':$object->note_public; - if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) + $notetoshow = empty($object->note_public) ? '' : $object->note_public; + if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) { // Get first sale rep if (is_object($object->thirdparty)) { - $salereparray=$object->thirdparty->getSalesRepresentatives($user); - $salerepobj=new User($this->db); + $salereparray = $object->thirdparty->getSalesRepresentatives($user); + $salerepobj = new User($this->db); $salerepobj->fetch($salereparray[0]['id']); - if (! empty($salerepobj->signature)) $notetoshow=dol_concatdesc($notetoshow, $salerepobj->signature); + if (!empty($salerepobj->signature)) $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature); } } if ($notetoshow) { $tab_top -= 2; - $substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object); + $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object); $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs); $notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow); $pdf->SetFont('', '', $default_font_size - 1); - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($notetoshow), 0, 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($notetoshow), 0, 1); $nexY = $pdf->GetY(); - $height_note=$nexY-$tab_top; + $height_note = $nexY - $tab_top; // Rect takes a length in 3rd parameter $pdf->SetDrawColor(192, 192, 192); - $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1); + $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); - $tab_top = $nexY+6; + $tab_top = $nexY + 6; } $iniY = $tab_top + 7; @@ -401,105 +401,105 @@ class pdf_aurore extends ModelePDFSupplierProposal $nexY = $tab_top + 7; // Loop on each lines - for ($i = 0 ; $i < $nblines ; $i++) + for ($i = 0; $i < $nblines; $i++) { $curY = $nexY; - $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage + $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage $pdf->SetTextColor(0, 0, 0); // Define size of image if we need it - $imglinesize=array(); - if (! empty($realpatharray[$i])) $imglinesize=pdf_getSizeForImage($realpatharray[$i]); + $imglinesize = array(); + if (!empty($realpatharray[$i])) $imglinesize = pdf_getSizeForImage($realpatharray[$i]); $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. - $pageposbefore=$pdf->getPage(); + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pageposbefore = $pdf->getPage(); - $showpricebeforepagebreak=1; - $posYAfterImage=0; - $posYAfterDescription=0; + $showpricebeforepagebreak = 1; + $posYAfterImage = 0; + $posYAfterDescription = 0; // We start with Photo of product line - if (!empty($imglinesize['width']) && !empty($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur-($heightforfooter+$heightforfreetext+$heightforinfotot))) // If photo too high, we moved completely on new page + if (!empty($imglinesize['width']) && !empty($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // If photo too high, we moved completely on new page { $pdf->AddPage('', '', true); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - $pdf->setPage($pageposbefore+1); + $pdf->setPage($pageposbefore + 1); $curY = $tab_top_newpage; - $showpricebeforepagebreak=0; + $showpricebeforepagebreak = 0; } if (!empty($imglinesize['width']) && !empty($imglinesize['height'])) { - $curX = $this->posxpicture-1; - $pdf->Image($realpatharray[$i], $curX + (($this->posxtva-$this->posxpicture-$imglinesize['width'])/2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi + $curX = $this->posxpicture - 1; + $pdf->Image($realpatharray[$i], $curX + (($this->posxtva - $this->posxpicture - $imglinesize['width']) / 2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi // $pdf->Image does not increase value return by getY, so we save it manually - $posYAfterImage=$curY+$imglinesize['height']; + $posYAfterImage = $curY + $imglinesize['height']; } // Description of product line - $curX = $this->posxdesc-1; + $curX = $this->posxdesc - 1; $pdf->startTransaction(); if ($posYAfterImage > 0) { - $descWidth = $this->posxpicture-$curX; + $descWidth = $this->posxpicture - $curX; } else { - $descWidth = $this->posxtva-$curX; + $descWidth = $this->posxtva - $curX; } pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc, 1); - $pageposafter=$pdf->getPage(); + $pageposafter = $pdf->getPage(); if ($pageposafter > $pageposbefore) // There is a pagebreak { $pdf->rollbackTransaction(true); - $pageposafter=$pageposbefore; + $pageposafter = $pageposbefore; //print $pageposafter.'-'.$pageposbefore;exit; - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc); - $pageposafter=$pdf->getPage(); - $posyafter=$pdf->GetY(); + $pageposafter = $pdf->getPage(); + $posyafter = $pdf->GetY(); //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; - if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text { - if ($i == ($nblines-1)) // No more lines, and no space left to show total, so we create a new page + if ($i == ($nblines - 1)) // No more lines, and no space left to show total, so we create a new page { $pdf->AddPage('', '', true); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - $pdf->setPage($pageposafter+1); + $pdf->setPage($pageposafter + 1); } } else { // We found a page break - $showpricebeforepagebreak=0; + $showpricebeforepagebreak = 0; } } else // No pagebreak { $pdf->commitTransaction(); } - $posYAfterDescription=$pdf->GetY(); + $posYAfterDescription = $pdf->GetY(); $nexY = $pdf->GetY(); - $pageposafter=$pdf->getPage(); + $pageposafter = $pdf->getPage(); $pdf->setPage($pageposbefore); $pdf->setTopMargin($this->marge_haute); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { $pdf->setPage($pageposafter); $curY = $tab_top_newpage; } - $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut + $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut // VAT Rate /* @@ -520,14 +520,14 @@ class pdf_aurore extends ModelePDFSupplierProposal // Quantity $qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->posxqty, $curY); - $pdf->MultiCell($this->posxunit-$this->posxqty-0.8, 4, $qty, 0, 'R'); // Enough for 6 chars + $pdf->MultiCell($this->posxunit - $this->posxqty - 0.8, 4, $qty, 0, 'R'); // Enough for 6 chars // Unit - if($conf->global->PRODUCT_USE_UNITS) + if ($conf->global->PRODUCT_USE_UNITS) { $unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager); $pdf->SetXY($this->posxunit, $curY); - $pdf->MultiCell($this->posxdiscount-$this->posxunit-0.8, 4, $unit, 0, 'L'); + $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 4, $unit, 0, 'L'); } // Discount on line @@ -547,54 +547,54 @@ class pdf_aurore extends ModelePDFSupplierProposal */ // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva - if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; - else $tvaligne=$object->lines[$i]->total_tva; + if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne = $object->lines[$i]->multicurrency_total_tva; + else $tvaligne = $object->lines[$i]->total_tva; - $localtax1ligne=$object->lines[$i]->total_localtax1; - $localtax2ligne=$object->lines[$i]->total_localtax2; - $localtax1_rate=$object->lines[$i]->localtax1_tx; - $localtax2_rate=$object->lines[$i]->localtax2_tx; - $localtax1_type=$object->lines[$i]->localtax1_type; - $localtax2_type=$object->lines[$i]->localtax2_type; + $localtax1ligne = $object->lines[$i]->total_localtax1; + $localtax2ligne = $object->lines[$i]->total_localtax2; + $localtax1_rate = $object->lines[$i]->localtax1_tx; + $localtax2_rate = $object->lines[$i]->localtax2_tx; + $localtax1_type = $object->lines[$i]->localtax1_type; + $localtax2_type = $object->lines[$i]->localtax2_type; - if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100; - if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100; - if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100; + if ($object->remise_percent) $tvaligne -= ($tvaligne * $object->remise_percent) / 100; + if ($object->remise_percent) $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100; + if ($object->remise_percent) $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100; - $vatrate=(string) $object->lines[$i]->tva_tx; + $vatrate = (string) $object->lines[$i]->tva_tx; // Retrieve type from database for backward compatibility with old records - if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined - && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax + if ((!isset($localtax1_type) || $localtax1_type == '' || !isset($localtax2_type) || $localtax2_type == '') // if tax type not defined + && (!empty($localtax1_rate) || !empty($localtax2_rate))) // and there is local tax { - $localtaxtmp_array=getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc); + $localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc); $localtax1_type = $localtaxtmp_array[0]; $localtax2_type = $localtaxtmp_array[2]; } // retrieve global local tax if ($localtax1_type && $localtax1ligne != 0) - $this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne; + $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne; if ($localtax2_type && $localtax2ligne != 0) - $this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne; + $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne; - if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; - if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=0; + if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate .= '*'; + if (!isset($this->tva[$vatrate])) $this->tva[$vatrate] = 0; $this->tva[$vatrate] += $tvaligne; - if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage; + if ($posYAfterImage > $posYAfterDescription) $nexY = $posYAfterImage; // Add line - if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) + if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) { $pdf->setPage($pageposafter); - $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80))); + $pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80))); //$pdf->SetDrawColor(190,190,200); - $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); + $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1); $pdf->SetLineStyle(array('dash'=>0)); } - $nexY+=2; // Add space between lines + $nexY += 2; // Add space between lines // Detect if some page were added automatically and output _tableau for past pages while ($pagenb < $pageposafter) @@ -611,10 +611,10 @@ class pdf_aurore extends ModelePDFSupplierProposal $this->_pagefoot($pdf, $object, $outputlangs, 1); $pagenb++; $pdf->setPage($pagenb); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); } - if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) + if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { if ($pagenb == 1) { @@ -627,7 +627,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $this->_pagefoot($pdf, $object, $outputlangs, 1); // New page $pdf->AddPage(); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); } @@ -637,16 +637,16 @@ class pdf_aurore extends ModelePDFSupplierProposal if ($pagenb == 1) { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } // Affiche zone infos - $posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); + $posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); // Affiche zone totaux //$posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs); @@ -669,31 +669,31 @@ class pdf_aurore extends ModelePDFSupplierProposal //Add pdfgeneration hook $hookmanager->initHooks(array('pdfgeneration')); - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); global $action; - $reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; } - if (! empty($conf->global->MAIN_UMASK)) + if (!empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); $this->result = array('fullpath'=>$file); - return 1; // No error + return 1; // No error } else { - $this->error=$langs->trans("ErrorCanNotCreateDir", $dir); + $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); return 0; } } else { - $this->error=$langs->trans("ErrorConstantNotDefined", "SUPPLIER_PROPOSAL_OUTPUTDIR"); + $this->error = $langs->trans("ErrorConstantNotDefined", "SUPPLIER_PROPOSAL_OUTPUTDIR"); return 0; } } @@ -733,10 +733,10 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->SetFont('', '', $default_font_size - 1); - $posxval=52; + $posxval = 52; // Show shipping date - if (! empty($object->date_livraison)) + if (!empty($object->date_livraison)) { $outputlangs->load("sendings"); $pdf->SetFont('', 'B', $default_font_size - 2); @@ -745,10 +745,10 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $dlp=dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true); + $dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); - $posy=$pdf->GetY()+1; + $posy = $pdf->GetY() + 1; } else { $outputlangs->load("sendings"); @@ -761,7 +761,7 @@ class pdf_aurore extends ModelePDFSupplierProposal //$dlp=dol_print_date($object->date_livraison,"daytext",false,$outputlangs,true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); - $posy=$pdf->GetY()+1; + $posy = $pdf->GetY() + 1; } /* PHFAVRE elseif ($object->availability_code || $object->availability) // Show availability conditions @@ -790,14 +790,14 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc); - $lib_condition_paiement=str_replace('\n', "\n", $lib_condition_paiement); + $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc); + $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); $pdf->MultiCell(80, 4, $lib_condition_paiement, 0, 'L'); - $posy=$pdf->GetY()+3; + $posy = $pdf->GetY() + 3; } - if (! empty($conf->global->SUPPLIER_PROPOSAL_PDF_SHOW_PAYMENTTERMMODE)) + if (!empty($conf->global->SUPPLIER_PROPOSAL_PDF_SHOW_PAYMENTTERMMODE)) { // Show payment mode if ($object->mode_reglement_code @@ -805,24 +805,24 @@ class pdf_aurore extends ModelePDFSupplierProposal && $object->mode_reglement_code != 'VIR') { $pdf->SetFont('', 'B', $default_font_size - 2); - $pdf->SetXY($this->marge_gauche, $posy-2); + $pdf->SetXY($this->marge_gauche, $posy - 2); $titre = $outputlangs->transnoentities("PaymentMode").':'; $pdf->MultiCell(80, 5, $titre, 0, 'L'); $pdf->SetFont('', '', $default_font_size - 2); - $pdf->SetXY($posxval, $posy-2); - $lib_mode_reg=$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code)!=('PaymentType'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code):$outputlangs->convToOutputCharset($object->mode_reglement); + $pdf->SetXY($posxval, $posy - 2); + $lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement); $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L'); - $posy=$pdf->GetY()+2; + $posy = $pdf->GetY() + 2; } // Show payment mode CHQ if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') { // Si mode reglement non force ou si force a CHQ - if (! empty($conf->global->FACTURE_CHQ_NUMBER)) + if (!empty($conf->global->FACTURE_CHQ_NUMBER)) { - $diffsizetitle=(empty($conf->global->PDF_DIFFSIZE_TITLE)?3:$conf->global->PDF_DIFFSIZE_TITLE); + $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE); if ($conf->global->FACTURE_CHQ_NUMBER > 0) { @@ -832,14 +832,14 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $account->proprio), 0, 'L', 0); - $posy=$pdf->GetY()+1; + $posy = $pdf->GetY() + 1; if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) { $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0); - $posy=$pdf->GetY()+2; + $posy = $pdf->GetY() + 2; } } if ($conf->global->FACTURE_CHQ_NUMBER == -1) @@ -847,14 +847,14 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0); - $posy=$pdf->GetY()+1; + $posy = $pdf->GetY() + 1; if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) { $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); - $posy=$pdf->GetY()+2; + $posy = $pdf->GetY() + 2; } } } @@ -863,18 +863,18 @@ class pdf_aurore extends ModelePDFSupplierProposal // If payment mode not forced or forced to VIR, show payment with BAN if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') { - if (! empty($object->fk_bank) || ! empty($conf->global->FACTURE_RIB_NUMBER)) + if (!empty($object->fk_bank) || !empty($conf->global->FACTURE_RIB_NUMBER)) { - $bankid=(empty($object->fk_bank)?$conf->global->FACTURE_RIB_NUMBER:$object->fk_bank); + $bankid = (empty($object->fk_bank) ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_bank); $account = new Account($this->db); $account->fetch($bankid); - $curx=$this->marge_gauche; - $cury=$posy; + $curx = $this->marge_gauche; + $cury = $posy; - $posy=pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size); + $posy = pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size); - $posy+=2; + $posy += 2; } } } @@ -897,7 +897,7 @@ class pdf_aurore extends ModelePDFSupplierProposal protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { // phpcs:enable - global $conf,$mysoc; + global $conf, $mysoc; $default_font_size = pdf_getPDFFontSize($outputlangs); $tab2_top = $posy; @@ -908,29 +908,29 @@ class pdf_aurore extends ModelePDFSupplierProposal $col1x = 120; $col2x = 170; if ($this->page_largeur < 210) // To work with US executive format { - $col2x-=20; + $col2x -= 20; } $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x); - $useborder=0; + $useborder = 0; $index = 0; // Total HT $pdf->SetFillColor(255, 255, 255); $pdf->SetXY($col1x, $tab2_top + 0); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + 0); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + (! empty($object->remise)?$object->remise:0), 0, $outputlangs), 0, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0, 'R', 1); // Show VAT by rates and total $pdf->SetFillColor(248, 248, 248); - $this->atleastoneratenotnull=0; + $this->atleastoneratenotnull = 0; if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { - $tvaisnull=((! empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false); - if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL) && $tvaisnull) + $tvaisnull = ((!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false); + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL) && $tvaisnull) { // Nothing to do } @@ -939,28 +939,28 @@ class pdf_aurore extends ModelePDFSupplierProposal //Local tax 1 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach ($this->localtax1 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('1','3','5'))) continue; + if (in_array((string) $localtax_type, array('1', '3', '5'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + foreach ($localtax_rate as $tvakey => $tvaval) { - if ($tvakey!=0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); @@ -971,13 +971,13 @@ class pdf_aurore extends ModelePDFSupplierProposal //Local tax 2 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach ($this->localtax2 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('1','3','5'))) continue; + if (in_array((string) $localtax_type, array('1', '3', '5'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + foreach ($localtax_rate as $tvakey => $tvaval) { - if ($tvakey!=0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -986,15 +986,15 @@ class pdf_aurore extends ModelePDFSupplierProposal $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); @@ -1003,7 +1003,7 @@ class pdf_aurore extends ModelePDFSupplierProposal } //} // VAT - foreach($this->tva as $tvakey => $tvaval) + foreach ($this->tva as $tvakey => $tvaval) { if ($tvakey > 0) // On affiche pas taux 0 { @@ -1012,15 +1012,15 @@ class pdf_aurore extends ModelePDFSupplierProposal $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat =$outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).' '; - $totalvat.=vatrate($tvakey, 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).' '; + $totalvat .= vatrate($tvakey, 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); @@ -1030,11 +1030,11 @@ class pdf_aurore extends ModelePDFSupplierProposal //Local tax 1 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach ($this->localtax1 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; + if (in_array((string) $localtax_type, array('2', '4', '6'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + foreach ($localtax_rate as $tvakey => $tvaval) { if ($tvakey != 0) // On affiche pas taux 0 { @@ -1043,16 +1043,16 @@ class pdf_aurore extends ModelePDFSupplierProposal $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } @@ -1062,11 +1062,11 @@ class pdf_aurore extends ModelePDFSupplierProposal //Local tax 2 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach ($this->localtax2 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; + if (in_array((string) $localtax_type, array('2', '4', '6'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + foreach ($localtax_rate as $tvakey => $tvaval) { // retrieve global local tax if ($tvakey != 0) // On affiche pas taux 0 @@ -1076,16 +1076,16 @@ class pdf_aurore extends ModelePDFSupplierProposal $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); @@ -1099,7 +1099,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetTextColor(0, 0, 60); $pdf->SetFillColor(224, 224, 224); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc, 0, $outputlangs), $useborder, 'R', 1); @@ -1118,7 +1118,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid"), 0, 'L', 0); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid"), 0, 'L', 0); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle, 0, $outputlangs), 0, 'R', 0); @@ -1143,7 +1143,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->SetTextColor(0, 0, 60); $pdf->SetFillColor(224, 224, 224); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer, 0, $outputlangs), $useborder, 'R', 1); @@ -1175,8 +1175,8 @@ class pdf_aurore extends ModelePDFSupplierProposal global $conf; // Force to disable hidetop and hidebottom - $hidebottom=0; - if ($hidetop) $hidetop=-1; + $hidebottom = 0; + if ($hidetop) $hidetop = -1; $currency = !empty($currency) ? $currency : $conf->currency; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -1188,24 +1188,24 @@ class pdf_aurore extends ModelePDFSupplierProposal if (empty($hidetop)) { $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency)); - $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4); + $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; - if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); } $pdf->SetDrawColor(128, 128, 128); $pdf->SetFont('', '', $default_font_size - 1); // Output Rect - $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter + $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter if (empty($hidetop)) { - $pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line takes a position y in 2nd parameter and 4th parameter + $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5); // line takes a position y in 2nd parameter and 4th parameter - $pdf->SetXY($this->posxdesc-1, $tab_top+1); + $pdf->SetXY($this->posxdesc - 1, $tab_top + 1); $pdf->MultiCell(108, 2, $outputlangs->transnoentities("Designation"), '', 'L'); } @@ -1215,26 +1215,26 @@ class pdf_aurore extends ModelePDFSupplierProposal //$pdf->line($this->posxtva-2, $tab_top, $this->posxtva-2, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posxtva-5, $tab_top+1); - $pdf->MultiCell($this->posxup-$this->posxtva+3, 2, $outputlangs->transnoentities("VAT"), '', 'C'); + $pdf->SetXY($this->posxtva - 5, $tab_top + 1); + $pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities("VAT"), '', 'C'); } } - $pdf->line($this->posxup-3, $tab_top, $this->posxup-3, $tab_top + $tab_height); + $pdf->line($this->posxup - 3, $tab_top, $this->posxup - 3, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posxup-1, $tab_top+1); - $pdf->MultiCell($this->posxqty-$this->posxup-1, 2, $outputlangs->transnoentities("PriceUHT"), '', 'C'); + $pdf->SetXY($this->posxup - 1, $tab_top + 1); + $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceUHT"), '', 'C'); } - $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); + $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posxqty-1, $tab_top+1); - $pdf->MultiCell($this->posxunit-$this->posxqty-1, 2, $outputlangs->transnoentities("Qty"), '', 'C'); + $pdf->SetXY($this->posxqty - 1, $tab_top + 1); + $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C'); } - if($conf->global->PRODUCT_USE_UNITS) { + if ($conf->global->PRODUCT_USE_UNITS) { $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxunit - 1, $tab_top + 1); @@ -1242,13 +1242,13 @@ class pdf_aurore extends ModelePDFSupplierProposal } } - $pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height); + $pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height); if (empty($hidetop)) { if ($this->atleastonediscount) { - $pdf->SetXY($this->posxdiscount-1, $tab_top+1); - $pdf->MultiCell($this->postotalht-$this->posxdiscount+1, 2, $outputlangs->transnoentities("ReductionShort"), '', 'C'); + $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1); + $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities("ReductionShort"), '', 'C'); } } if ($this->atleastonediscount) @@ -1257,7 +1257,7 @@ class pdf_aurore extends ModelePDFSupplierProposal } if (empty($hidetop)) { - $pdf->SetXY($this->postotalht-1, $tab_top+1); + $pdf->SetXY($this->postotalht - 1, $tab_top + 1); $pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHT"), '', 'C'); } } @@ -1284,7 +1284,7 @@ class pdf_aurore extends ModelePDFSupplierProposal pdf_pagehead($pdf, $outputlangs, $this->page_hauteur); // Show Draft Watermark - if($object->statut==0 && (! empty($conf->global->SUPPLIER_PROPOSAL_DRAFT_WATERMARK)) ) + if ($object->statut == 0 && (!empty($conf->global->SUPPLIER_PROPOSAL_DRAFT_WATERMARK))) { pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->SUPPLIER_PROPOSAL_DRAFT_WATERMARK); } @@ -1292,19 +1292,19 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->SetTextColor(0, 0, 60); $pdf->SetFont('', 'B', $default_font_size + 3); - $posy=$this->marge_haute; - $posx=$this->page_largeur-$this->marge_droite-100; + $posy = $this->marge_haute; + $posx = $this->page_largeur - $this->marge_droite - 100; $pdf->SetXY($this->marge_gauche, $posy); // Logo - $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; + $logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; if ($this->emetteur->logo) { if (is_readable($logo)) { - $height=pdf_getHeightForLogo($logo); - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) + $height = pdf_getHeightForLogo($logo); + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } else { @@ -1316,32 +1316,32 @@ class pdf_aurore extends ModelePDFSupplierProposal } else { - $text=$this->emetteur->name; + $text = $this->emetteur->name; $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } $pdf->SetFont('', 'B', $default_font_size + 3); $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $title=$outputlangs->transnoentities("CommercialAsk"); + $title = $outputlangs->transnoentities("CommercialAsk"); $pdf->MultiCell(100, 4, $title, '', 'R'); $pdf->SetFont('', 'B', $default_font_size); - $posy+=5; + $posy += 5; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->ref), '', 'R'); + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref), '', 'R'); - $posy+=1; + $posy += 1; $pdf->SetFont('', '', $default_font_size - 2); if ($object->ref_client) { - $posy+=4; + $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : " . $outputlangs->convToOutputCharset($object->ref_client), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); } /* PHFAVRE $posy+=4; @@ -1352,28 +1352,28 @@ class pdf_aurore extends ModelePDFSupplierProposal if ($object->thirdparty->code_fournisseur) { - $posy+=4; + $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_fournisseur), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_fournisseur), '', 'R'); } // Get contact if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP)) { - $arrayidcontact=$object->getIdContact('internal', 'SALESREPFOLL'); + $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL'); if (count($arrayidcontact) > 0) { - $usertmp=new User($this->db); + $usertmp = new User($this->db); $usertmp->fetch($arrayidcontact[0]); - $posy+=4; + $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); $pdf->MultiCell(100, 3, $langs->trans("BuyerName")." : ".$usertmp->getFullName($langs), '', 'R'); } } - $posy+=2; + $posy += 2; $top_shift = 0; // Show list of linked objects @@ -1387,28 +1387,28 @@ class pdf_aurore extends ModelePDFSupplierProposal if ($showaddress) { // Sender properties - $carac_emetteur=''; + $carac_emetteur = ''; // Add internal contact of proposal if defined - $arrayidcontact=$object->getIdContact('internal', 'SALESREPFOLL'); + $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL'); if (count($arrayidcontact) > 0) { $object->fetch_user($arrayidcontact[0]); - $labelbeforecontactname=($outputlangs->transnoentities("FromContactName")!='FromContactName'?$outputlangs->transnoentities("FromContactName"):$outputlangs->transnoentities("Name")); - $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$labelbeforecontactname.": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; + $labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name")); + $carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname.": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; } $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object); // Show sender - $posy=42+$top_shift; - $posx=$this->marge_gauche; - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80; - $hautcadre=40; + $posy = 42 + $top_shift; + $posx = $this->marge_gauche; + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80; + $hautcadre = 40; // Show sender frame $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('', '', $default_font_size - 2); - $pdf->SetXY($posx, $posy-5); + $pdf->SetXY($posx, $posy - 5); $pdf->MultiCell(66, 5, $outputlangs->transnoentities("BillFrom").":", 0, 'L'); $pdf->SetXY($posx, $posy); $pdf->SetFillColor(230, 230, 230); @@ -1416,63 +1416,63 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->SetTextColor(0, 0, 60); // Show sender name - $pdf->SetXY($posx+2, $posy+3); + $pdf->SetXY($posx + 2, $posy + 3); $pdf->SetFont('', 'B', $default_font_size); $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); - $posy=$pdf->getY(); + $posy = $pdf->getY(); // Show sender information - $pdf->SetXY($posx+2, $posy); + $pdf->SetXY($posx + 2, $posy); $pdf->SetFont('', '', $default_font_size - 1); $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); // If CUSTOMER contact defined, we use it - $usecontact=false; - $arrayidcontact=$object->getIdContact('external', 'CUSTOMER'); + $usecontact = false; + $arrayidcontact = $object->getIdContact('external', 'CUSTOMER'); if (count($arrayidcontact) > 0) { - $usecontact=true; - $result=$object->fetch_contact($arrayidcontact[0]); + $usecontact = true; + $result = $object->fetch_contact($arrayidcontact[0]); } // Recipient name - if (! empty($usecontact)) + if (!empty($usecontact)) { // On peut utiliser le nom de la societe du contact - if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; + if (!empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; else $socname = $object->thirdparty->name; - $carac_client_name=$outputlangs->convToOutputCharset($socname); + $carac_client_name = $outputlangs->convToOutputCharset($socname); } else { - $carac_client_name=$outputlangs->convToOutputCharset($object->thirdparty->name); + $carac_client_name = $outputlangs->convToOutputCharset($object->thirdparty->name); } - $carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact?$object->contact:''), $usecontact, 'target', $object); + $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target', $object); // Show recipient - $widthrecbox=100; - if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format - $posy=42+$top_shift; - $posx=$this->page_largeur-$this->marge_droite-$widthrecbox; - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; + $widthrecbox = 100; + if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format + $posy = 42 + $top_shift; + $posx = $this->page_largeur - $this->marge_droite - $widthrecbox; + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche; // Show recipient frame $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('', '', $default_font_size - 2); - $pdf->SetXY($posx+2, $posy-5); + $pdf->SetXY($posx + 2, $posy - 5); $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":", 0, 'L'); $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre); // Show recipient name - $pdf->SetXY($posx+2, $posy+3); + $pdf->SetXY($posx + 2, $posy + 3); $pdf->SetFont('', 'B', $default_font_size); $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L'); // Show recipient information $pdf->SetFont('', '', $default_font_size - 1); - $pdf->SetXY($posx+2, $posy+4+(dol_nboflines_bis($carac_client_name, 50)*4)); + $pdf->SetXY($posx + 2, $posy + 4 + (dol_nboflines_bis($carac_client_name, 50) * 4)); $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); } @@ -1493,7 +1493,7 @@ class pdf_aurore extends ModelePDFSupplierProposal protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_PROPOSAL_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index fcff59cb21a..492590c65e4 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -45,7 +45,7 @@ if ($massaction == 'presend') $listofselectedthirdparties = array(); $listofselectedref = array(); - if (! GETPOST('cancel', 'alpha')) + if (!GETPOST('cancel', 'alpha')) { foreach ($arrayofselected as $toselectid) { @@ -66,25 +66,25 @@ if ($massaction == 'presend') print ''; - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); dol_fiche_head(null, '', ''); // Cree l'objet formulaire mail - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->withform = -1; - $formmail->fromtype = (GETPOST('fromtype') ? GETPOST('fromtype') : (! empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : 'user')); + $formmail->fromtype = (GETPOST('fromtype') ? GETPOST('fromtype') : (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : 'user')); if ($formmail->fromtype === 'user') { $formmail->fromid = $user->id; } $formmail->trackid = $trackid; - if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set + if (!empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set { - include DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; + include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $formmail->frommail = dolAddEmailTrackId($formmail->frommail, $trackid); } $formmail->withfrom = 1; @@ -112,10 +112,10 @@ if ($massaction == 'presend') $formmail->withtoreadonly = 1; } - $formmail->withoptiononeemailperrecipient = ((count($listofselectedref) == 1 && count(reset($listofselectedref)) == 1) || empty($liste)) ? 0 : ((GETPOST('oneemailperrecipient')=='on')?1:-1); + $formmail->withoptiononeemailperrecipient = ((count($listofselectedref) == 1 && count(reset($listofselectedref)) == 1) || empty($liste)) ? 0 : ((GETPOST('oneemailperrecipient') == 'on') ? 1 : -1); - $formmail->withto = empty($liste)?(GETPOST('sendto', 'alpha')?GETPOST('sendto', 'alpha'):array()):$liste; - $formmail->withtofree = empty($liste)?1:0; + $formmail->withto = empty($liste) ? (GETPOST('sendto', 'alpha') ?GETPOST('sendto', 'alpha') : array()) : $liste; + $formmail->withtofree = empty($liste) ? 1 : 0; $formmail->withtocc = 1; $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC; $formmail->withtopic = $langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__'); @@ -134,8 +134,8 @@ if ($massaction == 'presend') $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $object); $substitutionarray['__EMAIL__'] = $sendto; - $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '' : ''; - $substitutionarray['__PERSONALIZED__'] = ''; // deprecated + $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '' : ''; + $substitutionarray['__PERSONALIZED__'] = ''; // deprecated $substitutionarray['__CONTACTCIVNAME__'] = ''; $parameters = array( @@ -152,11 +152,11 @@ if ($massaction == 'presend') $formmail->param['models_id'] = GETPOST('modelmailselected', 'int'); $formmail->param['id'] = join(',', $arrayofselected); // $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; - if (! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && count($listofselectedthirdparties) > $conf->global->MAILING_LIMIT_SENDBYWEB) + if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && count($listofselectedthirdparties) > $conf->global->MAILING_LIMIT_SENDBYWEB) { $langs->load("errors"); - print img_warning() . ' ' . $langs->trans('WarningNumberOfRecipientIsRestrictedInMassAction', $conf->global->MAILING_LIMIT_SENDBYWEB); - print ' - ' . $langs->trans("GoBack") . ''; + print img_warning().' '.$langs->trans('WarningNumberOfRecipientIsRestrictedInMassAction', $conf->global->MAILING_LIMIT_SENDBYWEB); + print ' - '.$langs->trans("GoBack").''; $arrayofmassactions = array(); } else @@ -172,7 +172,7 @@ $parameters = array( 'uploaddir' => $uploaddir ); -$reshook=$hookmanager->executeHooks('doPreMassActions', $parameters, $object, $action); +$reshook = $hookmanager->executeHooks('doPreMassActions', $parameters, $object, $action); if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } else { diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 5cde792bbb5..82a898a8ddf 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1308,7 +1308,7 @@ class Cronjob extends CommonObject public function LibStatut($status, $mode = 0, $processing = 0, $lastresult = 0) { // phpcs:enable - $this->labelStatus = array(); // Force reset o array because label depends on other fields + $this->labelStatus = array(); // Force reset o array because label depends on other fields $this->labelStatusShort = array(); if (empty($this->labelStatus) || empty($this->labelStatusShort)) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index cbca46576a1..79e418206a5 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -389,7 +389,7 @@ if (empty($reshook)) // CONTENT $link = $urlwithroot.'/expensereport/card.php?id='.$object->id; - $link = '' . $link . ''; + $link = ''.$link.''; $message = $langs->transnoentities("ExpenseReportWaitingForApprovalMessage", $expediteur->getFullName($langs), get_date_range($object->date_debut, $object->date_fin, '', $langs), $link); // Rebuild pdf @@ -509,7 +509,7 @@ if (empty($reshook)) // CONTENT $link = $urlwithroot.'/expensereport/card.php?id='.$object->id; - $link = '' . $link . ''; + $link = ''.$link.''; $dateRefusEx = explode(" ", $object->date_refuse); $message = $langs->transnoentities("ExpenseReportWaitingForReApprovalMessage", $dateRefusEx[0], $object->detail_refuse, $expediteur->getFullName($langs), $link); @@ -635,7 +635,7 @@ if (empty($reshook)) // CONTENT $link = $urlwithroot.'/expensereport/card.php?id='.$object->id; - $link = '' . $link . ''; + $link = ''.$link.''; $message = $langs->transnoentities("ExpenseReportApprovedMessage", $object->ref, $destinataire->getFullName($langs), $expediteur->getFullName($langs), $link); // Rebuilt pdf @@ -755,7 +755,7 @@ if (empty($reshook)) // CONTENT $link = $urlwithroot.'/expensereport/card.php?id='.$object->id; - $link = '' . $link . ''; + $link = ''.$link.''; $message = $langs->transnoentities("ExpenseReportRefusedMessage", $object->ref, $destinataire->getFullName($langs), $expediteur->getFullName($langs), $detailRefuse, $link); // Rebuilt pdf @@ -885,7 +885,7 @@ if (empty($reshook)) // CONTENT $link = $urlwithroot.'/expensereport/card.php?id='.$object->id; - $link = '' . $link . ''; + $link = ''.$link.''; $message = $langs->transnoentities("ExpenseReportCanceledMessage", $object->ref, $destinataire->getFullName($langs), $expediteur->getFullName($langs), $detailCancel, $link); // Rebuilt pdf @@ -1111,7 +1111,7 @@ if (empty($reshook)) // CONTENT $link = $urlwithroot.'/expensereport/card.php?id='.$object->id; - $link = '' . $link . ''; + $link = ''.$link.''; $message = $langs->transnoentities("ExpenseReportPaidMessage", $object->ref, $destinataire->getFullName($langs), $expediteur->getFullName($langs), $link); // Generate pdf before attachment diff --git a/htdocs/expensereport/class/expensereportstats.class.php b/htdocs/expensereport/class/expensereportstats.class.php index 9c614e4953c..f400d5e4277 100644 --- a/htdocs/expensereport/class/expensereportstats.class.php +++ b/htdocs/expensereport/class/expensereportstats.class.php @@ -22,8 +22,8 @@ * \ingroup expensereport * \brief Fichier de la classe de gestion des stats des expensereport et notes de frais */ -require_once DOL_DOCUMENT_ROOT . '/core/class/stats.class.php'; -require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/stats.class.php'; +require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; /** * Classe permettant la gestion des stats des expensereports et notes de frais @@ -61,29 +61,29 @@ class ExpenseReportStats extends Stats $this->socid = $socid; $this->userid = $userid; - $object=new ExpenseReport($this->db); + $object = new ExpenseReport($this->db); $this->from = MAIN_DB_PREFIX.$object->table_element." as e"; - $this->field='total_ht'; + $this->field = 'total_ht'; //$this->where = " e.fk_statut > 0"; //$this->where.= " AND e.date_valid > '2000-01-01'"; // To filter only correct "valid date". If date is invalid, the group by on it will fails. Launch a repair.php if you have. - $this->where.= ' e.entity IN ('.getEntity('expensereport').')'; + $this->where .= ' e.entity IN ('.getEntity('expensereport').')'; //$this->where.= " AND entity = ".$conf->entity; if ($this->socid) { - $this->where.=" AND e.fk_soc = ".$this->socid; + $this->where .= " AND e.fk_soc = ".$this->socid; } // Only me and subordinates if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)) { $childids = $user->getAllChildIds(); - $childids[]=$user->id; - $this->where.=" AND e.fk_user_author IN (".(join(',', $childids)).")"; + $childids[] = $user->id; + $this->where .= " AND e.fk_user_author IN (".(join(',', $childids)).")"; } - if ($this->userid > 0) $this->where.=' AND e.fk_user_author = '.$this->userid; + if ($this->userid > 0) $this->where .= ' AND e.fk_user_author = '.$this->userid; } @@ -95,9 +95,9 @@ class ExpenseReportStats extends Stats public function getNbByYear() { $sql = "SELECT YEAR(".$this->db->ifsql('e.'.$this->datetouse.' IS NULL', 'e.date_create', 'e.'.$this->datetouse).") as dm, count(*)"; - $sql.= " FROM ".$this->from; - $sql.= " GROUP BY dm DESC"; - $sql.= " WHERE ".$this->where; + $sql .= " FROM ".$this->from; + $sql .= " GROUP BY dm DESC"; + $sql .= " WHERE ".$this->where; return $this->_getNbByYear($sql); } @@ -113,13 +113,13 @@ class ExpenseReportStats extends Stats public function getNbByMonth($year, $format = 0) { $sql = "SELECT MONTH(".$this->db->ifsql('e.'.$this->datetouse.' IS NULL', 'e.date_create', 'e.'.$this->datetouse).") as dm, count(*)"; - $sql.= " FROM ".$this->from; - $sql.= " WHERE YEAR(e.".$this->datetouse.") = ".$year; - $sql.= " AND ".$this->where; - $sql.= " GROUP BY dm"; - $sql.= $this->db->order('dm', 'DESC'); + $sql .= " FROM ".$this->from; + $sql .= " WHERE YEAR(e.".$this->datetouse.") = ".$year; + $sql .= " AND ".$this->where; + $sql .= " GROUP BY dm"; + $sql .= $this->db->order('dm', 'DESC'); - $res=$this->_getNbByMonth($year, $sql, $format); + $res = $this->_getNbByMonth($year, $sql, $format); //var_dump($res);print '
'; return $res; } @@ -135,13 +135,13 @@ class ExpenseReportStats extends Stats public function getAmountByMonth($year, $format = 0) { $sql = "SELECT date_format(".$this->db->ifsql('e.'.$this->datetouse.' IS NULL', 'e.date_create', 'e.'.$this->datetouse).",'%m') as dm, sum(".$this->field.")"; - $sql.= " FROM ".$this->from; - $sql.= " WHERE date_format(".$this->db->ifsql('e.'.$this->datetouse.' IS NULL', 'e.date_create', 'e.'.$this->datetouse).",'%Y') = '".$year."'"; - $sql.= " AND ".$this->where; - $sql.= " GROUP BY dm"; - $sql.= $this->db->order('dm', 'DESC'); + $sql .= " FROM ".$this->from; + $sql .= " WHERE date_format(".$this->db->ifsql('e.'.$this->datetouse.' IS NULL', 'e.date_create', 'e.'.$this->datetouse).",'%Y') = '".$year."'"; + $sql .= " AND ".$this->where; + $sql .= " GROUP BY dm"; + $sql .= $this->db->order('dm', 'DESC'); - $res=$this->_getAmountByMonth($year, $sql, $format); + $res = $this->_getAmountByMonth($year, $sql, $format); //var_dump($res);print '
'; return $res; } @@ -155,11 +155,11 @@ class ExpenseReportStats extends Stats public function getAverageByMonth($year) { $sql = "SELECT date_format(".$this->db->ifsql('e.'.$this->datetouse.' IS NULL', 'e.date_create', 'e.'.$this->datetouse).",'%m') as dm, avg(".$this->field.")"; - $sql.= " FROM ".$this->from; - $sql.= " WHERE date_format(".$this->db->ifsql('e.'.$this->datetouse.' IS NULL', 'e.date_create', 'e.'.$this->datetouse).",'%Y') = '".$year."'"; - $sql.= " AND ".$this->where; - $sql.= " GROUP BY dm"; - $sql.= $this->db->order('dm', 'DESC'); + $sql .= " FROM ".$this->from; + $sql .= " WHERE date_format(".$this->db->ifsql('e.'.$this->datetouse.' IS NULL', 'e.date_create', 'e.'.$this->datetouse).",'%Y') = '".$year."'"; + $sql .= " AND ".$this->where; + $sql .= " GROUP BY dm"; + $sql .= $this->db->order('dm', 'DESC'); return $this->_getAverageByMonth($year, $sql); } @@ -172,10 +172,10 @@ class ExpenseReportStats extends Stats public function getAllByYear() { $sql = "SELECT date_format(".$this->db->ifsql('e.'.$this->datetouse.' IS NULL', 'e.date_create', 'e.'.$this->datetouse).",'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg"; - $sql.= " FROM ".$this->from; - $sql.= " WHERE ".$this->where; - $sql.= " GROUP BY year"; - $sql.= $this->db->order('year', 'DESC'); + $sql .= " FROM ".$this->from; + $sql .= " WHERE ".$this->where; + $sql .= " GROUP BY year"; + $sql .= $this->db->order('year', 'DESC'); return $this->_getAllByYear($sql); } diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 525a5b17c9e..f910001a5e0 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -379,7 +379,7 @@ if ($step == 2 && $action == 'select_model') { $fieldsarray = preg_split("/,(?! [^(]*\))/", $objexport->hexa); $i = 1; - foreach($fieldsarray as $val) + foreach ($fieldsarray as $val) { $array_selected[$val] = $i; $i++; diff --git a/htdocs/fourn/ajax/getSupplierPrices.php b/htdocs/fourn/ajax/getSupplierPrices.php index 2d18c6ea86e..0c0d8f42c9e 100644 --- a/htdocs/fourn/ajax/getSupplierPrices.php +++ b/htdocs/fourn/ajax/getSupplierPrices.php @@ -22,20 +22,20 @@ * \brief File to return an Ajax response to get list of possible prices for margin calculation */ -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); -if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); -if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); +if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; -$idprod=GETPOST('idprod', 'int'); +$idprod = GETPOST('idprod', 'int'); $prices = array(); // Load translation files required by the page -$langs->loadLangs(array("stocks","margins")); +$langs->loadLangs(array("stocks", "margins")); /* @@ -48,14 +48,14 @@ top_httphead(); if ($idprod > 0) { - $producttmp=new ProductFournisseur($db); + $producttmp = new ProductFournisseur($db); $producttmp->fetch($idprod); $sorttouse = 's.nom, pfp.quantity, pfp.price'; if (GETPOST('bestpricefirst')) $sorttouse = 'pfp.unitprice, s.nom, pfp.quantity, pfp.price'; - $productSupplierArray = $producttmp->list_product_fournisseur_price($idprod, $sorttouse); // We list all price per supplier, and then firstly with the lower quantity. So we can choose first one with enough quantity into list. - if ( is_array($productSupplierArray)) + $productSupplierArray = $producttmp->list_product_fournisseur_price($idprod, $sorttouse); // We list all price per supplier, and then firstly with the lower quantity. So we can choose first one with enough quantity into list. + if (is_array($productSupplierArray)) { foreach ($productSupplierArray as $productSupplier) { @@ -66,35 +66,35 @@ if ($idprod > 0) if ($productSupplier->fourn_qty == 1) { - $title.= price($price, 0, $langs, 0, 0, -1, $conf->currency)."/"; + $title .= price($price, 0, $langs, 0, 0, -1, $conf->currency)."/"; } - $title.= $productSupplier->fourn_qty.' '.($productSupplier->fourn_qty == 1 ? $langs->trans("Unit") : $langs->trans("Units")); + $title .= $productSupplier->fourn_qty.' '.($productSupplier->fourn_qty == 1 ? $langs->trans("Unit") : $langs->trans("Units")); if ($productSupplier->fourn_qty > 1) { - $title.=" - "; - $title.= price($unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit"); + $title .= " - "; + $title .= price($unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit"); $price = $unitprice; } $label = price($price, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit"); - if ($productSupplier->fourn_ref) $label.=' ('.$productSupplier->fourn_ref.')'; + if ($productSupplier->fourn_ref) $label .= ' ('.$productSupplier->fourn_ref.')'; - $prices[] = array("id" => $productSupplier->product_fourn_price_id, "price" => price2num($price, 0, '', 0), "label" => $label, "title" => $title); // For price field, we must use price2num(), for label or title, price() + $prices[] = array("id" => $productSupplier->product_fourn_price_id, "price" => price2num($price, 0, '', 0), "label" => $label, "title" => $title); // For price field, we must use price2num(), for label or title, price() } } // After best supplier prices and before costprice - if(!empty($conf->stock->enabled)) + if (!empty($conf->stock->enabled)) { // Add price for pmp - $price=$producttmp->pmp; - $prices[] = array("id" => 'pmpprice', "price" => price2num($price), "label" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency), "title" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency)); // For price field, we must use price2num(), for label or title, price() + $price = $producttmp->pmp; + $prices[] = array("id" => 'pmpprice', "price" => price2num($price), "label" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency), "title" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency)); // For price field, we must use price2num(), for label or title, price() } // Add price for costprice (at end) - $price=$producttmp->cost_price; - $prices[] = array("id" => 'costprice', "price" => price2num($price), "label" => $langs->trans("CostPrice").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency), "title" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency)); // For price field, we must use price2num(), for label or title, price() + $price = $producttmp->cost_price; + $prices[] = array("id" => 'costprice', "price" => price2num($price), "label" => $langs->trans("CostPrice").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency), "title" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency)); // For price field, we must use price2num(), for label or title, price() } echo json_encode($prices); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 9064e8292fe..bd74d52a4d5 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -65,7 +65,7 @@ class CommandeFournisseur extends CommonOrder /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ - public $picto='order'; + public $picto = 'order'; /** * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe @@ -442,7 +442,7 @@ class CommandeFournisseur extends CommonOrder $line->fk_product = $objp->fk_product; - $line->libelle = $objp->product_label; // deprecated + $line->libelle = $objp->product_label; // deprecated $line->product_label = $objp->product_label; $line->product_desc = $objp->product_desc; @@ -1414,38 +1414,38 @@ class CommandeFournisseur extends CommonOrder */ public function createFromClone(User $user, $socid = 0) { - global $conf, $user,$hookmanager; + global $conf, $user, $hookmanager; - $error=0; + $error = 0; $this->db->begin(); // get lines so they will be clone - foreach($this->lines as $line) + foreach ($this->lines as $line) $line->fetch_optionals(); // Load source object $objFrom = clone $this; // Change socid if needed - if (! empty($socid) && $socid != $this->socid) + if (!empty($socid) && $socid != $this->socid) { $objsoc = new Societe($this->db); - if ($objsoc->fetch($socid)>0) + if ($objsoc->fetch($socid) > 0) { - $this->socid = $objsoc->id; - $this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0); - $this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0); - $this->fk_project = 0; - $this->fk_delivery_address = 0; + $this->socid = $objsoc->id; + $this->cond_reglement_id = (!empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0); + $this->mode_reglement_id = (!empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0); + $this->fk_project = 0; + $this->fk_delivery_address = 0; } // TODO Change product price if multi-prices } - $this->id=0; - $this->statut=self::STATUS_DRAFT; + $this->id = 0; + $this->statut = self::STATUS_DRAFT; // Clear fields $this->user_author_id = $user->id; @@ -2400,7 +2400,7 @@ class CommandeFournisseur extends CommonOrder $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseurdet"; $sql .= " (fk_commande, label, description, fk_product, price, qty, tva_tx, localtax1_tx, localtax2_tx, remise_percent, subprice, remise, ref)"; - $sql .= " VALUES (".$idc.", '" . $this->db->escape($label) . "','" . $this->db->escape($comclient->lines[$i]->desc) . "'"; + $sql .= " VALUES (".$idc.", '".$this->db->escape($label)."','".$this->db->escape($comclient->lines[$i]->desc)."'"; $sql .= ",".$comclient->lines[$i]->fk_product.",'".price2num($comclient->lines[$i]->price)."'"; $sql .= ", '".$comclient->lines[$i]->qty."', ".$comclient->lines[$i]->tva_tx.", ".$comclient->lines[$i]->localtax1_tx.", ".$comclient->lines[$i]->localtax2_tx.", ".$comclient->lines[$i]->remise_percent; $sql .= ", '".price2num($comclient->lines[$i]->subprice)."','0','".$ref."');"; @@ -2623,7 +2623,7 @@ class CommandeFournisseur extends CommonOrder if (is_array($array_options) && count($array_options) > 0) { // We replace values in this->line->array_options only for entries defined into $array_options - foreach($array_options as $key => $value) { + foreach ($array_options as $key => $value) { $this->line->array_options[$key] = $array_options[$key]; } } @@ -2795,26 +2795,26 @@ class CommandeFournisseur extends CommonOrder // phpcs:enable global $conf, $user; - $this->nb=array(); + $this->nb = array(); $clause = "WHERE"; $sql = "SELECT count(co.rowid) as nb"; - $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as co"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON co.fk_soc = s.rowid"; + $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as co"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON co.fk_soc = s.rowid"; if (!$user->rights->societe->client->voir && !$user->socid) { - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; - $sql.= " WHERE sc.fk_user = " .$user->id; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; + $sql .= " WHERE sc.fk_user = ".$user->id; $clause = "AND"; } - $sql.= " ".$clause." co.entity = ".$conf->entity; + $sql .= " ".$clause." co.entity = ".$conf->entity; - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { - while ($obj=$this->db->fetch_object($resql)) + while ($obj = $this->db->fetch_object($resql)) { - $this->nb["supplier_orders"]=$obj->nb; + $this->nb["supplier_orders"] = $obj->nb; } $this->db->free($resql); return 1; @@ -2843,41 +2843,41 @@ class CommandeFournisseur extends CommonOrder $clause = " WHERE"; $sql = "SELECT c.rowid, c.date_creation as datec, c.date_commande, c.fk_statut, c.date_livraison as delivery_date"; - $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c"; + $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c"; if (!$user->rights->societe->client->voir && !$user->socid) { - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc"; - $sql.= " WHERE sc.fk_user = " .$user->id; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc"; + $sql .= " WHERE sc.fk_user = ".$user->id; $clause = " AND"; } - $sql.= $clause." c.entity = ".$conf->entity; - if($mode==='awaiting'){ - $sql.= " AND c.fk_statut = ".self::STATUS_ORDERSENT; + $sql .= $clause." c.entity = ".$conf->entity; + if ($mode === 'awaiting') { + $sql .= " AND c.fk_statut = ".self::STATUS_ORDERSENT; } - else{ - $sql.= " AND c.fk_statut IN (".self::STATUS_VALIDATED.", ".self::STATUS_ACCEPTED.")"; + else { + $sql .= " AND c.fk_statut IN (".self::STATUS_VALIDATED.", ".self::STATUS_ACCEPTED.")"; } - if ($user->socid) $sql.=" AND c.fk_soc = ".$user->socid; + if ($user->socid) $sql .= " AND c.fk_soc = ".$user->socid; - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $commandestatic = new CommandeFournisseur($this->db); $response = new WorkboardResponse(); - $response->warning_delay=$conf->commande->fournisseur->warning_delay/60/60/24; - $response->label=$langs->trans("SuppliersOrdersToProcess"); - $response->labelShort=$langs->trans("Opened"); - $response->url=DOL_URL_ROOT.'/fourn/commande/list.php?statut=1,2&mainmenu=commercial&leftmenu=orders_suppliers'; - $response->img=img_object('', "order"); + $response->warning_delay = $conf->commande->fournisseur->warning_delay / 60 / 60 / 24; + $response->label = $langs->trans("SuppliersOrdersToProcess"); + $response->labelShort = $langs->trans("Opened"); + $response->url = DOL_URL_ROOT.'/fourn/commande/list.php?statut=1,2&mainmenu=commercial&leftmenu=orders_suppliers'; + $response->img = img_object('', "order"); - if($mode==='awaiting'){ - $response->label=$langs->trans("SuppliersOrdersAwaitingReception"); - $response->labelShort=$langs->trans("AwaitingReception"); - $response->url=DOL_URL_ROOT.'/fourn/commande/list.php?statut=3&mainmenu=commercial&leftmenu=orders_suppliers'; + if ($mode === 'awaiting') { + $response->label = $langs->trans("SuppliersOrdersAwaitingReception"); + $response->labelShort = $langs->trans("AwaitingReception"); + $response->url = DOL_URL_ROOT.'/fourn/commande/list.php?statut=3&mainmenu=commercial&leftmenu=orders_suppliers'; } - while ($obj=$this->db->fetch_object($resql)) + while ($obj = $this->db->fetch_object($resql)) { $response->nbtodo++; @@ -2953,12 +2953,12 @@ class CommandeFournisseur extends CommonOrder $langs->load("suppliers"); - if (! dol_strlen($modele)) { + if (!dol_strlen($modele)) { $modele = 'muscadet'; if ($this->modelpdf) { $modele = $this->modelpdf; - } elseif (! empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF)) { + } elseif (!empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF)) { $modele = $conf->global->COMMANDE_SUPPLIER_ADDON_PDF; } } @@ -3642,20 +3642,20 @@ class CommandeFournisseurLigne extends CommonOrderLine { global $user; - $error=0; + $error = 0; $this->db->begin(); $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commande_fournisseurdet WHERE rowid=".$this->id; dol_syslog(__METHOD__, LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { if (!$notrigger) { // Call trigger - $result=$this->call_trigger('LINEORDER_SUPPLIER_DELETE', $user); + $result = $this->call_trigger('LINEORDER_SUPPLIER_DELETE', $user); if ($result < 0) $error++; // End call triggers } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 4bdb3c70a21..231a5e9e910 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1952,7 +1952,7 @@ class FactureFournisseur extends CommonInvoice if (is_array($array_options) && count($array_options) > 0) { // We replace values in this->line->array_options only for entries defined into $array_options - foreach($array_options as $key => $value) { + foreach ($array_options as $key => $value) { $this->line->array_options[$key] = $array_options[$key]; } } diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index 586b6b59036..b30d1463b50 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -433,19 +433,19 @@ class Loan extends CommonObject global $langs; // Load translation files required by the page - $langs->loadLangs(array("customers","bills")); + $langs->loadLangs(array("customers", "bills")); - unset($this->labelStatus); // Force to reset the array of status label, because label can change depending on parameters + unset($this->labelStatus); // Force to reset the array of status label, because label can change depending on parameters if (empty($this->labelStatus) || empty($this->labelStatusShort)) { global $langs; //$langs->load("mymodule"); $this->labelStatus[self::STATUS_UNPAID] = $langs->trans('Unpaid'); $this->labelStatus[self::STATUS_PAID] = $langs->trans('Paid'); - if ($status == 0 && $alreadypaid > 0) $this->labelStatus[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted"); + if ($status == 0 && $alreadypaid > 0) $this->labelStatus[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted"); $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans('Unpaid'); $this->labelStatusShort[self::STATUS_PAID] = $langs->trans('Enabled'); - if ($status == 0 && $alreadypaid > 0) $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted"); + if ($status == 0 && $alreadypaid > 0) $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted"); } $statusType = 'status1'; diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 51e35ab050a..f5d2d130e12 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -197,18 +197,18 @@ if ($dirins && $action == 'initmodule' && $modulename) 'Mon module'=>$modulename, 'mon module'=>$modulename, 'htdocs/modulebuilder/template'=>strtolower($modulename), - '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'') + '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '') ); - if($conf->global->MAIN_FEATURES_LEVEL >= 2){ - if(!empty($conf->global->MODULEBUILDER_SPECIFIC_EDITOR_NAME)) $arrayreplacement['Editor name'] = $conf->global->MODULEBUILDER_SPECIFIC_EDITOR_NAME; - if(!empty($conf->global->MODULEBUILDER_SPECIFIC_EDITOR_URL)) $arrayreplacement['https://www.example.com'] = $conf->global->MODULEBUILDER_SPECIFIC_EDITOR_URL; - if(!empty($conf->global->MODULEBUILDER_SPECIFIC_AUTHOR)) $arrayreplacement['---Put here your own copyright and developer email---'] = dol_print_date($now, '%Y').' '.$conf->global->MODULEBUILDER_SPECIFIC_AUTHOR; - if(!empty($conf->global->MODULEBUILDER_SPECIFIC_VERSION)) $arrayreplacement['1.0'] = $conf->global->MODULEBUILDER_SPECIFIC_VERSION; - if(!empty($conf->global->MODULEBUILDER_SPECIFIC_FAMILY)) $arrayreplacement['other'] = $conf->global->MODULEBUILDER_SPECIFIC_FAMILY; + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { + if (!empty($conf->global->MODULEBUILDER_SPECIFIC_EDITOR_NAME)) $arrayreplacement['Editor name'] = $conf->global->MODULEBUILDER_SPECIFIC_EDITOR_NAME; + if (!empty($conf->global->MODULEBUILDER_SPECIFIC_EDITOR_URL)) $arrayreplacement['https://www.example.com'] = $conf->global->MODULEBUILDER_SPECIFIC_EDITOR_URL; + if (!empty($conf->global->MODULEBUILDER_SPECIFIC_AUTHOR)) $arrayreplacement['---Put here your own copyright and developer email---'] = dol_print_date($now, '%Y').' '.$conf->global->MODULEBUILDER_SPECIFIC_AUTHOR; + if (!empty($conf->global->MODULEBUILDER_SPECIFIC_VERSION)) $arrayreplacement['1.0'] = $conf->global->MODULEBUILDER_SPECIFIC_VERSION; + if (!empty($conf->global->MODULEBUILDER_SPECIFIC_FAMILY)) $arrayreplacement['other'] = $conf->global->MODULEBUILDER_SPECIFIC_FAMILY; } - $result=dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); + $result = dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); //var_dump($result); if ($result < 0) @@ -235,7 +235,7 @@ if ($dirins && $action == 'initmodule' && $modulename) if ($dirins && $action == 'initapi' && !empty($module)) { - $modulename = ucfirst($module); // Force first letter in uppercase + $modulename = ucfirst($module); // Force first letter in uppercase $objectname = $tabobj; dol_mkdir($dirins.'/'.strtolower($module).'/class'); @@ -248,7 +248,7 @@ if ($dirins && $action == 'initapi' && !empty($module)) if ($result > 0) { //var_dump($phpfileval['fullname']); - $arrayreplacement=array( + $arrayreplacement = array( 'mymodule'=>strtolower($modulename), 'MyModule'=>$modulename, 'MYMODULE'=>strtoupper($modulename), @@ -260,7 +260,7 @@ if ($dirins && $action == 'initapi' && !empty($module)) 'myobject'=>strtolower($objectname), 'MyObject'=>$objectname, 'MYOBJECT'=>strtoupper($objectname), - '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'') + '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '') ); dolReplaceInFile($destfile, $arrayreplacement); @@ -273,7 +273,7 @@ if ($dirins && $action == 'initapi' && !empty($module)) } if ($dirins && $action == 'initphpunit' && !empty($module)) { - $modulename = ucfirst($module); // Force first letter in uppercase + $modulename = ucfirst($module); // Force first letter in uppercase $objectname = $tabobj; dol_mkdir($dirins.'/'.strtolower($module).'/class'); @@ -285,7 +285,7 @@ if ($dirins && $action == 'initphpunit' && !empty($module)) if ($result > 0) { //var_dump($phpfileval['fullname']); - $arrayreplacement=array( + $arrayreplacement = array( 'mymodule'=>strtolower($modulename), 'MyModule'=>$modulename, 'MYMODULE'=>strtoupper($modulename), @@ -297,7 +297,7 @@ if ($dirins && $action == 'initphpunit' && !empty($module)) 'myobject'=>strtolower($objectname), 'MyObject'=>$objectname, 'MYOBJECT'=>strtoupper($objectname), - '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'') + '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '') ); dolReplaceInFile($destfile, $arrayreplacement); @@ -310,7 +310,7 @@ if ($dirins && $action == 'initphpunit' && !empty($module)) } if ($dirins && $action == 'initsqlextrafields' && !empty($module)) { - $modulename = ucfirst($module); // Force first letter in uppercase + $modulename = ucfirst($module); // Force first letter in uppercase $objectname = $tabobj; dol_mkdir($dirins.'/'.strtolower($module).'/sql'); @@ -326,10 +326,10 @@ if ($dirins && $action == 'initsqlextrafields' && !empty($module)) if ($result1 > 0 && $result2 > 0) { - $modulename = ucfirst($module); // Force first letter in uppercase + $modulename = ucfirst($module); // Force first letter in uppercase //var_dump($phpfileval['fullname']); - $arrayreplacement=array( + $arrayreplacement = array( 'mymodule'=>strtolower($modulename), 'MyModule'=>$modulename, 'MYMODULE'=>strtoupper($modulename), @@ -342,7 +342,7 @@ if ($dirins && $action == 'initsqlextrafields' && !empty($module)) 'MyObject'=>$objectname, 'my object'=>strtolower($objectname), 'myobject'=>strtolower($objectname), - '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'') + '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '') ); dolReplaceInFile($destfile1, $arrayreplacement); @@ -446,7 +446,7 @@ if ($dirins && $action == 'initwidget' && !empty($module)) 'Mon module'=>$modulename, 'mon module'=>$modulename, 'htdocs/modulebuilder/template'=>strtolower($modulename), - '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'') + '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '') ); dolReplaceInFile($destfile, $arrayreplacement); @@ -468,10 +468,10 @@ if ($dirins && $action == 'initcss' && !empty($module)) if ($result > 0) { - $modulename = ucfirst($module); // Force first letter in uppercase + $modulename = ucfirst($module); // Force first letter in uppercase //var_dump($phpfileval['fullname']); - $arrayreplacement=array( + $arrayreplacement = array( 'mymodule'=>strtolower($modulename), 'MyModule'=>$modulename, 'MYMODULE'=>strtoupper($modulename), @@ -480,7 +480,7 @@ if ($dirins && $action == 'initcss' && !empty($module)) 'Mon module'=>$modulename, 'mon module'=>$modulename, 'htdocs/modulebuilder/template'=>strtolower($modulename), - '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':''), + '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : ''), ); dolReplaceInFile($destfile, $arrayreplacement); @@ -507,10 +507,10 @@ if ($dirins && $action == 'initjs' && !empty($module)) if ($result > 0) { - $modulename = ucfirst($module); // Force first letter in uppercase + $modulename = ucfirst($module); // Force first letter in uppercase //var_dump($phpfileval['fullname']); - $arrayreplacement=array( + $arrayreplacement = array( 'mymodule'=>strtolower($modulename), 'MyModule'=>$modulename, 'MYMODULE'=>strtoupper($modulename), @@ -519,7 +519,7 @@ if ($dirins && $action == 'initjs' && !empty($module)) 'Mon module'=>$modulename, 'mon module'=>$modulename, 'htdocs/modulebuilder/template'=>strtolower($modulename), - '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'') + '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '') ); dolReplaceInFile($destfile, $arrayreplacement); @@ -546,10 +546,10 @@ if ($dirins && $action == 'initcli' && !empty($module)) if ($result > 0) { - $modulename = ucfirst($module); // Force first letter in uppercase + $modulename = ucfirst($module); // Force first letter in uppercase //var_dump($phpfileval['fullname']); - $arrayreplacement=array( + $arrayreplacement = array( 'mymodule'=>strtolower($modulename), 'MyModule'=>$modulename, 'MYMODULE'=>strtoupper($modulename), @@ -707,15 +707,15 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray', );*/ $string = 'public $fields=array('."\n"; - $string.="
"; - $i=10; + $string .= "
"; + $i = 10; while ($obj = $db->fetch_object($_results)) { // fieldname $fieldname = $obj->Field; // type $type = $obj->Type; - if ($type == 'int(11)') $type='integer'; + if ($type == 'int(11)') $type = 'integer'; if ($obj->Field == 'fk_soc') $type = 'integer:Societe:societe/class/societe.class.php'; if (preg_match('/^fk_proj/', $obj->Field)) $type = 'integer:Project:projet/class/project.class.php:1:fk_statut=1'; if (preg_match('/^fk_prod/', $obj->Field)) $type = 'integer:Product:product/class/product.class.php:1'; @@ -723,22 +723,22 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray', if (preg_match('/^(fk_user|fk_commercial)/', $obj->Field)) $type = 'integer:User:user/class/user.class.php'; // notnull - $notnull = ($obj->Null == 'YES'?0:1); + $notnull = ($obj->Null == 'YES' ? 0 : 1); if ($fieldname == 'fk_user_modif') $notnull = -1; // label $label = preg_replace('/_/', ' ', ucfirst($fieldname)); - if ($fieldname == 'rowid') $label='TechnicalID'; - if ($fieldname == 'import_key') $label='ImportId'; - if ($fieldname == 'fk_soc') $label='ThirdParty'; - if ($fieldname == 'tms') $label='DateModification'; - if ($fieldname == 'datec') $label='DateCreation'; - if ($fieldname == 'date_valid') $label='DateValidation'; - if ($fieldname == 'datev') $label='DateValidation'; - if ($fieldname == 'note_private') $label='NotePublic'; - if ($fieldname == 'note_public') $label='NotePrivate'; - if ($fieldname == 'fk_user_creat') $label='UserAuthor'; - if ($fieldname == 'fk_user_modif') $label='UserModif'; - if ($fieldname == 'fk_user_valid') $label='UserValidation'; + if ($fieldname == 'rowid') $label = 'TechnicalID'; + if ($fieldname == 'import_key') $label = 'ImportId'; + if ($fieldname == 'fk_soc') $label = 'ThirdParty'; + if ($fieldname == 'tms') $label = 'DateModification'; + if ($fieldname == 'datec') $label = 'DateCreation'; + if ($fieldname == 'date_valid') $label = 'DateValidation'; + if ($fieldname == 'datev') $label = 'DateValidation'; + if ($fieldname == 'note_private') $label = 'NotePublic'; + if ($fieldname == 'note_public') $label = 'NotePrivate'; + if ($fieldname == 'fk_user_creat') $label = 'UserAuthor'; + if ($fieldname == 'fk_user_modif') $label = 'UserModif'; + if ($fieldname == 'fk_user_valid') $label = 'UserValidation'; // visible $visible = -1; if ($fieldname == 'entity') $visible = -2; @@ -750,28 +750,28 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray', $enabled = 1; // default $default = ''; - if ($fieldname == 'entity') $default=1; + if ($fieldname == 'entity') $default = 1; // position $position = $i; if (in_array($fieldname, array('status', 'statut', 'fk_status', 'fk_statut'))) $position = 500; // index $index = 0; - if ($fieldname == 'entity') $index=1; + if ($fieldname == 'entity') $index = 1; - $string.= "'".$obj->Field."' =>array('type'=>'".$type."', 'label'=>'".$label."',"; - if ($default != '') $string.= " 'default'=>".$default.","; - $string.= " 'enabled'=>".$enabled.","; - $string.= " 'visible'=>".$visible; - if ($notnull) $string.= ", 'notnull'=>".$notnull; - if ($fieldname == 'ref') $string.= ", 'showoncombobox'=>1"; - $string.= ", 'position'=>".$position; - if ($index) $string.= ", 'index'=>".$index; - $string.= "),\n"; - $string.="
"; - $i+=5; + $string .= "'".$obj->Field."' =>array('type'=>'".$type."', 'label'=>'".$label."',"; + if ($default != '') $string .= " 'default'=>".$default.","; + $string .= " 'enabled'=>".$enabled.","; + $string .= " 'visible'=>".$visible; + if ($notnull) $string .= ", 'notnull'=>".$notnull; + if ($fieldname == 'ref') $string .= ", 'showoncombobox'=>1"; + $string .= ", 'position'=>".$position; + if ($index) $string .= ", 'index'=>".$index; + $string .= "),\n"; + $string .= "
"; + $i += 5; } - $string.= ');'."\n"; - $string.="
"; + $string .= ');'."\n"; + $string .= "
"; print $string; exit; } @@ -891,14 +891,14 @@ if ($dirins && $action == 'initobject' && $module && $objectname) // Scan for object class files $listofobject = dol_dir_list($destdir.'/class', 'files', 0, '\.class\.php$'); - $firstobjectname=''; - foreach($listofobject as $fileobj) + $firstobjectname = ''; + foreach ($listofobject as $fileobj) { if (preg_match('/^api_/', $fileobj['name'])) continue; if (preg_match('/^actions_/', $fileobj['name'])) continue; - $tmpcontent=file_get_contents($fileobj['fullname']); - $reg=array(); + $tmpcontent = file_get_contents($fileobj['fullname']); + $reg = array(); if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg)) { $objectnameloop = $reg[1]; @@ -951,7 +951,7 @@ if ($dirins && $action == 'initobject' && $module && $objectname) $stringtoadd = preg_replace('/mymodule/', strtolower($module), $stringtoadd); $stringtoadd = preg_replace('/myobject/', strtolower($objectnameloop), $stringtoadd); - $moduledescriptorfile=$destdir.'/core/modules/mod'.$module.'.class.php'; + $moduledescriptorfile = $destdir.'/core/modules/mod'.$module.'.class.php'; // TODO Allow a replace with regex using dolReplaceInFile with param arryreplacementisregex to 1 // TODO Avoid duplicate addition @@ -959,19 +959,19 @@ if ($dirins && $action == 'initobject' && $module && $objectname) dolReplaceInFile($moduledescriptorfile, array('END MODULEBUILDER LEFTMENU MYOBJECT */' => '*/'."\n".$stringtoadd."\n\t\t/* END MODULEBUILDER LEFTMENU MYOBJECT */")); // Add module descriptor to list of files to replace "MyObject' string with real name of object. - $filetogenerate[]='core/modules/mod'.$module.'.class.php'; + $filetogenerate[] = 'core/modules/mod'.$module.'.class.php'; } } - if (! $error) + if (!$error) { // Edit PHP files to make replacement - foreach($filetogenerate as $destfile) + foreach ($filetogenerate as $destfile) { $phpfileval['fullname'] = $destdir.'/'.$destfile; //var_dump($phpfileval['fullname']); - $arrayreplacement=array( + $arrayreplacement = array( 'mymodule'=>strtolower($module), 'MyModule'=>$module, 'MYMODULE'=>strtoupper($module), @@ -994,38 +994,38 @@ if ($dirins && $action == 'initobject' && $module && $objectname) } } - if (! $error) + if (!$error) { // Edit the class file to write properties - $object=rebuildObjectClass($destdir, $module, $objectname, $newmask); + $object = rebuildObjectClass($destdir, $module, $objectname, $newmask); if (is_numeric($object) && $object < 0) $error++; } - if (! $error) + if (!$error) { // Edit sql with new properties - $result=rebuildObjectSql($destdir, $module, $objectname, $newmask, '', $object); + $result = rebuildObjectSql($destdir, $module, $objectname, $newmask, '', $object); if ($result < 0) $error++; } - if (! $error) + if (!$error) { setEventMessages($langs->trans('FilesForObjectInitialized', $objectname), null); $tabobj = $objectname; } } -if ($dirins && ($action == 'droptable' || $action == 'droptableextrafields') && !empty($module) && ! empty($tabobj)) +if ($dirins && ($action == 'droptable' || $action == 'droptableextrafields') && !empty($module) && !empty($tabobj)) { $objectname = $tabobj; - $arrayoftables=array(); + $arrayoftables = array(); if ($action == 'droptable') $arrayoftables[] = MAIN_DB_PREFIX.strtolower($module).'_'.strtolower($tabobj); if ($action == 'droptableextrafields') $arrayoftables[] = MAIN_DB_PREFIX.strtolower($module).'_'.strtolower($tabobj).'_extrafields'; - foreach($arrayoftables as $tabletodrop) + foreach ($arrayoftables as $tabletodrop) { $nb = -1; - $sql="SELECT COUNT(*) as nb FROM ".$tabletodrop; + $sql = "SELECT COUNT(*) as nb FROM ".$tabletodrop; $resql = $db->query($sql); if ($resql) { @@ -1070,35 +1070,35 @@ if ($dirins && $action == 'addproperty' && !empty($module) && !empty($tabobj)) dol_mkdir($destdir); // We click on add property - if (! GETPOST('regenerateclasssql') && ! GETPOST('regeneratemissing')) + if (!GETPOST('regenerateclasssql') && !GETPOST('regeneratemissing')) { - if (! GETPOST('propname', 'aZ09')) + if (!GETPOST('propname', 'aZ09')) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Name")), null, 'errors'); } - if (! GETPOST('proplabel', 'alpha')) + if (!GETPOST('proplabel', 'alpha')) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors'); } - if (! GETPOST('proptype', 'alpha')) + if (!GETPOST('proptype', 'alpha')) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Type")), null, 'errors'); } - if (! $error) + if (!$error) { $addfieldentry = array( - 'name'=>GETPOST('propname', 'aZ09'),'label'=>GETPOST('proplabel', 'alpha'),'type'=>GETPOST('proptype', 'alpha'), - 'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'none'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}' - 'visible'=>GETPOST('propvisible', 'int'),'enabled'=>GETPOST('propenabled', 'int'), - 'position'=>GETPOST('propposition', 'int'),'notnull'=>GETPOST('propnotnull', 'int'),'index'=>GETPOST('propindex', 'int'),'searchall'=>GETPOST('propsearchall', 'int'), - 'isameasure'=>GETPOST('propisameasure', 'int'), 'comment'=>GETPOST('propcomment', 'alpha'),'help'=>GETPOST('prophelp', 'alpha') + 'name'=>GETPOST('propname', 'aZ09'), 'label'=>GETPOST('proplabel', 'alpha'), 'type'=>GETPOST('proptype', 'alpha'), + 'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'none'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}' + 'visible'=>GETPOST('propvisible', 'int'), 'enabled'=>GETPOST('propenabled', 'int'), + 'position'=>GETPOST('propposition', 'int'), 'notnull'=>GETPOST('propnotnull', 'int'), 'index'=>GETPOST('propindex', 'int'), 'searchall'=>GETPOST('propsearchall', 'int'), + 'isameasure'=>GETPOST('propisameasure', 'int'), 'comment'=>GETPOST('propcomment', 'alpha'), 'help'=>GETPOST('prophelp', 'alpha') ); - if (! empty($addfieldentry['arrayofkeyval']) && ! is_array($addfieldentry['arrayofkeyval'])) + if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) { $addfieldentry['arrayofkeyval'] = dol_json_decode($addfieldentry['arrayofkeyval'], true); } @@ -1112,9 +1112,9 @@ if ($dirins && $action == 'addproperty' && !empty($module) && !empty($tabobj)) }*/ // Edit the class file to write properties - if (! $error) + if (!$error) { - $object=rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, $addfieldentry); + $object = rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, $addfieldentry); if (is_numeric($object) && $object <= 0) { $error++; @@ -1122,23 +1122,23 @@ if ($dirins && $action == 'addproperty' && !empty($module) && !empty($tabobj)) } // Edit sql with new properties - if (! $error) + if (!$error) { - $result=rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object); + $result = rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object); if ($result <= 0) { $error++; } } - if (! $error) + if (!$error) { setEventMessages($langs->trans('FilesForObjectUpdated', $objectname), null); clearstatcache(true); // Make a redirect to reload all data - header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj='.$objectname.'&nocache='.time()); + header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : '').'&tabobj='.$objectname.'&nocache='.time()); exit; } @@ -1173,7 +1173,7 @@ if ($dirins && $action == 'confirm_deleteproperty' && $propertykey) clearstatcache(true); // Make a redirect to reload all data - header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj='.$objectname); + header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : '').'&tabobj='.$objectname); exit; } @@ -1250,10 +1250,10 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname) ); $resultko = 0; - foreach($filetodelete as $filetodelete) + foreach ($filetodelete as $filetodelete) { $resulttmp = dol_delete_file($dir.'/'.$filetodelete, 0, 0, 1); - if (! $resulttmp) $resultko++; + if (!$resulttmp) $resultko++; } if ($resultko == 0) @@ -1407,24 +1407,24 @@ if ($action == 'savefile' && empty($cancel)) // Enable module if ($action == 'set' && $user->admin) { - $param=''; - if ($module) $param.='&module='.urlencode($module); - if ($tab) $param.='&tab='.urlencode($tab); - if ($tabobj) $param.='&tabobj='.urlencode($tabobj); + $param = ''; + if ($module) $param .= '&module='.urlencode($module); + if ($tab) $param .= '&tab='.urlencode($tab); + if ($tabobj) $param .= '&tabobj='.urlencode($tabobj); $value = GETPOST('value', 'alpha'); $resarray = activateModule($value); - if (! empty($resarray['errors'])) setEventMessages('', $resarray['errors'], 'errors'); + if (!empty($resarray['errors'])) setEventMessages('', $resarray['errors'], 'errors'); else { //var_dump($resarray);exit; if ($resarray['nbperms'] > 0) { - $tmpsql="SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."user WHERE admin <> 1"; - $resqltmp=$db->query($tmpsql); + $tmpsql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."user WHERE admin <> 1"; + $resqltmp = $db->query($tmpsql); if ($resqltmp) { - $obj=$db->fetch_object($resqltmp); + $obj = $db->fetch_object($resqltmp); //var_dump($obj->nb);exit; if ($obj && $obj->nb > 1) { @@ -1442,13 +1442,13 @@ if ($action == 'set' && $user->admin) // Disable module if ($action == 'reset' && $user->admin) { - $param=''; - if ($module) $param.='&module='.urlencode($module); - if ($tab) $param.='&tab='.urlencode($tab); - if ($tabobj) $param.='&tabobj='.urlencode($tabobj); + $param = ''; + if ($module) $param .= '&module='.urlencode($module); + if ($tab) $param .= '&tab='.urlencode($tab); + if ($tabobj) $param .= '&tabobj='.urlencode($tabobj); $value = GETPOST('value', 'alpha'); - $result=unActivateModule($value); + $result = unActivateModule($value); if ($result) setEventMessages($result, null, 'errors'); header("Location: ".$_SERVER["PHP_SELF"]."?".$param); exit; @@ -1479,27 +1479,27 @@ llxHeader('', $langs->trans("ModuleBuilder"), '', '', 0, 0, ), array()); -$text=$langs->trans("ModuleBuilder"); +$text = $langs->trans("ModuleBuilder"); print load_fiche_titre($text, '', 'title_setup'); print ''.$langs->trans("ModuleBuilderDesc", 'https://wiki.dolibarr.org/index.php/Module_development#Create_your_module').'
'; -$dirsrootforscan=array($dirread); +$dirsrootforscan = array($dirread); // Add also the core modules into the list of modules to show/edit -if ($dirread != DOL_DOCUMENT_ROOT && ($conf->global->MAIN_FEATURES_LEVEL >=2 || ! empty($conf->global->MODULEBUILDER_ADD_DOCUMENT_ROOT))) { $dirsrootforscan[]=DOL_DOCUMENT_ROOT; } +if ($dirread != DOL_DOCUMENT_ROOT && ($conf->global->MAIN_FEATURES_LEVEL >= 2 || !empty($conf->global->MODULEBUILDER_ADD_DOCUMENT_ROOT))) { $dirsrootforscan[] = DOL_DOCUMENT_ROOT; } // Search modules to edit print ''."\n"; -$listofmodules=array(); -$i=0; -foreach($dirsrootforscan as $dirread) +$listofmodules = array(); +$i = 0; +foreach ($dirsrootforscan as $dirread) { - $dirsincustom=dol_dir_list($dirread, 'directories'); + $dirsincustom = dol_dir_list($dirread, 'directories'); if (is_array($dirsincustom) && count($dirsincustom) > 0) { foreach ($dirsincustom as $dircustomcursor) { $fullname = $dircustomcursor['fullname']; - if (dol_is_file($fullname . '/' . $FILEFLAG)) + if (dol_is_file($fullname.'/'.$FILEFLAG)) { // Get real name of module (MyModule instead of mymodule) $dirtoscanrel = basename($fullname).'/core/modules/'; @@ -1546,8 +1546,8 @@ foreach($dirsrootforscan as $dirread) } // Show description of content - $newdircustom=$dirins; - if (empty($newdircustom)) $newdircustom=img_warning(); + $newdircustom = $dirins; + if (empty($newdircustom)) $newdircustom = img_warning(); // If dirread was forced to somewhere else, by using URL // htdocs/modulebuilder/index.php?module=Inventory@/home/ldestailleur/git/dolibarr/htdocs/product if (empty($i)) print $langs->trans("DirScanned").' : '; @@ -1558,27 +1558,27 @@ foreach($dirsrootforscan as $dirread) print '
'; //var_dump($listofmodules); -$message=''; -if (! $dirins) +$message = ''; +if (!$dirins) { - $message=info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT)); - $allowfromweb=-1; + $message = info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT)); + $allowfromweb = -1; } else { if ($dirins_ok) { - if (! is_writable(dol_osencode($dirins))) + if (!is_writable(dol_osencode($dirins))) { $langs->load("errors"); - $message=info_admin($langs->trans("ErrorFailedToWriteInDir", $dirins)); - $allowfromweb=0; + $message = info_admin($langs->trans("ErrorFailedToWriteInDir", $dirins)); + $allowfromweb = 0; } } else { - $message=info_admin($langs->trans("NotExistsDirect", $dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample")); - $allowfromweb=0; + $message = info_admin($langs->trans("NotExistsDirect", $dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample")); + $allowfromweb = 0; } } if ($message) @@ -1664,7 +1664,7 @@ if ($module == 'initmodule') print '
'; - print '
'; + print '
'; print ''; } elseif ($module == 'deletemodule') @@ -1678,121 +1678,121 @@ elseif ($module == 'deletemodule') print $langs->trans("EnterNameOfModuleToDeleteDesc").'

'; print ''; - print ''; + print ''; print ''; } -elseif (! empty($module)) +elseif (!empty($module)) { // Tabs for module - if (! $error) + if (!$error) { $dirread = $listofmodules[strtolower($module)]['moduledescriptorrootpath']; $head2 = array(); - $h=0; + $h = 0; - $modulelowercase=strtolower($module); + $modulelowercase = strtolower($module); $const_name = 'MAIN_MODULE_'.strtoupper($module); - $param=''; - if ($tab) $param.='&tab='.urlencode($tab); - if ($module) $param.='&module='.urlencode($module); - if ($tabobj) $param.='&tabobj='.urlencode($tabobj); + $param = ''; + if ($tab) $param .= '&tab='.urlencode($tab); + if ($module) $param .= '&module='.urlencode($module); + if ($tabobj) $param .= '&tabobj='.urlencode($tabobj); - $urltomodulesetup=''.$langs->trans('Home').'-'.$langs->trans("Setup").'-'.$langs->trans("Modules").''; - $linktoenabledisable=''; - if (! empty($conf->global->$const_name)) // If module is already activated + $urltomodulesetup = ''.$langs->trans('Home').'-'.$langs->trans("Setup").'-'.$langs->trans("Modules").''; + $linktoenabledisable = ''; + if (!empty($conf->global->$const_name)) // If module is already activated { - $linktoenabledisable.=''; - $linktoenabledisable.=img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', '', 1); - $linktoenabledisable.=''; + $linktoenabledisable .= ''; + $linktoenabledisable .= img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', '', 1); + $linktoenabledisable .= ''; } else { - $linktoenabledisable.=''; - $linktoenabledisable.=img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', 1); - $linktoenabledisable.="\n"; + $linktoenabledisable .= ''; + $linktoenabledisable .= img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', 1); + $linktoenabledisable .= "\n"; } if (empty($conf->$modulelowercase->enabled)) { - $modulestatusinfo=$form->textwithpicto($langs->trans("ModuleIsNotActive", $urltomodulesetup), '', -1, 'help'); + $modulestatusinfo = $form->textwithpicto($langs->trans("ModuleIsNotActive", $urltomodulesetup), '', -1, 'help'); } else { - $modulestatusinfo=$form->textwithpicto($langs->trans("ModuleIsLive"), $langs->trans("Warning"), -1, 'warning'); + $modulestatusinfo = $form->textwithpicto($langs->trans("ModuleIsLive"), $langs->trans("Warning"), -1, 'warning'); } - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=description&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=description&module='.$module.($forceddirread ? '@'.$dirread : ''); $head2[$h][1] = $langs->trans("Description"); $head2[$h][2] = 'description'; $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=languages&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=languages&module='.$module.($forceddirread ? '@'.$dirread : ''); $head2[$h][1] = $langs->trans("Languages"); $head2[$h][2] = 'languages'; $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=dictionaries&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=dictionaries&module='.$module.($forceddirread ? '@'.$dirread : ''); $head2[$h][1] = $langs->trans("Dictionaries"); $head2[$h][2] = 'dictionaries'; $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : ''); $head2[$h][1] = $langs->trans("Objects"); $head2[$h][2] = 'objects'; $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=menus&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=menus&module='.$module.($forceddirread ? '@'.$dirread : ''); $head2[$h][1] = $langs->trans("Menus"); $head2[$h][2] = 'menus'; $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=permissions&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=permissions&module='.$module.($forceddirread ? '@'.$dirread : ''); $head2[$h][1] = $langs->trans("Permissions"); $head2[$h][2] = 'permissions'; $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=hooks&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=hooks&module='.$module.($forceddirread ? '@'.$dirread : ''); $head2[$h][1] = $langs->trans("Hooks"); $head2[$h][2] = 'hooks'; $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=triggers&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=triggers&module='.$module.($forceddirread ? '@'.$dirread : ''); $head2[$h][1] = $langs->trans("Triggers"); $head2[$h][2] = 'triggers'; $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=widgets&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=widgets&module='.$module.($forceddirread ? '@'.$dirread : ''); $head2[$h][1] = $langs->trans("Widgets"); $head2[$h][2] = 'widgets'; $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=css&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=css&module='.$module.($forceddirread ? '@'.$dirread : ''); $head2[$h][1] = $langs->trans("CSS"); $head2[$h][2] = 'css'; $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=js&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=js&module='.$module.($forceddirread ? '@'.$dirread : ''); $head2[$h][1] = $langs->trans("JS"); $head2[$h][2] = 'js'; $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=cli&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=cli&module='.$module.($forceddirread ? '@'.$dirread : ''); $head2[$h][1] = $langs->trans("CLI"); $head2[$h][2] = 'cli'; $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=cron&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=cron&module='.$module.($forceddirread ? '@'.$dirread : ''); $head2[$h][1] = $langs->trans("CronList"); $head2[$h][2] = 'cron'; $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=specifications&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=specifications&module='.$module.($forceddirread ? '@'.$dirread : ''); $head2[$h][1] = $langs->trans("Documentation"); $head2[$h][2] = 'specifications'; $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=buildpackage&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=buildpackage&module='.$module.($forceddirread ? '@'.$dirread : ''); $head2[$h][1] = $langs->trans("BuildPackage"); $head2[$h][2] = 'buildpackage'; $h++; @@ -1826,15 +1826,15 @@ elseif (! empty($module)) print ''; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; print ''; print ' '.$langs->trans("ReadmeFile").' : '.$pathtofilereadme.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; print ''; print ' '.$langs->trans("ChangeLog").' : '.$pathtochangelog.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; print ''; print ''; @@ -1906,7 +1906,7 @@ elseif (! empty($module)) print $langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module).'
'; } - if (! empty($moduleobj)) + if (!empty($moduleobj)) { print '

'; @@ -1995,8 +1995,8 @@ elseif (! empty($module)) { $pathtofile = $modulelowercase.'/langs/'.$langfile['relativename']; print ' '.$langs->trans("LanguageFile").' '.basename(dirname($pathtofile)).' : '.$pathtofile.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; print ''; } print ''; @@ -2041,16 +2041,16 @@ elseif (! empty($module)) if ($action != 'editfile' || empty($file)) { print ''; - $htmlhelp=$langs->trans("DictionariesDefDescTooltip", ''.$langs->trans('Setup').' - '.$langs->trans('Dictionaries').''); + $htmlhelp = $langs->trans("DictionariesDefDescTooltip", ''.$langs->trans('Setup').' - '.$langs->trans('Dictionaries').''); print $form->textwithpicto($langs->trans("DictionariesDefDesc"), $htmlhelp, 1, 'help', '', 0, 2, 'helpondesc').'
'; print '
'; print '
'; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; print ' '.$langs->trans("LanguageFile").' : '; - if (! is_array($dicts) || empty($dicts)) print ''.$langs->trans("NoDictionaries").''; + if (!is_array($dicts) || empty($dicts)) print ''.$langs->trans("NoDictionaries").''; else print ''.$dicts['langs'].''; print '
'; @@ -2143,7 +2143,7 @@ elseif (! empty($module)) } else { - $fullpathoffile=dol_buildpath($file, 0); + $fullpathoffile = dol_buildpath($file, 0); $content = file_get_contents($fullpathoffile); @@ -2155,8 +2155,8 @@ elseif (! empty($module)) print ''; print ''; - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09')?GETPOST('format', 'aZ09'):'html')); + $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html')); print '
'; print '
'; print ''; @@ -2171,12 +2171,12 @@ elseif (! empty($module)) if ($tab == 'objects') { $head3 = array(); - $h=0; + $h = 0; // Dir for module $dir = $dirread.'/'.$modulelowercase.'/class'; - $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj=newobject'; + $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : '').'&tabobj=newobject'; $head3[$h][1] = ''.$langs->trans("NewObjectInModulebuilder").''; $head3[$h][2] = 'newobject'; $h++; @@ -2229,10 +2229,10 @@ elseif (! empty($module)) print ''.$langs->trans("EnterNameOfObjectDesc").'

'; - print '
'; + print '
'; print ' '.$form->textwithpicto($langs->trans("IncludeRefGeneration"), $langs->trans("IncludeRefGenerationHelp")).'
'; print ' '.$form->textwithpicto($langs->trans("IncludeDocGeneration"), $langs->trans("IncludeDocGenerationHelp")).'
'; - print ''; + print ''; print '
'; print '
'; print '
'; @@ -2322,15 +2322,15 @@ elseif (! empty($module)) } print '
'; - print ' '.$langs->trans("ClassFile").' : '.($realpathtoclass?'':'').$pathtoclass.($realpathtoclass?'':'').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.$langs->trans("ClassFile").' : '.($realpathtoclass ? '' : '').$pathtoclass.($realpathtoclass ? '' : '').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; - print ' '.$langs->trans("ApiClassFile").' : '.($realpathtoapi?'':'').$pathtoapi.($realpathtoapi?'':'').''; + print ' '.$langs->trans("ApiClassFile").' : '.($realpathtoapi ? '' : '').$pathtoapi.($realpathtoapi ? '' : '').''; if ($realpathtoapi) { - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print ' '; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; print '   '; if (empty($conf->global->$const_name)) // If module is not activated { @@ -2344,67 +2344,67 @@ elseif (! empty($module)) else { //print ''.$langs->trans("FileNotYetGenerated").' '; - print ''; + print ''; } // PHPUnit print '
'; - print ' '.$langs->trans("TestClassFile").' : '.($realpathtophpunit?'':'').$pathtophpunit.($realpathtophpunit?'':'').''; + print ' '.$langs->trans("TestClassFile").' : '.($realpathtophpunit ? '' : '').$pathtophpunit.($realpathtophpunit ? '' : '').''; if ($realpathtophpunit) { - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print ' '; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; } else { //print ''.$langs->trans("FileNotYetGenerated").' '; - print ''; + print ''; } print '
'; print '
'; - print ' '.$langs->trans("PageForLib").' : '.($realpathtolib?'':'').$pathtolib.($realpathtolib?'':'').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.$langs->trans("PageForLib").' : '.($realpathtolib ? '' : '').$pathtolib.($realpathtolib ? '' : '').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; - print ' '.$langs->trans("PageForObjLib").' : '.($realpathtoobjlib?'':'').$pathtoobjlib.($realpathtoobjlib?'':'').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.$langs->trans("PageForObjLib").' : '.($realpathtoobjlib ? '' : '').$pathtoobjlib.($realpathtoobjlib ? '' : '').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; - print ' '.$langs->trans("Image").' : '.($realpathtopicto?'':'').$pathtopicto.($realpathtopicto?'':'').''; + print ' '.$langs->trans("Image").' : '.($realpathtopicto ? '' : '').$pathtopicto.($realpathtopicto ? '' : '').''; //print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; print '
'; - print ' '.$langs->trans("SqlFile").' : '.($realpathtosql?'':'').$pathtosql.($realpathtosql?'':'').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '   '.$langs->trans("DropTableIfEmpty").''; + print ' '.$langs->trans("SqlFile").' : '.($realpathtosql ? '' : '').$pathtosql.($realpathtosql ? '' : '').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '   '.$langs->trans("DropTableIfEmpty").''; //print '   '.$langs->trans("RunSql").''; print '
'; - print ' '.$langs->trans("SqlFileKey").' : '.($realpathtosqlkey?'':'').$pathtosqlkey.($realpathtosqlkey?'':'').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.$langs->trans("SqlFileKey").' : '.($realpathtosqlkey ? '' : '').$pathtosqlkey.($realpathtosqlkey ? '' : '').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; //print '   '.$langs->trans("RunSql").''; print '
'; - print ' '.$langs->trans("SqlFileExtraFields").' : '.($realpathtosqlextra?'':'').$pathtosqlextra.($realpathtosqlextra?'':'').''; + print ' '.$langs->trans("SqlFileExtraFields").' : '.($realpathtosqlextra ? '' : '').$pathtosqlextra.($realpathtosqlextra ? '' : '').''; if ($realpathtosqlextra) { - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print ' '; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; print '   '; - print ''.$langs->trans("DropTableIfEmpty").''; + print ''.$langs->trans("DropTableIfEmpty").''; } else { - print ''; + print ''; } //print '   '.$langs->trans("RunSql").''; print '
'; - print ' '.$langs->trans("SqlFileKeyExtraFields").' : '.($realpathtosqlextrakey?'':'').$pathtosqlextrakey.($realpathtosqlextrakey?'':'').''; + print ' '.$langs->trans("SqlFileKeyExtraFields").' : '.($realpathtosqlextrakey ? '' : '').$pathtosqlextrakey.($realpathtosqlextrakey ? '' : '').''; if ($realpathtosqlextrakey) { - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print ' '; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; } //print '   '.$langs->trans("RunSql").''; print '
'; @@ -2416,34 +2416,34 @@ elseif (! empty($module)) $urlofcard = dol_buildpath($pathtocard, 1); print '
'; - print ' '.$langs->trans("PageForList").' : '.($realpathtolist?'':'').$pathtolist.($realpathtolist?'':'').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.$langs->trans("PageForList").' : '.($realpathtolist ? '' : '').$pathtolist.($realpathtolist ? '' : '').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; - print ' '.$langs->trans("PageForCreateEditView").' : '.($realpathtocard?'':'').$pathtocard.($realpathtocard?'':'').'?action=create'; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.$langs->trans("PageForCreateEditView").' : '.($realpathtocard ? '' : '').$pathtocard.($realpathtocard ? '' : '').'?action=create'; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; - print ' '.$langs->trans("PageForAgendaTab").' : '.($realpathtoagenda?'':'').$pathtoagenda.($realpathtoagenda?'':'').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.$langs->trans("PageForAgendaTab").' : '.($realpathtoagenda ? '' : '').$pathtoagenda.($realpathtoagenda ? '' : '').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; if ($realpathtoagenda) { print ' '; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; } print '
'; - print ' '.$langs->trans("PageForDocumentTab").' : '.($realpathtodocument?'':'').$pathtodocument.($realpathtodocument?'':'').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.$langs->trans("PageForDocumentTab").' : '.($realpathtodocument ? '' : '').$pathtodocument.($realpathtodocument ? '' : '').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; if ($realpathtodocument) { print ' '; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; } print '
'; - print ' '.$langs->trans("PageForNoteTab").' : '.($realpathtonote?'':'').$pathtonote.($realpathtonote?'':'').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.$langs->trans("PageForNoteTab").' : '.($realpathtonote ? '' : '').$pathtonote.($realpathtonote ? '' : '').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; if ($realpathtonote) { print ' '; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; } print '
'; @@ -2579,25 +2579,25 @@ elseif (! empty($module)) if (in_array($propname, array('fk_element', 'lines'))) continue; }*/ - $propname=$propkey; - $proplabel=$propval['label']; - $proptype=$propval['type']; - $proparrayofkeyval=$propval['arrayofkeyval']; - $propnotnull=$propval['notnull']; - $propdefault=$propval['default']; - $propindex=$propval['index']; - $propforeignkey=$propval['foreignkey']; - $propposition=$propval['position']; - $propenabled=$propval['enabled']; - $propvisible=$propval['visible']; - $propnoteditable=$propval['noteditable']; - $propsearchall=$propval['searchall']; - $propisameasure=$propval['isameasure']; - $propcss=$propval['css']; - $prophelp=$propval['help']; - $propshowoncombobox=$propval['showoncombobox']; + $propname = $propkey; + $proplabel = $propval['label']; + $proptype = $propval['type']; + $proparrayofkeyval = $propval['arrayofkeyval']; + $propnotnull = $propval['notnull']; + $propdefault = $propval['default']; + $propindex = $propval['index']; + $propforeignkey = $propval['foreignkey']; + $propposition = $propval['position']; + $propenabled = $propval['enabled']; + $propvisible = $propval['visible']; + $propnoteditable = $propval['noteditable']; + $propsearchall = $propval['searchall']; + $propisameasure = $propval['isameasure']; + $propcss = $propval['css']; + $prophelp = $propval['help']; + $propshowoncombobox = $propval['showoncombobox']; //$propdisabled=$propval['disabled']; - $propcomment=$propval['comment']; + $propcomment = $propval['comment']; print ''; @@ -2622,37 +2622,37 @@ elseif (! empty($module)) print $propdefault; print ''; print ''; - print $propindex?'1':''; + print $propindex ? '1' : ''; print ''; print ''; - print $propforeignkey?$propforeignkey:''; + print $propforeignkey ? $propforeignkey : ''; print ''; print ''; print $propposition; print ''; print ''; - print $propenabled?$propenabled:''; + print $propenabled ? $propenabled : ''; print ''; print ''; - print $propvisible?$propvisible:''; + print $propvisible ? $propvisible : ''; print ''; print ''; - print $propnoteditable?$propnoteditable:''; + print $propnoteditable ? $propnoteditable : ''; print ''; print ''; - print $propsearchall?'1':''; + print $propsearchall ? '1' : ''; print ''; print ''; - print $propisameasure?$propisameasure:''; + print $propisameasure ? $propisameasure : ''; print ''; print ''; - print $propcss?$propcss:''; + print $propcss ? $propcss : ''; print ''; print ''; - print $prophelp?$prophelp:''; + print $prophelp ? $prophelp : ''; print ''; print ''; - print $propshowoncombobox?$propshowoncombobox:''; + print $propshowoncombobox ? $propshowoncombobox : ''; print ''; /*print ''; print $propdisabled?$propdisabled:''; @@ -2687,7 +2687,7 @@ elseif (! empty($module)) $format = 'asciidoc'; if (preg_match('/\.md$/i', $spec['name'])) $format = 'markdown'; print ' '.$langs->trans("SpecificationFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; } } @@ -2785,13 +2785,13 @@ elseif (! empty($module)) if ($action != 'editfile' || empty($file)) { print ''; - $htmlhelp=$langs->trans("MenusDefDescTooltip", ''.$langs->trans('Setup').' - '.$langs->trans('Menus').''); + $htmlhelp = $langs->trans("MenusDefDescTooltip", ''.$langs->trans('Setup').' - '.$langs->trans('Menus').''); print $form->textwithpicto($langs->trans("MenusDefDesc"), $htmlhelp, 1, 'help', '', 0, 2, 'helpondesc').'
'; print '
'; print '
'; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; print '
'; @@ -2925,13 +2925,13 @@ elseif (! empty($module)) if ($action != 'editfile' || empty($file)) { print ''; - $htmlhelp=$langs->trans("PermissionsDefDescTooltip", ''.$langs->trans('DefaultPermissions').''); + $htmlhelp = $langs->trans("PermissionsDefDescTooltip", ''.$langs->trans('DefaultPermissions').''); print $form->textwithpicto($langs->trans("PermissionsDefDesc"), $htmlhelp, 1, 'help', '', 0, 2, 'helpondesc').'
'; print '
'; print '
'; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; print '
'; @@ -3028,7 +3028,7 @@ elseif (! empty($module)) $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; print ''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; print ''; print ''; @@ -3037,13 +3037,13 @@ elseif (! empty($module)) if (dol_is_file($dirins.'/'.$pathtohook)) { print ''.$pathtohook.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; } else { print ''.$langs->trans("FileNotYetGenerated").''; - print ''; + print ''; } print ''; } @@ -3095,8 +3095,8 @@ elseif (! empty($module)) print ''; print ' '.$langs->trans("TriggersFile").' : '.$pathtofile.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; print ''; } } @@ -3104,7 +3104,7 @@ elseif (! empty($module)) { print ''; print ' '.$langs->trans("NoTrigger"); - print ''; + print ''; print ''; } print ''; @@ -3151,19 +3151,19 @@ elseif (! empty($module)) if (dol_is_file($dirins.'/'.$pathtohook)) { print ''.$pathtohook.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; } else { print ''.$langs->trans("FileNotYetGenerated").''; - print ''; + print ''; } print ''; } else { - $fullpathoffile=dol_buildpath($file, 0); + $fullpathoffile = dol_buildpath($file, 0); $content = file_get_contents($fullpathoffile); @@ -3175,8 +3175,8 @@ elseif (! empty($module)) print ''; print ''; - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09')?GETPOST('format', 'aZ09'):'html')); + $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html')); print '
'; print '
'; print ''; @@ -3203,19 +3203,19 @@ elseif (! empty($module)) if (dol_is_file($dirins.'/'.$pathtohook)) { print ''.$pathtohook.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; } else { print ''.$langs->trans("FileNotYetGenerated").''; - print ''; + print ''; } print ''; } else { - $fullpathoffile=dol_buildpath($file, 0); + $fullpathoffile = dol_buildpath($file, 0); $content = file_get_contents($fullpathoffile); @@ -3227,8 +3227,8 @@ elseif (! empty($module)) print ''; print ''; - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09')?GETPOST('format', 'aZ09'):'html')); + $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html')); print '
'; print '
'; print ''; @@ -3259,15 +3259,15 @@ elseif (! empty($module)) $pathtofile = $widget['relpath']; print ' '.$langs->trans("WidgetFile").' : '.$pathtofile.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; print ''; } } else { print ' '.$langs->trans("NoWidget"); - print ''; + print ''; print ''; } print ''; @@ -3345,15 +3345,15 @@ elseif (! empty($module)) $pathtofile = $clifile['relpath']; print ' '.$langs->trans("CLIFile").' : '.$pathtofile.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; print ''; } } else { print ' '.$langs->trans("NoCLIFile"); - print ''; + print ''; print ''; } print ''; @@ -3397,7 +3397,7 @@ elseif (! empty($module)) print '
'; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; print '
'; @@ -3526,8 +3526,8 @@ elseif (! empty($module)) if (preg_match('/\.md$/i', $spec['name'])) $format = 'markdown'; print ''; print ' '.$langs->trans("SpecificationFile").' : '.$pathtofile.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; print ''; } } @@ -3535,7 +3535,7 @@ elseif (! empty($module)) { print ''; print ' '.$langs->trans("FileNotYetGenerated"); - print ''; + print ''; print ''; } print ''; @@ -3613,7 +3613,7 @@ elseif (! empty($module)) print ''; print ''; print ''; print ''; } @@ -3623,28 +3623,28 @@ elseif (! empty($module)) print ''.$langs->trans("BuildPackageDesc").''; print '
'; - if (! class_exists('ZipArchive') && ! defined('ODTPHP_PATHTOPCLZIP')) + if (!class_exists('ZipArchive') && !defined('ODTPHP_PATHTOPCLZIP')) { print img_warning().' '.$langs->trans("ErrNoZipEngine"); print '
'; } - $modulelowercase=strtolower($module); + $modulelowercase = strtolower($module); // Zip file to build - $FILENAMEZIP=''; + $FILENAMEZIP = ''; // Load module $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; dol_include_once($pathtofile); - $class='mod'.$module; + $class = 'mod'.$module; if (class_exists($class)) { try { $moduleobj = new $class($db); } - catch(Exception $e) + catch (Exception $e) { $error++; dol_print_error($e->getMessage()); diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 596e47e12c0..0845d5ecaf2 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -237,13 +237,13 @@ class MyObject extends CommonObject // Translate some data of arrayofkeyval if (is_object($langs)) { - foreach($this->fields as $key => $val) + foreach ($this->fields as $key => $val) { if (is_array($val['arrayofkeyval'])) { - foreach($val['arrayofkeyval'] as $key2 => $val2) + foreach ($val['arrayofkeyval'] as $key2 => $val2) { - $this->fields[$key]['arrayofkeyval'][$key2]=$langs->trans($val2); + $this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2); } } } @@ -733,7 +733,7 @@ class MyObject extends CommonObject $label .= '
'; $label .= ''.$langs->trans('Ref').': '.$this->ref; if (isset($this->status)) { - $label.= '
' . $langs->trans("Status").": ".$this->getLibStatut(5); + $label .= '
'.$langs->trans("Status").": ".$this->getLibStatut(5); } $url = dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.$this->id; diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 46f347618f4..f7f2252ba3c 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -142,14 +142,14 @@ foreach($object->fields as $key => $val) // Extra fields if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) { - foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val) + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) { $arrayfields["ef.".$key] = array( 'label'=>$extrafields->attributes[$object->table_element]['label'][$key], - 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), + 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], - 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]) + 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]) ); } } @@ -429,7 +429,7 @@ foreach ($object->fields as $key => $val) elseif (strpos($val['type'], 'integer:') === 0) { print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1); } - elseif (! preg_match('/^(date|timestamp)/', $val['type'])) print ''; + elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print ''; print ''; } } diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index d3845ed412b..01f23cb1cf3 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -965,7 +965,7 @@ class Mo extends CommonObject $label .= '
'; $label .= ''.$langs->trans('Ref').': '.$this->ref; if (isset($this->status)) { - $label.= '
' . $langs->trans("Status").": ".$this->getLibStatut(5); + $label .= '
'.$langs->trans("Status").": ".$this->getLibStatut(5); } $url = dol_buildpath('/mrp/mo_card.php', 1).'?id='.$this->id; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 5eb8ab904cc..17a1e4952ce 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -844,10 +844,10 @@ class Product extends CommonObject $this->height_units = trim($this->height_units); // set unit not defined if (is_numeric($this->length_units)) { - $this->width_units = $this->length_units; // Not used yet + $this->width_units = $this->length_units; // Not used yet } if (is_numeric($this->length_units)) { - $this->height_units = $this->length_units; // Not used yet + $this->height_units = $this->length_units; // Not used yet } // Automated compute surface and volume if not filled if (empty($this->surface) && !empty($this->length) && !empty($this->width) && $this->length_units == $this->width_units) { @@ -1882,7 +1882,7 @@ class Product extends CommonObject $newminprice = 0; } if (empty($newminprice)) { - $newminprice=0; + $newminprice = 0; } // Check parameters @@ -4348,8 +4348,8 @@ class Product extends CommonObject $label .= '
'.$langs->trans('ProductAccountancyBuyCode').': '.length_accountg($this->accountancy_code_buy); } if (isset($this->status) && isset($this->status_buy)) { - $label.= '
' . $langs->trans("Status").": ".$this->getLibStatut(5, 0); - $label.= ' '.$this->getLibStatut(5, 1); + $label .= '
'.$langs->trans("Status").": ".$this->getLibStatut(5, 0); + $label .= ' '.$this->getLibStatut(5, 1); } if (!empty($this->entity)) { @@ -4801,7 +4801,7 @@ class Product extends CommonObject } if (!empty($conf->fournisseur->enabled) && !empty($conf->reception->enabled)) { - $result = $this->load_stats_reception(0, '4', 1); // Use same tables than when module reception is not used. + $result = $this->load_stats_reception(0, '4', 1); // Use same tables than when module reception is not used. if ($result < 0) dol_print_error($this->db, $this->error); $stock_reception_fournisseur = $this->stats_reception['qty']; } diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 836861f6131..df65a79f14b 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -191,7 +191,7 @@ $arrayfields = array( 'p.tva_tx'=>array('label'=>$langs->trans("VATRate"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>43), 'p.pmp'=>array('label'=>$langs->trans("PMPValueShort"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>44), 'p.seuil_stock_alerte'=>array('label'=>$langs->trans("StockLimit"), 'checked'=>0, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service'), 'position'=>50), - 'p.desiredstock'=>array('label'=>$langs->trans("DesiredStock"), 'checked'=>1, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service'),'position'=>51), + 'p.desiredstock'=>array('label'=>$langs->trans("DesiredStock"), 'checked'=>1, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service'), 'position'=>51), 'p.stock'=>array('label'=>$langs->trans("PhysicalStock"), 'checked'=>1, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service'), 'position'=>52), 'stock_virtual'=>array('label'=>$langs->trans("VirtualStock"), 'checked'=>1, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service' && $virtualdiffersfromphysical), 'position'=>53), 'p.tobatch'=>array('label'=>$langs->trans("ManageLotSerial"), 'checked'=>0, 'enabled'=>(!empty($conf->productbatch->enabled)), 'position'=>60), @@ -321,7 +321,7 @@ if (!empty($conf->global->MAIN_MULTILANGS)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination pac ON pac.fk_product_child = p.rowid"; } -if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_units cu ON cu.rowid = p.fk_unit"; +if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_units cu ON cu.rowid = p.fk_unit"; $sql .= ' WHERE p.entity IN ('.getEntity('product').')'; @@ -488,11 +488,11 @@ if ($resql) //'builddoc'=>$langs->trans("PDFMerge"), //'presend'=>$langs->trans("SendByMail"), ); - $rightskey='produit'; - if ($type == Product::TYPE_SERVICE) $rightskey='service'; + $rightskey = 'produit'; + if ($type == Product::TYPE_SERVICE) $rightskey = 'service'; if ($user->rights->{$rightskey}->supprimer) $arrayofmassactions['predelete'] = "".$langs->trans("Delete"); - if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions=array(); - $massactionbutton=$form->selectMassAction('', $arrayofmassactions); + if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); + $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $newcardbutton = ''; if ($type === "") $perm = ($user->rights->produit->creer || $user->rights->service->creer); diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index b63a891973c..e07dcf0536d 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -38,20 +38,20 @@ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; $langs->loadLangs(array('products', 'stocks', 'productbatch')); // Security check -if ($user->socid) $socid=$user->socid; -$result=restrictedArea($user, 'produit|service'); +if ($user->socid) $socid = $user->socid; +$result = restrictedArea($user, 'produit|service'); -$action=GETPOST('action', 'alpha'); -$sref=GETPOST("sref", 'alpha'); -$snom=GETPOST("snom", 'alpha'); -$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); -$type=GETPOST("type", "int"); -$search_barcode=GETPOST("search_barcode", 'alpha'); -$search_warehouse=GETPOST('search_warehouse', 'alpha'); -$search_batch=GETPOST('search_batch', 'alpha'); -$catid=GETPOST('catid', 'int'); -$toolowstock=GETPOST('toolowstock'); +$action = GETPOST('action', 'alpha'); +$sref = GETPOST("sref", 'alpha'); +$snom = GETPOST("snom", 'alpha'); +$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); +$type = GETPOST("type", "int"); +$search_barcode = GETPOST("search_barcode", 'alpha'); +$search_warehouse = GETPOST('search_warehouse', 'alpha'); +$search_batch = GETPOST('search_batch', 'alpha'); +$catid = GETPOST('catid', 'int'); +$toolowstock = GETPOST('toolowstock'); $tosell = GETPOST("tosell"); $tobuy = GETPOST("tobuy"); $fourn_id = GETPOST("fourn_id", 'int'); @@ -60,20 +60,20 @@ $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); $page = GETPOST("page", 'int'); if (empty($page) || $page < 0) $page = 0; -if (! $sortfield) $sortfield="p.ref"; -if (! $sortorder) $sortorder="ASC"; -$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; +if (!$sortfield) $sortfield = "p.ref"; +if (!$sortorder) $sortorder = "ASC"; +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 -$offset = $limit * $page ; +$offset = $limit * $page; // Load sale and categ filters $search_sale = GETPOST("search_sale"); $search_categ = GETPOST("search_categ"); // Get object canvas (By default, this is not defined, so standard usage of dolibarr) -$canvas=GETPOST("canvas"); -$objcanvas=null; -if (! empty($canvas)) +$canvas = GETPOST("canvas"); +$objcanvas = null; +if (!empty($canvas)) { require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; $objcanvas = new Canvas($db, $action); @@ -88,20 +88,20 @@ if (! empty($canvas)) 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 { - $sref=""; - $snom=""; - $sall=""; - $tosell=""; - $tobuy=""; - $search_sale=""; - $search_categ=""; - $type=""; - $catid=''; - $toolowstock=''; - $search_batch=''; - $search_warehouse=''; - $fourn_id=''; - $sbarcode=''; + $sref = ""; + $snom = ""; + $sall = ""; + $tosell = ""; + $tobuy = ""; + $search_sale = ""; + $search_categ = ""; + $type = ""; + $catid = ''; + $toolowstock = ''; + $search_batch = ''; + $search_warehouse = ''; + $fourn_id = ''; + $sbarcode = ''; } @@ -109,64 +109,64 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' * View */ -$helpurl='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; +$helpurl = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; -$form=new Form($db); -$htmlother=new FormOther($db); +$form = new Form($db); +$htmlother = new FormOther($db); -$title=$langs->trans("ProductsAndServices"); +$title = $langs->trans("ProductsAndServices"); $sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,'; -$sql.= ' p.fk_product_type, p.tms as datem,'; -$sql.= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.stock, p.tosell, p.tobuy, p.tobatch,'; -$sql.= ' ps.fk_entrepot,'; -$sql.= ' e.ref as warehouse_ref, e.lieu as warehouse_lieu, e.fk_parent as warehouse_parent,'; -$sql.= ' pb.batch, pb.eatby as oldeatby, pb.sellby as oldsellby,'; -$sql.= ' pl.rowid as lotid, pl.eatby, pl.sellby,'; -$sql.= ' SUM(pb.qty) as stock_physique, COUNT(pb.rowid) as nbinbatchtable'; -$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; -$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as ps on p.rowid = ps.fk_product'; // Detail for each warehouse -$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot as e on ps.fk_entrepot = e.rowid'; // Link on unique key -$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_batch as pb on pb.fk_product_stock = ps.rowid'; // Detail for each lot on each warehouse -$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot as pl on pl.fk_product = p.rowid AND pl.batch = pb.batch'; // Link on unique key +$sql .= ' p.fk_product_type, p.tms as datem,'; +$sql .= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.stock, p.tosell, p.tobuy, p.tobatch,'; +$sql .= ' ps.fk_entrepot,'; +$sql .= ' e.ref as warehouse_ref, e.lieu as warehouse_lieu, e.fk_parent as warehouse_parent,'; +$sql .= ' pb.batch, pb.eatby as oldeatby, pb.sellby as oldsellby,'; +$sql .= ' pl.rowid as lotid, pl.eatby, pl.sellby,'; +$sql .= ' SUM(pb.qty) as stock_physique, COUNT(pb.rowid) as nbinbatchtable'; +$sql .= ' FROM '.MAIN_DB_PREFIX.'product as p'; +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as ps on p.rowid = ps.fk_product'; // Detail for each warehouse +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot as e on ps.fk_entrepot = e.rowid'; // Link on unique key +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_batch as pb on pb.fk_product_stock = ps.rowid'; // Detail for each lot on each warehouse +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot as pl on pl.fk_product = p.rowid AND pl.batch = pb.batch'; // Link on unique key // We'll need this table joined to the select in order to filter by categ -if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_product as cp"; -$sql.= " WHERE p.entity IN (".getEntity('product').")"; -if ($search_categ) $sql.= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ -if ($sall) $sql.=natural_search(array('p.ref','p.label','p.description','p.note'), $sall); +if ($search_categ) $sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp"; +$sql .= " WHERE p.entity IN (".getEntity('product').")"; +if ($search_categ) $sql .= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ +if ($sall) $sql .= natural_search(array('p.ref', 'p.label', 'p.description', 'p.note'), $sall); // if the type is not 1, we show all products (type = 0,2,3) if (dol_strlen($type)) { - if ($type==1) + if ($type == 1) { - $sql.= " AND p.fk_product_type = '1'"; + $sql .= " AND p.fk_product_type = '1'"; } else { - $sql.= " AND p.fk_product_type <> '1'"; + $sql .= " AND p.fk_product_type <> '1'"; } } -if ($sref) $sql.= natural_search("p.ref", $sref); -if ($search_barcode) $sql.= natural_search("p.barcode", $search_barcode); -if ($snom) $sql.= natural_search("p.label", $snom); -if (! empty($tosell)) $sql.= " AND p.tosell = ".$tosell; -if (! empty($tobuy)) $sql.= " AND p.tobuy = ".$tobuy; -if (! empty($canvas)) $sql.= " AND p.canvas = '".$db->escape($canvas)."'"; -if($catid) $sql.= " AND cp.fk_categorie = ".$catid; -if ($fourn_id > 0) $sql.= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".$fourn_id; +if ($sref) $sql .= natural_search("p.ref", $sref); +if ($search_barcode) $sql .= natural_search("p.barcode", $search_barcode); +if ($snom) $sql .= natural_search("p.label", $snom); +if (!empty($tosell)) $sql .= " AND p.tosell = ".$tosell; +if (!empty($tobuy)) $sql .= " AND p.tobuy = ".$tobuy; +if (!empty($canvas)) $sql .= " AND p.canvas = '".$db->escape($canvas)."'"; +if ($catid) $sql .= " AND cp.fk_categorie = ".$catid; +if ($fourn_id > 0) $sql .= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".$fourn_id; // Insert categ filter if ($search_categ) $sql .= " AND cp.fk_categorie = ".$db->escape($search_categ); if ($search_warehouse) $sql .= natural_search("e.ref", $search_warehouse); if ($search_batch) $sql .= natural_search("pb.batch", $search_batch); -$sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,"; -$sql.= " p.fk_product_type, p.tms,"; -$sql.= " p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.stock, p.tosell, p.tobuy, p.tobatch,"; -$sql.= " ps.fk_entrepot,"; -$sql.= " e.ref, e.lieu, e.fk_parent,"; -$sql.= " pb.batch, pb.eatby, pb.sellby,"; -$sql.= " pl.rowid, pl.eatby, pl.sellby"; -if ($toolowstock) $sql.= " HAVING SUM(".$db->ifsql('ps.reel IS NULL', '0', 'ps.reel').") < p.seuil_stock_alerte"; // Not used yet -$sql.= $db->order($sortfield, $sortorder); +$sql .= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,"; +$sql .= " p.fk_product_type, p.tms,"; +$sql .= " p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.stock, p.tosell, p.tobuy, p.tobatch,"; +$sql .= " ps.fk_entrepot,"; +$sql .= " e.ref, e.lieu, e.fk_parent,"; +$sql .= " pb.batch, pb.eatby, pb.sellby,"; +$sql .= " pl.rowid, pl.eatby, pl.sellby"; +if ($toolowstock) $sql .= " HAVING SUM(".$db->ifsql('ps.reel IS NULL', '0', 'ps.reel').") < p.seuil_stock_alerte"; // Not used yet +$sql .= $db->order($sortfield, $sortorder); $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) @@ -180,7 +180,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) } } -$sql.= $db->plimit($limit + 1, $offset); +$sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); if ($resql) @@ -198,35 +198,35 @@ if ($resql) if (isset($type)) { - if ($type==1) { $texte = $langs->trans("Services"); } + if ($type == 1) { $texte = $langs->trans("Services"); } else { $texte = $langs->trans("Products"); } } else { $texte = $langs->trans("ProductsAndServices"); } - $texte.=' ('.$langs->trans("StocksByLotSerial").')'; + $texte .= ' ('.$langs->trans("StocksByLotSerial").')'; - $param=''; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); - if ($sall) $param.="&sall=".urlencode($sall); - if ($tosell) $param.="&tosell=".urlencode($tosell); - if ($tobuy) $param.="&tobuy=".urlencode($tobuy); - if ($type) $param.="&type=".urlencode($type); - if ($fourn_id) $param.="&fourn_id=".urlencode($fourn_id); - if ($snom) $param.="&snom=".urlencode($snom); - if ($sref) $param.="&sref=".urlencode($sref); - if ($search_batch) $param.="&search_batch=".urlencode($search_batch); - if ($sbarcode) $param.="&sbarcode=".urlencode($sbarcode); - if ($search_warehouse) $param.="&search_warehouse=".urlencode($search_warehouse); - if ($catid) $param.="&catid=".urlencode($catid); - if ($toolowstock) $param.="&toolowstock=".urlencode($toolowstock); - if ($search_sale) $param.="&search_sale=".urlencode($search_sale); - if ($search_categ) $param.="&search_categ=".urlencode($search_categ); + $param = ''; + if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); + if ($sall) $param .= "&sall=".urlencode($sall); + if ($tosell) $param .= "&tosell=".urlencode($tosell); + if ($tobuy) $param .= "&tobuy=".urlencode($tobuy); + if ($type) $param .= "&type=".urlencode($type); + if ($fourn_id) $param .= "&fourn_id=".urlencode($fourn_id); + if ($snom) $param .= "&snom=".urlencode($snom); + if ($sref) $param .= "&sref=".urlencode($sref); + if ($search_batch) $param .= "&search_batch=".urlencode($search_batch); + if ($sbarcode) $param .= "&sbarcode=".urlencode($sbarcode); + if ($search_warehouse) $param .= "&search_warehouse=".urlencode($search_warehouse); + if ($catid) $param .= "&catid=".urlencode($catid); + if ($toolowstock) $param .= "&toolowstock=".urlencode($toolowstock); + if ($search_sale) $param .= "&search_sale=".urlencode($search_sale); + if ($search_categ) $param .= "&search_categ=".urlencode($search_categ); /*if ($eatby) $param.="&eatby=".$eatby; if ($sellby) $param.="&sellby=".$sellby;*/ llxHeader("", $title, $helpurl, $texte); - print '
'; + print ''; print ''; print ''; print ''; @@ -236,7 +236,7 @@ if ($resql) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'products', 0, '', '', $limit); - if (! empty($catid)) + if (!empty($catid)) { print "
"; $c = new Categorie($db); @@ -247,29 +247,29 @@ if ($resql) } // Filter on categories - $moreforfilter=''; - if (! empty($conf->categorie->enabled)) + $moreforfilter = ''; + if (!empty($conf->categorie->enabled)) { - $moreforfilter.='
'; - $moreforfilter.=$langs->trans('Categories'). ': '; - $moreforfilter.=$htmlother->select_categories(Categorie::TYPE_PRODUCT, $search_categ, 'search_categ'); - $moreforfilter.='
'; + $moreforfilter .= '
'; + $moreforfilter .= $langs->trans('Categories').': '; + $moreforfilter .= $htmlother->select_categories(Categorie::TYPE_PRODUCT, $search_categ, 'search_categ'); + $moreforfilter .= '
'; } //$moreforfilter.=$langs->trans("StockTooLow").' '; - if (! empty($moreforfilter)) + if (!empty($moreforfilter)) { print '
'; print $moreforfilter; - $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook + $parameters = array(); + $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print '
'; } print '
'; - print ''; + print '
'; // Fields title search print ''; @@ -279,7 +279,7 @@ if ($resql) print ''; - if (! empty($conf->service->enabled) && $type == 1) + if (!empty($conf->service->enabled) && $type == 1) { print ''; print ''; print ''; print ''; @@ -303,7 +303,7 @@ if ($resql) print ""; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", $param, "", "", $sortfield, $sortorder); - if (! empty($conf->service->enabled) && $type == 1) print_liste_field_titre("Duration", $_SERVER["PHP_SELF"], "p.duration", $param, "", '', $sortfield, $sortorder, 'center '); + if (!empty($conf->service->enabled) && $type == 1) print_liste_field_titre("Duration", $_SERVER["PHP_SELF"], "p.duration", $param, "", '', $sortfield, $sortorder, 'center '); print_liste_field_titre("Warehouse", $_SERVER["PHP_SELF"], "e.ref", $param, "", '', $sortfield, $sortorder); //print_liste_field_titre("DesiredStock", $_SERVER["PHP_SELF"], "p.desiredstock",$param,"",'',$sortfield,$sortorder, 'right ); print_liste_field_titre("Batch", $_SERVER["PHP_SELF"], "pb.batch", $param, "", '', $sortfield, $sortorder, 'center '); @@ -318,52 +318,52 @@ if ($resql) print_liste_field_titre(''); print "\n"; - $product_static=new Product($db); - $product_lot_static=new Productlot($db); - $warehousetmp=new Entrepot($db); + $product_static = new Product($db); + $product_lot_static = new Productlot($db); + $warehousetmp = new Entrepot($db); while ($i < min($num, $limit)) { $objp = $db->fetch_object($resql); // Multilangs - if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active + if (!empty($conf->global->MAIN_MULTILANGS)) // si l'option est active { $sql = "SELECT label"; - $sql.= " FROM ".MAIN_DB_PREFIX."product_lang"; - $sql.= " WHERE fk_product=".$objp->rowid; - $sql.= " AND lang='". $langs->getDefaultLang() ."'"; - $sql.= " LIMIT 1"; + $sql .= " FROM ".MAIN_DB_PREFIX."product_lang"; + $sql .= " WHERE fk_product=".$objp->rowid; + $sql .= " AND lang='".$langs->getDefaultLang()."'"; + $sql .= " LIMIT 1"; $result = $db->query($sql); if ($result) { $objtp = $db->fetch_object($result); - if (! empty($objtp->label)) $objp->label = $objtp->label; + if (!empty($objtp->label)) $objp->label = $objtp->label; } } - $product_static->ref=$objp->ref; - $product_static->id=$objp->rowid; + $product_static->ref = $objp->ref; + $product_static->id = $objp->rowid; $product_static->label = $objp->label; - $product_static->type=$objp->fk_product_type; - $product_static->entity=$objp->entity; - $product_static->status=$objp->tosell; - $product_static->status_buy=$objp->tobuy; - $product_static->status_batch=$objp->tobatch; + $product_static->type = $objp->fk_product_type; + $product_static->entity = $objp->entity; + $product_static->status = $objp->tosell; + $product_static->status_buy = $objp->tobuy; + $product_static->status_batch = $objp->tobatch; - $product_lot_static->batch=$objp->batch; - $product_lot_static->product_id=$objp->rowid; - $product_lot_static->id=$objp->lotid; - $product_lot_static->eatby=$objp->eatby; - $product_lot_static->sellby=$objp->sellby; + $product_lot_static->batch = $objp->batch; + $product_lot_static->product_id = $objp->rowid; + $product_lot_static->id = $objp->lotid; + $product_lot_static->eatby = $objp->eatby; + $product_lot_static->sellby = $objp->sellby; - $warehousetmp->id=$objp->fk_entrepot; - $warehousetmp->ref=$objp->warehouse_ref; - $warehousetmp->label=$objp->warehouse_ref; - $warehousetmp->fk_parent=$objp->warehouse_parent; + $warehousetmp->id = $objp->fk_entrepot; + $warehousetmp->ref = $objp->warehouse_ref; + $warehousetmp->label = $objp->warehouse_ref; + $warehousetmp->fk_parent = $objp->warehouse_parent; print ''; @@ -376,7 +376,7 @@ if ($resql) // Label print ''; - if (! empty($conf->service->enabled) && $type == 1) + if (!empty($conf->service->enabled) && $type == 1) { print ''; @@ -1615,11 +1615,11 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) } else { - $userstatic->id = $task_time->fk_user; + $userstatic->id = $task_time->fk_user; $userstatic->lastname = $task_time->lastname; - $userstatic->firstname = $task_time->firstname; - $userstatic->photo = $task_time->photo; - $userstatic->statut = $task_time->user_status; + $userstatic->firstname = $task_time->firstname; + $userstatic->photo = $task_time->photo; + $userstatic->statut = $task_time->user_status; print $userstatic->getNomUrl(-1); } print ''; @@ -1763,11 +1763,11 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) } else { - $userstatic->id = $task_time->fk_user; + $userstatic->id = $task_time->fk_user; $userstatic->lastname = $task_time->lastname; - $userstatic->firstname = $task_time->firstname; - $userstatic->photo = $task_time->photo; - $userstatic->statut = $task_time->user_status; + $userstatic->firstname = $task_time->firstname; + $userstatic->photo = $task_time->photo; + $userstatic->statut = $task_time->user_status; print $userstatic->getNomUrl(-1); } print ''; diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index 7a962a15b79..c470055dbce 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -24,74 +24,74 @@ * \brief Entry page to access demo */ -define("NOLOGIN", 1); // This means this output page does not require to be logged. -define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. +define("NOLOGIN", 1); // This means this output page does not require to be logged. +define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. require '../../main.inc.php'; require_once '../../core/lib/functions2.lib.php'; $langs->loadLangs(array("main", "install", "other")); -$conf->dol_hide_topmenu=GETPOST('dol_hide_topmenu', 'int'); -$conf->dol_hide_leftmenu=GETPOST('dol_hide_leftmenu', 'int'); -$conf->dol_optimize_smallscreen=GETPOST('dol_optimize_smallscreen', 'int'); -$conf->dol_no_mouse_hover=GETPOST('dol_no_mouse_hover', 'int'); -$conf->dol_use_jmobile=GETPOST('dol_use_jmobile', 'int'); +$conf->dol_hide_topmenu = GETPOST('dol_hide_topmenu', 'int'); +$conf->dol_hide_leftmenu = GETPOST('dol_hide_leftmenu', 'int'); +$conf->dol_optimize_smallscreen = GETPOST('dol_optimize_smallscreen', 'int'); +$conf->dol_no_mouse_hover = GETPOST('dol_no_mouse_hover', 'int'); +$conf->dol_use_jmobile = GETPOST('dol_use_jmobile', 'int'); // Security check global $dolibarr_main_demo; if (empty($dolibarr_main_demo)) accessforbidden('Parameter dolibarr_main_demo must be defined in conf file with value "default login,default pass" to enable the demo entry page', 0, 0, 1); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$res=$hookmanager->initHooks(array('demo')); +$res = $hookmanager->initHooks(array('demo')); -$demoprofiles=array(); -$alwayscheckedmodules=array(); -$alwaysuncheckedmodules=array(); -$alwayshiddencheckedmodules=array(); -$alwayshiddenuncheckedmodules=array(); +$demoprofiles = array(); +$alwayscheckedmodules = array(); +$alwaysuncheckedmodules = array(); +$alwayshiddencheckedmodules = array(); +$alwayshiddenuncheckedmodules = array(); -$url=''; -$url.=($url?'&':'').($conf->dol_hide_topmenu?'dol_hide_topmenu='.$conf->dol_hide_topmenu:''); -$url.=($url?'&':'').($conf->dol_hide_leftmenu?'dol_hide_leftmenu='.$conf->dol_hide_leftmenu:''); -$url.=($url?'&':'').($conf->dol_optimize_smallscreen?'dol_optimize_smallscreen='.$conf->dol_optimize_smallscreen:''); -$url.=($url?'&':'').($conf->dol_no_mouse_hover?'dol_no_mouse_hover='.$conf->dol_no_mouse_hover:''); -$url.=($url?'&':'').($conf->dol_use_jmobile?'dol_use_jmobile='.$conf->dol_use_jmobile:''); -$url=DOL_URL_ROOT.'/index.php'.($url?'?'.$url:''); +$url = ''; +$url .= ($url ? '&' : '').($conf->dol_hide_topmenu ? 'dol_hide_topmenu='.$conf->dol_hide_topmenu : ''); +$url .= ($url ? '&' : '').($conf->dol_hide_leftmenu ? 'dol_hide_leftmenu='.$conf->dol_hide_leftmenu : ''); +$url .= ($url ? '&' : '').($conf->dol_optimize_smallscreen ? 'dol_optimize_smallscreen='.$conf->dol_optimize_smallscreen : ''); +$url .= ($url ? '&' : '').($conf->dol_no_mouse_hover ? 'dol_no_mouse_hover='.$conf->dol_no_mouse_hover : ''); +$url .= ($url ? '&' : '').($conf->dol_use_jmobile ? 'dol_use_jmobile='.$conf->dol_use_jmobile : ''); +$url = DOL_URL_ROOT.'/index.php'.($url ? '?'.$url : ''); $tmpaction = 'view'; -$parameters=array(); -$object=new stdClass(); -$reshook=$hookmanager->executeHooks('addDemoProfile', $parameters, $object, $tmpaction); // Note that $action and $object may have been modified by some hooks -$error=$hookmanager->error; $errors=$hookmanager->errors; +$parameters = array(); +$object = new stdClass(); +$reshook = $hookmanager->executeHooks('addDemoProfile', $parameters, $object, $tmpaction); // Note that $action and $object may have been modified by some hooks +$error = $hookmanager->error; $errors = $hookmanager->errors; if (empty($reshook)) { - $demoprofiles=array( - array('default'=>'1', 'key'=>'profdemoservonly','label'=>'DemoCompanyServiceOnly', + $demoprofiles = array( + array('default'=>'1', 'key'=>'profdemoservonly', 'label'=>'DemoCompanyServiceOnly', 'disablemodules'=>'adherent,barcode,bom,cashdesk,don,expedition,externalsite,ftp,incoterm,mailmanspip,margin,mrp,prelevement,product,productbatch,stock,takepos', //'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot8.png', 'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-service.jpg', 'url'=>$url ), - array('default'=>'0', 'key'=>'profmanufacture','label'=>'DemoCompanyManufacturing', + array('default'=>'0', 'key'=>'profmanufacture', 'label'=>'DemoCompanyManufacturing', 'disablemodules'=>'adherent,contrat,don,externalsite,ficheinter,ftp,mailmanspip,prelevement,service', 'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-manufacturing.jpg', 'url'=>$url ), - array('default'=>'0', 'key'=>'profdemoprodstock','label'=>'DemoCompanyProductAndStocks', + array('default'=>'0', 'key'=>'profdemoprodstock', 'label'=>'DemoCompanyProductAndStocks', 'disablemodules'=>'adherent,bom,contrat,don,externalsite,ficheinter,ftp,mailmanspip,mrp,prelevement,service', //'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot2.png', 'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-product.jpg', 'url'=>$url ), - array('default'=>'0', 'key'=>'profdemofun2','label'=>'DemoFundation2', + array('default'=>'0', 'key'=>'profdemofun2', 'label'=>'DemoFundation2', 'disablemodules'=>'barcode,cashdesk,bom,commande,commercial,compta,comptabilite,contrat,expedition,externalsite,ficheinter,ftp,incoterm,mailmanspip,margin,mrp,prelevement,product,productbatch,projet,propal,propale,service,societe,stock,tax,takepos', //'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot6.png', 'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-foundation.jpg', 'url'=>$url ), // All demo profile - array('default'=>'0', 'key'=>'profdemoall','label'=>'ChooseYourDemoProfilMore', + array('default'=>'0', 'key'=>'profdemoall', 'label'=>'ChooseYourDemoProfilMore', 'disablemodules'=>'adherent,cashdesk,don,externalsite,mailmanspip', //'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot9.png' 'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-all.jpg' @@ -100,21 +100,21 @@ if (empty($reshook)) // Visible - $alwayscheckedmodules=array('barcode','bookmark','categorie','externalrss','fckeditor','geoipmaxmind','gravatar','memcached','syslog','user','webservices'); // Technical module we always want - $alwaysuncheckedmodules=array('dav','dynamicprices','incoterm','loan','multicurrency','paybox','paypal','stripe','google','printing','scanner','skype','website'); // Module we dont want by default + $alwayscheckedmodules = array('barcode', 'bookmark', 'categorie', 'externalrss', 'fckeditor', 'geoipmaxmind', 'gravatar', 'memcached', 'syslog', 'user', 'webservices'); // Technical module we always want + $alwaysuncheckedmodules = array('dav', 'dynamicprices', 'incoterm', 'loan', 'multicurrency', 'paybox', 'paypal', 'stripe', 'google', 'printing', 'scanner', 'skype', 'website'); // Module we dont want by default // Not visible - $alwayshiddencheckedmodules=array('accounting','api','barcode','blockedlog','bookmark','clicktodial','comptabilite','cron','document','domain','externalrss','externalsite','fckeditor','geoipmaxmind','gravatar','label','ldap', - 'mailmanspip','notification','oauth','syslog','user','webservices','workflow', + $alwayshiddencheckedmodules = array('accounting', 'api', 'barcode', 'blockedlog', 'bookmark', 'clicktodial', 'comptabilite', 'cron', 'document', 'domain', 'externalrss', 'externalsite', 'fckeditor', 'geoipmaxmind', 'gravatar', 'label', 'ldap', + 'mailmanspip', 'notification', 'oauth', 'syslog', 'user', 'webservices', 'workflow', // Extended modules - 'memcached','numberwords','zipautofillfr'); - $alwayshiddenuncheckedmodules=array('dav','debugbar','emailcollector','ftp','hrm','modulebuilder','printing','webservicesclient', + 'memcached', 'numberwords', 'zipautofillfr'); + $alwayshiddenuncheckedmodules = array('dav', 'debugbar', 'emailcollector', 'ftp', 'hrm', 'modulebuilder', 'printing', 'webservicesclient', // Extended modules - 'awstats','bittorrent','bootstrap','cabinetmed','cmcic','concatpdf','customfield','deplacement','dolicloud','filemanager','lightbox','mantis','monitoring','moretemplates','multicompany','nltechno','numberingpack','openstreetmap', - 'ovh','phenix','phpsysinfo','pibarcode','postnuke','selectbank','skincoloreditor','submiteverywhere','survey','thomsonphonebook','topten','tvacerfa','voyage','webcalendar','webmail'); + 'awstats', 'bittorrent', 'bootstrap', 'cabinetmed', 'cmcic', 'concatpdf', 'customfield', 'deplacement', 'dolicloud', 'filemanager', 'lightbox', 'mantis', 'monitoring', 'moretemplates', 'multicompany', 'nltechno', 'numberingpack', 'openstreetmap', + 'ovh', 'phenix', 'phpsysinfo', 'pibarcode', 'postnuke', 'selectbank', 'skincoloreditor', 'submiteverywhere', 'survey', 'thomsonphonebook', 'topten', 'tvacerfa', 'voyage', 'webcalendar', 'webmail'); } // Search modules -$dirlist=$conf->file->dol_document_root; +$dirlist = $conf->file->dol_document_root; // Search modules dirs @@ -132,13 +132,13 @@ $j = 0; // j is module number. Automatically affected if module number not defin foreach ($modulesdir as $dir) { // Charge tableaux modules, nom, numero, orders depuis repertoire dir - $handle=@opendir($dir); + $handle = @opendir($dir); if (is_resource($handle)) { - while (($file = readdir($handle))!==false) + while (($file = readdir($handle)) !== false) { //print "$i ".$file."\n
"; - if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') + if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') { $modName = substr($file, 0, dol_strlen($file) - 10); @@ -158,25 +158,25 @@ foreach ($modulesdir as $dir) $j = 1000 + $i; } - $modulequalified=1; + $modulequalified = 1; // We discard modules according to features level (PS: if module is activated we always show it) $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod))); - if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && empty($conf->global->$const_name)) $modulequalified=0; - if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && empty($conf->global->$const_name)) $modulequalified=0; + if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && empty($conf->global->$const_name)) $modulequalified = 0; + if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && empty($conf->global->$const_name)) $modulequalified = 0; if ($modulequalified) { $modules[$i] = $objMod; - $filename[$i]= $modName; - $orders[$i] = $objMod->family."_".$j; // Tri par famille puis numero module + $filename[$i] = $modName; + $orders[$i] = $objMod->family."_".$j; // Tri par famille puis numero module //print "x".$modName." ".$orders[$i]."\n
"; $dirmod[$i] = $dirroot; $j++; $i++; } } - catch(Exception $e) + catch (Exception $e) { dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); } @@ -197,7 +197,7 @@ asort($orders); if (GETPOST('action', 'aZ09') == 'gotodemo') // Action run when we click on "Start" after selection modules { //print 'ee'.GETPOST("demochoice"); - $disablestring=''; + $disablestring = ''; // If we disable modules using a profile choice if (GETPOST("demochoice")) { @@ -205,27 +205,27 @@ if (GETPOST('action', 'aZ09') == 'gotodemo') // Action run when we click on { if ($profilearray['key'] == GETPOST("demochoice")) { - $disablestring=$profilearray['disablemodules']; + $disablestring = $profilearray['disablemodules']; break; } } } // If we disable modules using personalized list - foreach($modules as $val) + foreach ($modules as $val) { - $modulekeyname=strtolower($val->name); - if (empty($_POST[$modulekeyname]) && empty($val->always_enabled) && ! in_array($modulekeyname, $alwayscheckedmodules)) + $modulekeyname = strtolower($val->name); + if (empty($_POST[$modulekeyname]) && empty($val->always_enabled) && !in_array($modulekeyname, $alwayscheckedmodules)) { - $disablestring.=$modulekeyname.','; - if ($modulekeyname=='propale') $disablestring.='propal,'; + $disablestring .= $modulekeyname.','; + if ($modulekeyname == 'propale') $disablestring .= 'propal,'; } } // Do redirect to login page if ($disablestring) { - if (GETPOST('urlfrom')) $url.=(preg_match('/\?/', $url)?'&':'?').'urlfrom='.urlencode(GETPOST('urlfrom', 'alpha')); - $url.=(preg_match('/\?/', $url)?'&':'?').'disablemodules='.$disablestring; + if (GETPOST('urlfrom')) $url .= (preg_match('/\?/', $url) ? '&' : '?').'urlfrom='.urlencode(GETPOST('urlfrom', 'alpha')); + $url .= (preg_match('/\?/', $url) ? '&' : '?').'disablemodules='.$disablestring; //var_dump($url);exit; header("Location: ".$url); exit; @@ -237,11 +237,11 @@ if (GETPOST('action', 'aZ09') == 'gotodemo') // Action run when we click on * View */ -$head=''; -$head.=''."\n"; -$head.=''."\n"; +$head = ''; +$head .= ''."\n"; +$head .= ''."\n"; -$head.=' +$head .= ' ' . "\n"; + print ''."\n"; print '
'; print '
'; - print $langs->trans("ThirdPartyType") . ':     '; + print $langs->trans("ThirdPartyType").':     '; print '
'; print ''; print '     '; print '
'; print ''; print ''; print ' '; @@ -294,7 +294,7 @@ if ($resql) print '  '; - $searchpicto=$form->showFilterAndCheckAddButtons(0); + $searchpicto = $form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
'.$objp->label.''; if (preg_match('/([0-9]+)y/i', $objp->duration, $regs)) print $regs[1].' '.$langs->trans("DurationYear"); diff --git a/htdocs/product/stock/class/api_stockmovements.class.php b/htdocs/product/stock/class/api_stockmovements.class.php index 1c18627f2cf..0c61ae605c0 100644 --- a/htdocs/product/stock/class/api_stockmovements.class.php +++ b/htdocs/product/stock/class/api_stockmovements.class.php @@ -99,47 +99,47 @@ class StockMovements extends DolibarrApi $obj_ret = array(); - if(! DolibarrApiAccess::$user->rights->stock->lire) { + if (!DolibarrApiAccess::$user->rights->stock->lire) { throw new RestException(401); } $sql = "SELECT t.rowid"; - $sql.= " FROM ".MAIN_DB_PREFIX."stock_mouvement as t"; + $sql .= " FROM ".MAIN_DB_PREFIX."stock_mouvement as t"; //$sql.= ' WHERE t.entity IN ('.getEntity('stock').')'; - $sql.= ' WHERE 1 = 1'; + $sql .= ' WHERE 1 = 1'; // Add sql filters if ($sqlfilters) { - if (! DolibarrApi::_checkFilters($sqlfilters)) + if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; - $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } - $sql.= $db->order($sortfield, $sortorder); - if ($limit) { + $sql .= $db->order($sortfield, $sortorder); + if ($limit) { if ($page < 0) { $page = 0; } $offset = $limit * $page; - $sql.= $db->plimit($limit + 1, $offset); + $sql .= $db->plimit($limit + 1, $offset); } $result = $db->query($sql); if ($result) { - $i=0; + $i = 0; $num = $db->num_rows($result); $min = min($num, ($limit <= 0 ? $num : $limit)); while ($i < $min) { $obj = $db->fetch_object($result); $stockmovement_static = new MouvementStock($db); - if($stockmovement_static->fetch($obj->rowid)) { + if ($stockmovement_static->fetch($obj->rowid)) { $obj_ret[] = $this->_cleanObjectDatas($stockmovement_static); } $i++; @@ -148,7 +148,7 @@ class StockMovements extends DolibarrApi else { throw new RestException(503, 'Error when retrieve stock movement list : '.$db->lasterror()); } - if( ! count($obj_ret)) { + if (!count($obj_ret)) { throw new RestException(404, 'No stock movement found'); } return $obj_ret; @@ -177,7 +177,7 @@ class StockMovements extends DolibarrApi */ public function post($product_id, $warehouse_id, $qty, $lot = '', $movementcode = '', $movementlabel = '', $price = '', $dlc = '', $dluo = '') { - if(! DolibarrApiAccess::$user->rights->stock->creer) { + if (!DolibarrApiAccess::$user->rights->stock->creer) { throw new RestException(401); } @@ -187,7 +187,7 @@ class StockMovements extends DolibarrApi // Type increase or decrease $type = 2; - if ($qty >= 0){ + if ($qty >= 0) { $type = 3; } @@ -195,7 +195,7 @@ class StockMovements extends DolibarrApi $eatBy = empty($dluo) ? '' : dol_stringtotime($dluo); $sellBy = empty($dlc) ? '' : dol_stringtotime($dlc); - if($this->stockmovement->_create(DolibarrApiAccess::$user, $product_id, $warehouse_id, $qty, $type, $price, $movementlabel, $movementcode, '', $eatBy, $sellBy, $lot) <= 0) { + if ($this->stockmovement->_create(DolibarrApiAccess::$user, $product_id, $warehouse_id, $qty, $type, $price, $movementlabel, $movementcode, '', $eatBy, $sellBy, $lot) <= 0) { $errormessage = $this->stockmovement->error; if (empty($errormessage)) $errormessage = join(',', $this->stockmovement->errors); throw new RestException(503, 'Error when create stock movement : '.$errormessage); diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index ab3dfde9bf0..40c358967ce 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -37,18 +37,18 @@ class Entrepot extends CommonObject /** * @var string ID to identify managed object */ - public $element='stock'; + public $element = 'stock'; /** * @var string Name of table without prefix where object is stored */ - public $table_element='entrepot'; + public $table_element = 'entrepot'; /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ - public $picto='stock'; - public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + public $picto = 'stock'; + public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe /** * @var string Label @@ -102,7 +102,7 @@ class Entrepot extends CommonObject /** * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ - public $fields=array( + public $fields = array( 'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>10), 'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-2, 'showoncombobox'=>1, 'position'=>25), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>30), @@ -181,7 +181,7 @@ class Entrepot extends CommonObject return 0; } - $now=dol_now(); + $now = dol_now(); $this->db->begin(); @@ -189,7 +189,7 @@ class Entrepot extends CommonObject $sql .= " VALUES ('".$this->db->escape($this->libelle)."', ".$conf->entity.", '".$this->db->idate($now)."', ".$user->id.", ".($this->fk_parent > 0 ? $this->fk_parent : "NULL").")"; dol_syslog(get_class($this)."::create", LOG_DEBUG); - $result=$this->db->query($sql); + $result = $this->db->query($sql); if ($result) { $id = $this->db->last_insert_id(MAIN_DB_PREFIX."entrepot"); @@ -197,7 +197,7 @@ class Entrepot extends CommonObject { $this->id = $id; - if (! $error) + if (!$error) { $result = $this->update($id, $user); if ($result <= 0) @@ -207,11 +207,11 @@ class Entrepot extends CommonObject } // Actions on extra fields - if (! $error) + if (!$error) { if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { - $result=$this->insertExtraFields(); + $result = $this->insertExtraFields(); if ($result < 0) { $error++; @@ -219,7 +219,7 @@ class Entrepot extends CommonObject } } - if (! $error) + if (!$error) { $this->db->commit(); return $id; @@ -232,14 +232,14 @@ class Entrepot extends CommonObject } } else { - $this->error="Failed to get insert id"; + $this->error = "Failed to get insert id"; dol_syslog(get_class($this)."::create return -2"); return -2; } } else { - $this->error=$this->db->error(); + $this->error = $this->db->error(); dol_syslog(get_class($this)."::create Error ".$this->db->error()); $this->db->rollback(); return -1; @@ -257,56 +257,56 @@ class Entrepot extends CommonObject { global $conf; - $error=0; + $error = 0; if (empty($id)) $id = $this->id; // Check if new parent is already a child of current warehouse - if(!empty($this->fk_parent)) + if (!empty($this->fk_parent)) { $TChildWarehouses = array($id); $TChildWarehouses = $this->get_children_warehouses($this->id, $TChildWarehouses); - if(in_array($this->fk_parent, $TChildWarehouses)) + if (in_array($this->fk_parent, $TChildWarehouses)) { $this->error = 'ErrorCannotAddThisParentWarehouse'; return -2; } } - $this->libelle=trim($this->libelle); - $this->description=trim($this->description); + $this->libelle = trim($this->libelle); + $this->description = trim($this->description); - $this->lieu=trim($this->lieu); + $this->lieu = trim($this->lieu); - $this->address=trim($this->address); - $this->zip=trim($this->zip); - $this->town=trim($this->town); - $this->country_id=($this->country_id > 0 ? $this->country_id : 0); + $this->address = trim($this->address); + $this->zip = trim($this->zip); + $this->town = trim($this->town); + $this->country_id = ($this->country_id > 0 ? $this->country_id : 0); $sql = "UPDATE ".MAIN_DB_PREFIX."entrepot "; - $sql .= " SET ref = '" . $this->db->escape($this->libelle) ."'"; - $sql .= ", fk_parent = " . (($this->fk_parent > 0) ? $this->fk_parent : "NULL"); - $sql .= ", description = '" . $this->db->escape($this->description) ."'"; - $sql .= ", statut = " . $this->statut; - $sql .= ", lieu = '" . $this->db->escape($this->lieu) ."'"; - $sql .= ", address = '" . $this->db->escape($this->address) ."'"; - $sql .= ", zip = '" . $this->db->escape($this->zip) ."'"; - $sql .= ", town = '" . $this->db->escape($this->town) ."'"; - $sql .= ", fk_pays = " . $this->country_id; - $sql .= " WHERE rowid = " . $id; + $sql .= " SET ref = '".$this->db->escape($this->libelle)."'"; + $sql .= ", fk_parent = ".(($this->fk_parent > 0) ? $this->fk_parent : "NULL"); + $sql .= ", description = '".$this->db->escape($this->description)."'"; + $sql .= ", statut = ".$this->statut; + $sql .= ", lieu = '".$this->db->escape($this->lieu)."'"; + $sql .= ", address = '".$this->db->escape($this->address)."'"; + $sql .= ", zip = '".$this->db->escape($this->zip)."'"; + $sql .= ", town = '".$this->db->escape($this->town)."'"; + $sql .= ", fk_pays = ".$this->country_id; + $sql .= " WHERE rowid = ".$id; $this->db->begin(); dol_syslog(get_class($this)."::update", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); - if (! $resql) { + if (!$resql) { $error++; - $this->errors[]="Error ".$this->db->lasterror(); + $this->errors[] = "Error ".$this->db->lasterror(); } - if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) { - $result=$this->insertExtraFields(); + if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0) { + $result = $this->insertExtraFields(); if ($result < 0) { $error++; @@ -318,7 +318,7 @@ class Entrepot extends CommonObject return 1; } else { $this->db->rollback(); - $this->error=$this->db->lasterror(); + $this->error = $this->db->lasterror(); return -1; } } @@ -341,24 +341,24 @@ class Entrepot extends CommonObject $this->db->begin(); - if (! $error && empty($notrigger)) + if (!$error && empty($notrigger)) { // Call trigger - $result=$this->call_trigger('WAREHOUSE_DELETE', $user); + $result = $this->call_trigger('WAREHOUSE_DELETE', $user); if ($result < 0) { $error++; } // End call triggers } - $elements = array('stock_mouvement','product_stock','product_warehouse_properties'); - foreach($elements as $table) + $elements = array('stock_mouvement', 'product_stock', 'product_warehouse_properties'); + foreach ($elements as $table) { - if (! $error) + if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX.$table; - $sql.= " WHERE fk_entrepot = " . $this->id; + $sql .= " WHERE fk_entrepot = ".$this->id; - $result=$this->db->query($sql); - if (! $result) + $result = $this->db->query($sql); + if (!$result) { $error++; $this->errors[] = $this->db->lasterror(); @@ -367,11 +367,11 @@ class Entrepot extends CommonObject } // Removed extrafields - if (! $error) + if (!$error) { if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { - $result=$this->deleteExtraFields(); + $result = $this->deleteExtraFields(); if ($result < 0) { $error++; @@ -380,12 +380,12 @@ class Entrepot extends CommonObject } } - if (! $error) + if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."entrepot"; - $sql.= " WHERE rowid = " . $this->id; - $resql1=$this->db->query($sql); - if (! $resql1) + $sql .= " WHERE rowid = ".$this->id; + $resql1 = $this->db->query($sql); + if (!$resql1) { $error++; $this->errors[] = $this->db->lasterror(); @@ -393,12 +393,12 @@ class Entrepot extends CommonObject } } - if (! $error) + if (!$error) { // Update denormalized fields because we change content of produt_stock. Warning: Do not use "SET p.stock", does not works with pgsql $sql = "UPDATE ".MAIN_DB_PREFIX."product as p SET stock = (SELECT SUM(ps.reel) FROM ".MAIN_DB_PREFIX."product_stock as ps WHERE ps.fk_product = p.rowid)"; - $resql2=$this->db->query($sql); - if (! $resql2) + $resql2 = $this->db->query($sql); + if (!$resql2) { $error++; $this->errors[] = $this->db->lasterror(); @@ -406,7 +406,7 @@ class Entrepot extends CommonObject } } - if (! $error) + if (!$error) { $this->db->commit(); return 1; @@ -433,9 +433,9 @@ class Entrepot extends CommonObject dol_syslog(get_class($this)."::fetch id=".$id." ref=".$ref); // Check parameters - if (! $id && ! $ref) + if (!$id && !$ref) { - $this->error='ErrorWrongParameters'; + $this->error = 'ErrorWrongParameters'; dol_syslog(get_class($this)."::fetch ".$this->error); return -1; } @@ -444,12 +444,12 @@ class Entrepot extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX."entrepot"; if ($id) { - $sql.= " WHERE rowid = '".$id."'"; + $sql .= " WHERE rowid = '".$id."'"; } else { - $sql.= " WHERE entity = " .$conf->entity; - if ($ref) $sql.= " AND ref = '".$this->db->escape($ref)."'"; + $sql .= " WHERE entity = ".$conf->entity; + if ($ref) $sql .= " AND ref = '".$this->db->escape($ref)."'"; } $result = $this->db->query($sql); @@ -457,13 +457,13 @@ class Entrepot extends CommonObject { if ($this->db->num_rows($result) > 0) { - $obj=$this->db->fetch_object($result); + $obj = $this->db->fetch_object($result); $this->id = $obj->rowid; $this->fk_parent = $obj->fk_parent; $this->ref = $obj->label; $this->label = $obj->label; - $this->libelle = $obj->label; // deprecated + $this->libelle = $obj->label; // deprecated $this->description = $obj->description; $this->statut = $obj->statut; $this->lieu = $obj->lieu; @@ -477,21 +477,21 @@ class Entrepot extends CommonObject $this->fetch_optionals(); include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; - $tmp=getCountry($this->country_id, 'all'); - $this->country=$tmp['label']; - $this->country_code=$tmp['code']; + $tmp = getCountry($this->country_id, 'all'); + $this->country = $tmp['label']; + $this->country_code = $tmp['code']; return 1; } else { - $this->error="Record Not Found"; + $this->error = "Record Not Found"; return 0; } } else { - $this->error=$this->db->error(); + $this->error = $this->db->error(); return -1; } } @@ -506,11 +506,11 @@ class Entrepot extends CommonObject public function info($id) { $sql = "SELECT e.rowid, e.datec, e.tms as datem, e.fk_user_author"; - $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e"; - $sql.= " WHERE e.rowid = ".$id; + $sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e"; + $sql .= " WHERE e.rowid = ".$id; dol_syslog(get_class($this)."::info", LOG_DEBUG); - $result=$this->db->query($sql); + $result = $this->db->query($sql); if ($result) { if ($this->db->num_rows($result)) @@ -522,7 +522,7 @@ class Entrepot extends CommonObject if ($obj->fk_user_author) { $cuser = new User($this->db); $cuser->fetch($obj->fk_user_author); - $this->user_creation = $cuser; + $this->user_creation = $cuser; } if ($obj->fk_user_valid) { @@ -557,14 +557,14 @@ class Entrepot extends CommonObject $liste = array(); $sql = "SELECT rowid, ref as label"; - $sql.= " FROM ".MAIN_DB_PREFIX."entrepot"; - $sql.= " WHERE entity IN (".getEntity('stock').")"; - $sql.= " AND statut = ".$status; + $sql .= " FROM ".MAIN_DB_PREFIX."entrepot"; + $sql .= " WHERE entity IN (".getEntity('stock').")"; + $sql .= " AND statut = ".$status; $result = $this->db->query($sql); $i = 0; $num = $this->db->num_rows($result); - if ( $result ) + if ($result) { while ($i < $num) { @@ -586,25 +586,25 @@ class Entrepot extends CommonObject public function nb_different_products() { // phpcs:enable - $ret=array(); + $ret = array(); $sql = "SELECT count(distinct p.rowid) as nb"; - $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps"; - $sql.= ", ".MAIN_DB_PREFIX."product as p"; - $sql.= " WHERE ps.fk_entrepot = ".$this->id; - $sql.= " AND ps.fk_product = p.rowid"; + $sql .= " FROM ".MAIN_DB_PREFIX."product_stock as ps"; + $sql .= ", ".MAIN_DB_PREFIX."product as p"; + $sql .= " WHERE ps.fk_entrepot = ".$this->id; + $sql .= " AND ps.fk_product = p.rowid"; //print $sql; $result = $this->db->query($sql); if ($result) { $obj = $this->db->fetch_object($result); - $ret['nb']=$obj->nb; + $ret['nb'] = $obj->nb; $this->db->free($result); } else { - $this->error=$this->db->lasterror(); + $this->error = $this->db->lasterror(); return -1; } @@ -620,26 +620,26 @@ class Entrepot extends CommonObject public function nb_products() { // phpcs:enable - $ret=array(); + $ret = array(); $sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * p.pmp) as value"; - $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps"; - $sql.= ", ".MAIN_DB_PREFIX."product as p"; - $sql.= " WHERE ps.fk_entrepot = ".$this->id; - $sql.= " AND ps.fk_product = p.rowid"; + $sql .= " FROM ".MAIN_DB_PREFIX."product_stock as ps"; + $sql .= ", ".MAIN_DB_PREFIX."product as p"; + $sql .= " WHERE ps.fk_entrepot = ".$this->id; + $sql .= " AND ps.fk_product = p.rowid"; //print $sql; $result = $this->db->query($sql); if ($result) { $obj = $this->db->fetch_object($result); - $ret['nb']=$obj->nb; - $ret['value']=$obj->value; + $ret['nb'] = $obj->nb; + $ret['value'] = $obj->value; $this->db->free($result); } else { - $this->error=$this->db->lasterror(); + $this->error = $this->db->lasterror(); return -1; } @@ -695,40 +695,40 @@ class Entrepot extends CommonObject global $conf, $langs; $langs->load("stocks"); - if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips - $result=''; + $result = ''; - $label = '' . $langs->trans("ShowWarehouse").''; - $label.= '
' . $langs->trans('Ref') . ': ' . (empty($this->ref)?(empty($this->label)?$this->libelle:$this->label):$this->ref); - if (! empty($this->lieu)) { - $label.= '
' . $langs->trans('LocationSummary').': '.$this->lieu; + $label = ''.$langs->trans("ShowWarehouse").''; + $label .= '
'.$langs->trans('Ref').': '.(empty($this->ref) ? (empty($this->label) ? $this->libelle : $this->label) : $this->ref); + if (!empty($this->lieu)) { + $label .= '
'.$langs->trans('LocationSummary').': '.$this->lieu; } if (isset($this->statut)) { - $label.= '
' . $langs->trans("Status").": ".$this->getLibStatut(5); + $label .= '
'.$langs->trans("Status").": ".$this->getLibStatut(5); } $url = DOL_URL_ROOT.'/product/stock/card.php?id='.$this->id; - $linkclose=''; + $linkclose = ''; if (empty($notooltip)) { - if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - $label=$langs->trans("ShowWarehouse"); - $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + $label = $langs->trans("ShowWarehouse"); + $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose.=' class="classfortooltip"'; + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="classfortooltip"'; } $linkstart = ''; - $linkend=''; + $linkstart .= $linkclose.'>'; + $linkend = ''; $result .= $linkstart; - if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); - if ($withpicto != 2) $result.= ($showfullpath ? $this->get_full_arbo() : (empty($this->label)?$this->libelle:$this->label)); + if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + if ($withpicto != 2) $result .= ($showfullpath ? $this->get_full_arbo() : (empty($this->label) ? $this->libelle : $this->label)); $result .= $linkend; return $result; @@ -743,23 +743,23 @@ class Entrepot extends CommonObject */ public function initAsSpecimen() { - global $user,$langs,$conf,$mysoc; + global $user, $langs, $conf, $mysoc; - $now=dol_now(); + $now = dol_now(); // Initialize parameters - $this->id=0; + $this->id = 0; $this->libelle = 'WAREHOUSE SPECIMEN'; $this->description = 'WAREHOUSE SPECIMEN '.dol_print_date($now, 'dayhourlog'); - $this->statut=1; - $this->specimen=1; + $this->statut = 1; + $this->specimen = 1; - $this->lieu='Location test'; - $this->address='21 jump street'; - $this->zip='99999'; - $this->town='MyTown'; - $this->country_id=1; - $this->country_code='FR'; + $this->lieu = 'Location test'; + $this->address = '21 jump street'; + $this->zip = '99999'; + $this->town = 'MyTown'; + $this->country_id = 1; + $this->country_code = 'FR'; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -771,16 +771,16 @@ class Entrepot extends CommonObject public function get_full_arbo() { // phpcs:enable - global $user,$langs,$conf; + global $user, $langs, $conf; - $TArbo = array(empty($this->label)?$this->libelle:$this->label); + $TArbo = array(empty($this->label) ? $this->libelle : $this->label); - $protection=100; // We limit depth of warehouses to 100 + $protection = 100; // We limit depth of warehouses to 100 $warehousetmp = new Entrepot($this->db); - $parentid = $this->fk_parent; // If parent_id not defined on current object, we do not start consecutive searches of parents - $i=0; + $parentid = $this->fk_parent; // If parent_id not defined on current object, we do not start consecutive searches of parents + $i = 0; while ($parentid > 0 && $i < $protection) { $sql = 'SELECT fk_parent FROM '.MAIN_DB_PREFIX.'entrepot WHERE rowid = '.$parentid; @@ -821,8 +821,8 @@ class Entrepot extends CommonObject WHERE fk_parent = '.$id; $resql = $this->db->query($sql); - if($resql) { - while($res = $this->db->fetch_object($resql)) { + if ($resql) { + while ($res = $this->db->fetch_object($resql)) { $TChildWarehouses[] = $res->rowid; $this->get_children_warehouses($res->rowid, $TChildWarehouses); } @@ -843,16 +843,16 @@ class Entrepot extends CommonObject */ public function generateDocument($modele, $outputlangs = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { - global $conf,$user,$langs; + global $conf, $user, $langs; $langs->load("stocks"); - if (! dol_strlen($modele)) { + if (!dol_strlen($modele)) { $modele = 'standard'; if ($this->modelpdf) { $modele = $this->modelpdf; - } elseif (! empty($conf->global->STOCK_ADDON_PDF)) { + } elseif (!empty($conf->global->STOCK_ADDON_PDF)) { $modele = $conf->global->STOCK_ADDON_PDF; } } @@ -877,12 +877,12 @@ class Entrepot extends CommonObject $type_categ = Categorie::TYPE_WAREHOUSE; // Handle single category - if (! is_array($categories)) { + if (!is_array($categories)) { $categories = array($categories); } // Get current categories - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $c = new Categorie($this->db); $existing = $c->containing($this->id, $type_categ, 'id'); @@ -896,7 +896,7 @@ class Entrepot extends CommonObject } // Process - foreach($to_del as $del) { + foreach ($to_del as $del) { if ($c->fetch($del) > 0) { $c->del_type($this, $type_categ); } diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 527afee2607..4b36fda5ccb 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -200,52 +200,52 @@ jQuery(document).ready(function() { $sql = "SELECT"; -$sql.= " t.rowid,"; -$sql.= " t.entity,"; -$sql.= " t.fk_product,"; -$sql.= " t.batch,"; -$sql.= " t.sellby,"; -$sql.= " t.eatby,"; -$sql.= " t.datec as date_creation,"; -$sql.= " t.tms as date_update,"; -$sql.= " t.fk_user_creat,"; -$sql.= " t.fk_user_modif,"; -$sql.= " t.import_key,"; -$sql.= " p.fk_product_type as product_type,"; -$sql.= " p.ref as product_ref,"; -$sql.= " p.label as product_label,"; -$sql.= " p.tosell,"; -$sql.= " p.tobuy,"; -$sql.= " p.tobatch"; +$sql .= " t.rowid,"; +$sql .= " t.entity,"; +$sql .= " t.fk_product,"; +$sql .= " t.batch,"; +$sql .= " t.sellby,"; +$sql .= " t.eatby,"; +$sql .= " t.datec as date_creation,"; +$sql .= " t.tms as date_update,"; +$sql .= " t.fk_user_creat,"; +$sql .= " t.fk_user_modif,"; +$sql .= " t.import_key,"; +$sql .= " p.fk_product_type as product_type,"; +$sql .= " p.ref as product_ref,"; +$sql .= " p.label as product_label,"; +$sql .= " p.tosell,"; +$sql .= " p.tobuy,"; +$sql .= " p.tobatch"; // Add fields for extrafields -if (! empty($extrafields->attributes[$object->table_element]['label'])) { - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); +if (!empty($extrafields->attributes[$object->table_element]['label'])) { + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); } // Add fields from hooks -$parameters=array(); -$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook -$sql.=$hookmanager->resPrint; -$sql.= " FROM ".MAIN_DB_PREFIX."product_lot as t"; -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; -$sql.= ", ".MAIN_DB_PREFIX."product as p"; -$sql.= " WHERE p.rowid = t.fk_product"; -$sql.= " AND p.entity IN (".getEntity('product').")"; +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; +$sql .= " FROM ".MAIN_DB_PREFIX."product_lot as t"; +if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; +$sql .= ", ".MAIN_DB_PREFIX."product as p"; +$sql .= " WHERE p.rowid = t.fk_product"; +$sql .= " AND p.entity IN (".getEntity('product').")"; -if ($search_entity) $sql.= natural_search("entity", $search_entity); -if ($search_product) $sql.= natural_search("p.ref", $search_product); -if ($search_batch) $sql.= natural_search("batch", $search_batch); -if ($search_fk_user_creat) $sql.= natural_search("fk_user_creat", $search_fk_user_creat); -if ($search_fk_user_modif) $sql.= natural_search("fk_user_modif", $search_fk_user_modif); -if ($search_import_key) $sql.= natural_search("import_key", $search_import_key); +if ($search_entity) $sql .= natural_search("entity", $search_entity); +if ($search_product) $sql .= natural_search("p.ref", $search_product); +if ($search_batch) $sql .= natural_search("batch", $search_batch); +if ($search_fk_user_creat) $sql .= natural_search("fk_user_creat", $search_fk_user_creat); +if ($search_fk_user_modif) $sql .= natural_search("fk_user_modif", $search_fk_user_modif); +if ($search_import_key) $sql .= natural_search("import_key", $search_import_key); -if ($sall) $sql.= natural_search(array_keys($fieldstosearchall), $sall); +if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks -$parameters=array(); -$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook -$sql.=$hookmanager->resPrint; -$sql.=$db->order($sortfield, $sortorder); +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; +$sql .= $db->order($sortfield, $sortorder); //$sql.= $db->plimit($conf->liste_limit+1, $offset); // Count total nb of records diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 2fcb012f3c4..613daa18ab0 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -156,7 +156,7 @@ class Task extends CommonObject $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task ("; $sql .= "fk_projet"; $sql .= ", ref"; - $sql.= ", entity"; + $sql .= ", entity"; $sql .= ", fk_task_parent"; $sql .= ", label"; $sql .= ", description"; @@ -169,7 +169,7 @@ class Task extends CommonObject $sql .= ") VALUES ("; $sql .= $this->fk_project; $sql .= ", ".(!empty($this->ref) ? "'".$this->db->escape($this->ref)."'" : 'null'); - $sql.= ", ".$conf->entity; + $sql .= ", ".$conf->entity; $sql .= ", ".$this->fk_task_parent; $sql .= ", '".$this->db->escape($this->label)."'"; $sql .= ", '".$this->db->escape($this->description)."'"; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index efaaa5b75ca..291ab4ab949 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -43,7 +43,7 @@ $action = GETPOST('action', 'alpha'); $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); -$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'alpha'); @@ -237,8 +237,8 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$_POST["cancel $object->fetch($id, $ref); $object->timespent_note = $_POST["timespent_note_line"]; $object->timespent_old_duration = $_POST["old_duration"]; - $object->timespent_duration = $_POST["new_durationhour"] * 60 * 60; // We store duration in seconds - $object->timespent_duration += ($_POST["new_durationmin"] ? $_POST["new_durationmin"] : 0) * 60; // We store duration in seconds + $object->timespent_duration = $_POST["new_durationhour"] * 60 * 60; // We store duration in seconds + $object->timespent_duration += ($_POST["new_durationmin"] ? $_POST["new_durationmin"] : 0) * 60; // We store duration in seconds if (GETPOST("timelinehour") != '' && GETPOST("timelinehour") >= 0) // If hour was entered { $object->timespent_date = dol_mktime(GETPOST("timelinehour"), GETPOST("timelinemin"), 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); @@ -387,18 +387,18 @@ if ($action == 'confirm_generateinvoice') if ($idprod > 0) { $tmpproduct->fetch($idprod); - if ($tmpproduct->duration_unit=='i') - $prodDurationHours = 1./60; - if ($tmpproduct->duration_unit=='h') + if ($tmpproduct->duration_unit == 'i') + $prodDurationHours = 1. / 60; + if ($tmpproduct->duration_unit == 'h') $prodDurationHours = 1.; - if ($tmpproduct->duration_unit=='d') + if ($tmpproduct->duration_unit == 'd') $prodDurationHours = 24.; - if ($tmpproduct->duration_unit=='w') - $prodDurationHours = 24.*7; - if ($tmpproduct->duration_unit=='m') - $prodDurationHours = 24.*30; - if ($tmpproduct->duration_unit=='y') - $prodDurationHours = 24.*365; + if ($tmpproduct->duration_unit == 'w') + $prodDurationHours = 24. * 7; + if ($tmpproduct->duration_unit == 'm') + $prodDurationHours = 24. * 30; + if ($tmpproduct->duration_unit == 'y') + $prodDurationHours = 24. * 365; $prodDurationHours *= $tmpproduct->duration_value; $dataforprice = $tmpproduct->getSellPrice($mysoc, $projectstatic->thirdparty, 0); @@ -433,7 +433,7 @@ if ($action == 'confirm_generateinvoice') if (!$error) { - if ($generateinvoicemode=='onelineperuser') { + if ($generateinvoicemode == 'onelineperuser') { $arrayoftasks = array(); foreach ($toselect as $key => $value) { @@ -460,7 +460,7 @@ if ($action == 'confirm_generateinvoice') } // Add lines - $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, round($qtyhour/$prodDurationHours, 2), $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, round($qtyhour / $prodDurationHours, 2), $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); // Update lineid into line of timespent $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; @@ -474,7 +474,7 @@ if ($action == 'confirm_generateinvoice') } } } - elseif ($generateinvoicemode=='onelineperperiod') { + elseif ($generateinvoicemode == 'onelineperperiod') { $arrayoftasks = array(); foreach ($toselect as $key => $value) { @@ -504,7 +504,7 @@ if ($action == 'confirm_generateinvoice') } // Add lines - $lineid = $tmpinvoice->addline($value['note'], $pu_ht, round($qtyhour/$prodDurationHours, 2), $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + $lineid = $tmpinvoice->addline($value['note'], $pu_ht, round($qtyhour / $prodDurationHours, 2), $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); // Update lineid into line of timespent $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; @@ -518,7 +518,7 @@ if ($action == 'confirm_generateinvoice') } } } - elseif ($generateinvoicemode=='onelinepertask') { + elseif ($generateinvoicemode == 'onelinepertask') { $arrayoftasks = array(); foreach ($toselect as $key => $value) { @@ -545,7 +545,7 @@ if ($action == 'confirm_generateinvoice') // Add lines $lineName = $ftask->ref.' - '.$ftask->label; - $lineid = $tmpinvoice->addline($lineName, $pu_ht, round($qtyhour/$prodDurationHours, 2), $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + $lineid = $tmpinvoice->addline($lineName, $pu_ht, round($qtyhour / $prodDurationHours, 2), $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); // Update lineid into line of timespent $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; @@ -1346,7 +1346,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) print '
'; if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) { - $formproject->selectTasks(-1, GETPOST('taskid', 'int')?GETPOST('taskid', 'int'):$task_time->fk_task, 'taskid', 0, 0, 1, 1, 0, 0, 'maxwidth300', $projectstatic->id, ''); + $formproject->selectTasks(-1, GETPOST('taskid', 'int') ?GETPOST('taskid', 'int') : $task_time->fk_task, 'taskid', 0, 0, 1, 1, 0, 0, 'maxwidth300', $projectstatic->id, ''); } else { @@ -1392,11 +1392,11 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) } else { - $userstatic->id = $task_time->fk_user; + $userstatic->id = $task_time->fk_user; $userstatic->lastname = $task_time->lastname; - $userstatic->firstname = $task_time->firstname; - $userstatic->photo = $task_time->photo; - $userstatic->statut = $task_time->user_status; + $userstatic->firstname = $task_time->firstname; + $userstatic->photo = $task_time->photo; + $userstatic->statut = $task_time->user_status; print $userstatic->getNomUrl(-1); } print '
'."\n"; print ''; - if (! empty($conf->global->STRIPE_ALLOW_LOCAL_CARD)) + if (!empty($conf->global->STRIPE_ALLOW_LOCAL_CARD)) { print ''; } @@ -1346,7 +1346,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' { foreach ($balance->available as $cpt) { - $arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'); + $arrayzerounitcurrency = array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'); if (!in_array($cpt->currency, $arrayzerounitcurrency)) { $currencybalance[$cpt->currency]['available'] = $cpt->amount / 100; } else { @@ -1360,11 +1360,11 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' { foreach ($balance->pending as $cpt) { - $arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'); + $arrayzerounitcurrency = array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'); if (!in_array($cpt->currency, $arrayzerounitcurrency)) { - $currencybalance[$cpt->currency]['pending'] = $currencybalance[$cpt->currency]['available']+$cpt->amount / 100; + $currencybalance[$cpt->currency]['pending'] = $currencybalance[$cpt->currency]['available'] + $cpt->amount / 100; } else { - $currencybalance[$cpt->currency]['pending'] = $currencybalance[$cpt->currency]['available']+$cpt->amount; + $currencybalance[$cpt->currency]['pending'] = $currencybalance[$cpt->currency]['available'] + $cpt->amount; } } } @@ -1373,7 +1373,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' { foreach ($currencybalance as $cpt) { - print ''; + print ''; } } @@ -1383,14 +1383,14 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' // List of bank accounts - $morehtmlright= dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=create'); + $morehtmlright = dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=create'); print load_fiche_titre($langs->trans("BankAccounts"), $morehtmlright, ''); $rib_list = $object->get_all_rib(); if (is_array($rib_list)) { - print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print '
'.$langs->trans('LocalID').'
'.$langs->trans("Currency".strtoupper($cpt['currency'])).''.price($cpt['available'], 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).''.price($cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).''.price($cpt['available']+$cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).'
'.$langs->trans("Currency".strtoupper($cpt['currency'])).''.price($cpt['available'], 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).''.price($cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).''.price($cpt['available'] + $cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).'
'; print ''; diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index d198555e421..bea6223ff32 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -26,17 +26,17 @@ require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; +if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; // Load translation files required by the page $langs->loadLangs(array('compta', 'salaries', 'bills', 'hrm', 'stripe')); // Security check $socid = GETPOST("socid", "int"); -if ($user->socid) $socid=$user->socid; +if ($user->socid) $socid = $user->socid; //$result = restrictedArea($user, 'salaries', '', '', ''); -$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $rowid = GETPOST("rowid", 'alpha'); $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); @@ -154,16 +154,16 @@ if (!$rowid) } // The metadata FULLTAG is defined by the online payment page - $FULLTAG=$charge->metadata->FULLTAG; + $FULLTAG = $charge->metadata->FULLTAG; // Save into $tmparray all metadata $tmparray = dolExplodeIntoArray($FULLTAG, '.', '='); // Load origin object according to metadata - if (! empty($tmparray['CUS']) && $tmparray['CUS'] > 0) + if (!empty($tmparray['CUS']) && $tmparray['CUS'] > 0) { $societestatic->fetch($tmparray['CUS']); } - elseif (! empty($charge->metadata->dol_thirdparty_id) && $charge->metadata->dol_thirdparty_id > 0) + elseif (!empty($charge->metadata->dol_thirdparty_id) && $charge->metadata->dol_thirdparty_id > 0) { $societestatic->fetch($charge->metadata->dol_thirdparty_id); } diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index bcd7a8bccb9..35adc33c749 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -589,7 +589,7 @@ class SupplierProposal extends CommonObject $productFournisseur->find_min_price_product_fournisseur($fk_product); $this->line->fk_fournprice = $productFournisseur->product_fourn_price_id; } else { - $this->line->fk_fournprice = ($fk_fournprice > 0 ? $fk_fournprice : 0); // If fk_fournprice is -1, we will not use fk_fournprice + $this->line->fk_fournprice = ($fk_fournprice > 0 ? $fk_fournprice : 0); // If fk_fournprice is -1, we will not use fk_fournprice } $this->line->pa_ht = $pa_ht; //var_dump($this->line->fk_fournprice);exit; @@ -777,9 +777,9 @@ class SupplierProposal extends CommonObject } $this->line->pa_ht = $pa_ht; - if (is_array($array_options) && count($array_options)>0) { + if (is_array($array_options) && count($array_options) > 0) { // We replace values in this->line->array_options only for entries defined into $array_options - foreach($array_options as $key => $value) { + foreach ($array_options as $key => $value) { $this->line->array_options[$key] = $array_options[$key]; } } diff --git a/htdocs/takepos/floors.php b/htdocs/takepos/floors.php index 01f0a0b4b25..8624948e6ff 100644 --- a/htdocs/takepos/floors.php +++ b/htdocs/takepos/floors.php @@ -25,65 +25,65 @@ //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language //if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); -if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); -if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); -if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); +if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); +if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); -require '../main.inc.php'; // Load $user and permissions +require '../main.inc.php'; // Load $user and permissions -$langs->loadLangs(array("bills","orders","commercial","cashdesk")); +$langs->loadLangs(array("bills", "orders", "commercial", "cashdesk")); -$floor=GETPOST('floor', 'int'); -if ($floor=="") $floor=1; +$floor = GETPOST('floor', 'int'); +if ($floor == "") $floor = 1; $id = GETPOST('id', 'int'); $action = GETPOST('action', 'alpha'); $left = GETPOST('left', 'alpha'); $top = GETPOST('top', 'alpha'); -$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant +$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant $newname = GETPOST('newname', 'alpha'); $mode = GETPOST('mode', 'alpha'); -if ($action=="getTables") +if ($action == "getTables") { - $sql="SELECT rowid, entity, label, leftpos, toppos, floor FROM ".MAIN_DB_PREFIX."takepos_floor_tables where floor=".$floor; + $sql = "SELECT rowid, entity, label, leftpos, toppos, floor FROM ".MAIN_DB_PREFIX."takepos_floor_tables where floor=".$floor; $resql = $db->query($sql); $rows = array(); - while($row = $db->fetch_array($resql)){ + while ($row = $db->fetch_array($resql)) { $rows[] = $row; } echo json_encode($rows); exit; } -if ($action=="update") +if ($action == "update") { - if ($left>95) $left=95; - if ($top>95) $top=95; - if ($left>3 or $top>4) $db->query("UPDATE ".MAIN_DB_PREFIX."takepos_floor_tables set leftpos=".$left.", toppos=".$top." WHERE rowid='".$place."'"); + if ($left > 95) $left = 95; + if ($top > 95) $top = 95; + if ($left > 3 or $top > 4) $db->query("UPDATE ".MAIN_DB_PREFIX."takepos_floor_tables set leftpos=".$left.", toppos=".$top." WHERE rowid='".$place."'"); else $db->query("DELETE from ".MAIN_DB_PREFIX."takepos_floor_tables where rowid='".$place."'"); } -if ($action=="updatename") +if ($action == "updatename") { $newname = preg_replace("/[^a-zA-Z0-9\s]/", "", $newname); // Only English chars if (strlen($newname) > 3) $newname = substr($newname, 0, 3); // Only 3 chars $db->query("UPDATE ".MAIN_DB_PREFIX."takepos_floor_tables set label='".$db->escape($newname)."' WHERE rowid='".$place."'"); } -if ($action=="add") +if ($action == "add") { - $sql="INSERT INTO ".MAIN_DB_PREFIX."takepos_floor_tables(entity, label, leftpos, toppos, floor) VALUES (".$conf->entity.", '', '45', '45', ".$floor.")"; - $asdf=$db->query($sql); + $sql = "INSERT INTO ".MAIN_DB_PREFIX."takepos_floor_tables(entity, label, leftpos, toppos, floor) VALUES (".$conf->entity.", '', '45', '45', ".$floor.")"; + $asdf = $db->query($sql); $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label=rowid where label=''"); // No empty table names } // Title -$title='TakePOS - Dolibarr '.DOL_VERSION; -if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title='TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE; +$title = 'TakePOS - Dolibarr '.DOL_VERSION; +if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $title = 'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE; top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); ?> @@ -169,10 +169,10 @@ $( document ).ready(function() { admin) {?> loadLangs(array("bills", "cashdesk")); -$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant +$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant $idline = GETPOST('idline', 'int'); $action = GETPOST('action', 'alpha'); @@ -46,7 +46,7 @@ $action = GETPOST('action', 'alpha'); */ $arrayofcss = array('/takepos/css/pos.css.php'); -$arrayofjs=array(); +$arrayofjs = array(); top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index 96ccea0a4d7..ec619015496 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -68,7 +68,7 @@ else } $arrayofcss = array('/takepos/css/pos.css.php'); -$arrayofjs=array(); +$arrayofjs = array(); top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index 1ae64888095..1df223716fb 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -135,11 +135,11 @@ if ($conf->global->TAKEPOS_CUSTOM_RECEIPT && $conf->global->TAKEPOS_SHOW_CUSTOME - - - + + + global->TAKEPOS_CUSTOM_RECEIPT && $conf->global->TAKEPOS_SHOW_CUSTOME
product_label)) echo $line->product_label; - else echo $line->description;?> + else echo $line->description; ?> qty;?>total_ttc / $line->qty, 'MT'), 1);?>total_ttc, 1);?>qty; ?>total_ttc / $line->qty, 'MT'), 1); ?>total_ttc, 1); ?>
- - + + -global->TAKEPOS_TICKET_VAT_GROUPPED) { +global->TAKEPOS_TICKET_VAT_GROUPPED) { $vat_groups = array(); foreach ($object->lines as $line) { - if(!array_key_exists($line->tva_tx, $vat_groups)) { + if (!array_key_exists($line->tva_tx, $vat_groups)) { $vat_groups[$line->tva_tx] = 0; } $vat_groups[$line->tva_tx] += $line->total_tva; } - foreach($vat_groups as $key => $val) { + foreach ($vat_groups as $key => $val) { ?> - - + + - + - +
trans("TotalHT");?>total_ht, 1, '', 1, - 1, - 1, $conf->currency)."\n";?>trans("TotalHT"); ?>total_ht, 1, '', 1, - 1, - 1, $conf->currency)."\n"; ?>
trans("VAT").' '.vatrate($key, 1);?>currency)."\n";?>trans("VAT").' '.vatrate($key, 1); ?>currency)."\n"; ?>
trans("TotalVAT").''.price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency)."\n";?>trans("TotalVAT").''.price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency)."\n"; ?>
trans("TotalTTC").''.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency)."\n";?>trans("TotalTTC").''.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency)."\n"; ?>
diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index 0c594bc3f13..75145154c22 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -565,7 +565,7 @@ function OpenDrawer(){ console.log("OpenDrawer"); $.ajax({ type: "POST", - url: 'http://global->TAKEPOS_PRINT_SERVER;?>:8111/print', + url: 'http://global->TAKEPOS_PRINT_SERVER; ?>:8111/print', data: "opendrawer" }); } @@ -667,10 +667,10 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { trans("Customer"); ?>
- " autofocus> + " autofocus> - - + +
@@ -679,7 +679,7 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { } ?> -
+
@@ -747,7 +747,7 @@ else $menus[$r++] = array('title'=>'
'.$langs->trans("Place").'
', 'action'=>'Floors();'); } -if (! empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { +if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { $menus[$r++] = array('title'=>'
'.$langs->trans("Customer").'
', 'action'=>'Customer();'); } $menus[$r++] = array('title'=>'
'.$langs->trans("History").'
', 'action'=>'History();'); @@ -763,29 +763,29 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) { if ($conf->global->TAKEPOS_ORDER_PRINTERS) { - $menus[$r++]=array('title'=>$langs->trans("Order"), 'action'=>'TakeposPrintingOrder();'); + $menus[$r++] = array('title'=>$langs->trans("Order"), 'action'=>'TakeposPrintingOrder();'); } //add temp ticket button if ($conf->global->TAKEPOS_BAR_RESTAURANT) { if ($conf->global->TAKEPOSCONNECTOR) { - $menus[$r++]=array('title'=>'
'.$langs->trans("Receipt").'
','action'=>'TakeposPrinting(placeid);'); + $menus[$r++] = array('title'=>'
'.$langs->trans("Receipt").'
', 'action'=>'TakeposPrinting(placeid);'); } else { - $menus[$r++]=array('title'=>'
'.$langs->trans("Receipt").'
','action'=>'Print(placeid);'); + $menus[$r++] = array('title'=>'
'.$langs->trans("Receipt").'
', 'action'=>'Print(placeid);'); } } - if ($conf->global->TAKEPOSCONNECTOR && $conf->global->TAKEPOS_ORDER_NOTES==1) + if ($conf->global->TAKEPOSCONNECTOR && $conf->global->TAKEPOS_ORDER_NOTES == 1) { - $menus[$r++]=array('title'=>'
'.$langs->trans("OrderNotes").'
', 'action'=>'TakeposOrderNotes();'); + $menus[$r++] = array('title'=>'
'.$langs->trans("OrderNotes").'
', 'action'=>'TakeposOrderNotes();'); } if ($conf->global->TAKEPOS_SUPPLEMENTS) { - $menus[$r++]=array('title'=>'
'.$langs->trans("ProductSupplements").'
', 'action'=>'LoadProducts(\'supplements\');'); + $menus[$r++] = array('title'=>'
'.$langs->trans("ProductSupplements").'
', 'action'=>'LoadProducts(\'supplements\');'); } } if ($conf->global->TAKEPOSCONNECTOR) { - $menus[$r++]=array('title'=>'
'.$langs->trans("DOL_OPEN_DRAWER").'
', 'action'=>'OpenDrawer();'); + $menus[$r++] = array('title'=>'
'.$langs->trans("DOL_OPEN_DRAWER").'
', 'action'=>'OpenDrawer();'); } if ($conf->global->TAKEPOS_DOLIBARR_PRINTER) { $menus[$r++] = array( @@ -795,17 +795,17 @@ if ($conf->global->TAKEPOS_DOLIBARR_PRINTER) { } $hookmanager->initHooks(array('takeposfrontend')); -$reshook=$hookmanager->executeHooks('ActionButtons'); +$reshook = $hookmanager->executeHooks('ActionButtons'); if (!empty($reshook)) { - $menus[$r++]=$reshook; + $menus[$r++] = $reshook; } -if ($r % 3 == 2) $menus[$r++]=array('title'=>'', 'style'=>'visibility: hidden;'); +if ($r % 3 == 2) $menus[$r++] = array('title'=>'', 'style'=>'visibility: hidden;'); -$menus[$r++]=array('title'=>'
'.$langs->trans("BackOffice").'
', 'action'=>'window.open(\''.(DOL_URL_ROOT ? DOL_URL_ROOT : '/').'\', \'_backoffice\');'); +$menus[$r++] = array('title'=>'
'.$langs->trans("BackOffice").'
', 'action'=>'window.open(\''.(DOL_URL_ROOT ? DOL_URL_ROOT : '/').'\', \'_backoffice\');'); -if (! empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { - $menus[$r++]=array('title'=>'
'.$langs->trans("Logout").'
', 'action'=>'window.location.href=\''.DOL_URL_ROOT.'/user/logout.php\';'); +if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { + $menus[$r++] = array('title'=>'
'.$langs->trans("Logout").'
', 'action'=>'window.location.href=\''.DOL_URL_ROOT.'/user/logout.php\';'); } ?> @@ -813,7 +813,7 @@ if (! empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
9 and $i == 9) @@ -825,7 +825,7 @@ if (! empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { else echo ''; } - if (! empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { + if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { print ''."\n"; print '
'; print ' '; @@ -836,7 +836,7 @@ if (! empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
-
+
diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index 268f1885327..8f5820c6d6f 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -1,5 +1,5 @@ +if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> /*
- - @@ -217,7 +231,7 @@ - +
+
- N° 11580*03
+ N° 11580*04
DGFIP
Reçu au titre des dons
à certains organismes d’intérêt général

- Articles 200, 238 bis et 885-0 V bis A du code général des impôts (CGI) + Articles 200, 238 bis et 978 du code général des impôts (CGI)
Numéro d'ordre du reçu
@@ -46,13 +60,13 @@ __MAIN_INFO_SOCIETE_NOM__
Adresse :
__MAIN_INFO_SOCIETE_ADDRESS__
- Code postal __MAIN_INFO_SOCIETE_ZIP__ Commune __MAIN_INFO_SOCIETE_TOWN__
+ Code postal __MAIN_INFO_SOCIETE_ZIP__ Commune __MAIN_INFO_SOCIETE_TOWN__
Objet:
__MAIN_INFO_SOCIETE_OBJECT__
+
Cochez la case concernée (1) :
@@ -90,7 +104,7 @@ - + @@ -138,7 +152,7 @@ - +
Association cultuelle ou de bienfaisance et établissement public des cultes reconnus d'Alsace-MoselleAssociation cultuelle ou de bienfaisance et établissement public reconnus d'Alsace-Moselle
Autre organisme : ………………………………………………………………………………………………Autres organisme : ………………………………………………………………………………………………
__ARTICLE200__ __ARTICLE238____ARTICLE885____ARTICLE978__

@@ -251,7 +265,7 @@ - - @@ -274,10 +288,10 @@
(3) + L’organisme bénéficiaire peut cocher une ou plusieurs cases.
L’organisme bénéficiaire peut, en application de l’article L. 80 C du livre des procédures fiscales, demander à l’administration s’il relève de l’une des catégories d’organismes mentionnées aux articles 200 et 238 bis du code général des impôts.
@@ -262,7 +276,7 @@
(4) + Notamment : abandon de revenus ou de produits ; frais engagés par les bénévoles, dont ils renoncent expressément au remboursement
- + '; print "\n"; From dbb7db376bc8c1b664b6360f46fea466944644ce Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Tue, 18 Feb 2020 09:16:12 +0100 Subject: [PATCH 689/784] fix error code --- htdocs/comm/index.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index c374120c8d2..6e14e565085 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -792,8 +792,8 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) $companystatic->client=$obj->client; $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; - $companystatic->entity = $objp->entity; - $companystatic->email = $objp->email; + $companystatic->entity = $obj->entity; + $companystatic->email = $obj->email; $companystatic->canvas=$obj->canvas; print $companystatic->getNomUrl(1, 'customer', 44); print ''; @@ -900,8 +900,8 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) $companystatic->client=$obj->client; $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; - $companystatic->entity = $objp->entity; - $companystatic->email = $objp->email; + $companystatic->entity = $obj->entity; + $companystatic->email = $obj->email; $companystatic->canvas=$obj->canvas; print $companystatic->getNomUrl(1, 'customer', 44); print ''; From b61858169256056e77a508e6de9543c7f39439be Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Feb 2020 09:37:59 +0100 Subject: [PATCH 690/784] More ajax button in setup. Can reload after on ajaxonoff. --- htdocs/admin/ihm.php | 1 - htdocs/core/js/lib_head.js.php | 14 ++++++++++++-- htdocs/core/lib/ajax.lib.php | 17 +++++++++-------- htdocs/core/lib/usergroups.lib.php | 6 ++++-- htdocs/main.inc.php | 7 ++++--- htdocs/theme/eldy/global.inc.php | 3 +++ 6 files changed, 32 insertions(+), 16 deletions(-) diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 3a9eed62fd0..de550c0ac12 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -248,7 +248,6 @@ print ''; // Multilingual GUI print ''; print ''; diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 103e3df3c5b..9f8fda42d61 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -523,14 +523,16 @@ function hideMessage(fieldId,message) { * @param string intput Input * @param int entity Entity * @param int strict Strict + * @param int forcereload Force reload */ -function setConstant(url, code, input, entity, strict) { +function setConstant(url, code, input, entity, strict, forcereload) { $.get( url, { action: "set", name: code, entity: entity }, function() { + console.log("url request success forcereload="+forcereload); $("#set_" + code).hide(); $("#del_" + code).show(); $.each(input, function(type, data) { @@ -576,6 +578,9 @@ function setConstant(url, code, input, entity, strict) { }); } }); + if (forcereload) { + location.reload(); + } }); } @@ -587,14 +592,16 @@ function setConstant(url, code, input, entity, strict) { * @param string intput Input * @param int entity Entity * @param int strict Strict + * @param int forcereload Force reload */ -function delConstant(url, code, input, entity, strict) { +function delConstant(url, code, input, entity, strict, forcereload) { $.get( url, { action: "del", name: code, entity: entity }, function() { + console.log("url request success forcereload="+forcereload); $("#del_" + code).hide(); $("#set_" + code).show(); $.each(input, function(type, data) { @@ -636,6 +643,9 @@ function delConstant(url, code, input, entity, strict) { }); } }); + if (forcereload) { + location.reload(); + } }); } diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index d2626414ba6..ef76f426e4b 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -473,14 +473,15 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete = /** * On/off button for constant * - * @param string $code Name of constant - * @param array $input Array of type->list of CSS element to switch. Example: array('disabled'=>array(0=>'cssid')) - * @param int $entity Entity to set - * @param int $revertonoff Revert on/off - * @param bool $strict Use only "disabled" with delConstant and "enabled" with setConstant + * @param string $code Name of constant + * @param array $input Array of options. ("disabled"|"enabled'|'set'|'del') => CSS element to switch, 'alert' => message to show, ... Example: array('disabled'=>array(0=>'cssid')) + * @param int $entity Entity to set + * @param int $revertonoff Revert on/off + * @param bool $strict Use only "disabled" with delConstant and "enabled" with setConstant + * @param int $forcereload Force to reload page if we click/change value (this is supported only when there is no 'alert' option in input) * @return string */ -function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0) +function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcereload = 0) { global $conf, $langs; @@ -511,7 +512,7 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof if (input.alert.set.noButton) noButton = input.alert.set.noButton; confirmConstantAction("set", url, code, input, input.alert.set, entity, yesButton, noButton, strict); } else { - setConstant(url, code, input, entity); + setConstant(url, code, input, entity, 0, '.$forcereload.'); } }); @@ -522,7 +523,7 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof if (input.alert.del.noButton) noButton = input.alert.del.noButton; confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton, strict); } else { - delConstant(url, code, input, entity); + delConstant(url, code, input, entity, 0, '.$forcereload.'); } }); }); diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 709832118c2..a234f4ed5e0 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -448,7 +448,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ' Date: Tue, 18 Feb 2020 17:36:00 +0000 Subject: [PATCH 702/784] Fixing style errors. --- htdocs/societe/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 3ad44f224da..c1fedf7cfe6 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -10,7 +10,7 @@ * Copyright (C) 2017 Rui Strecht * Copyright (C) 2017 Juanjo Menent * Copyright (C) 2018 Nicolas ZABOURI - + * * 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 From 18b99254a18376010b965bcb137ec964c1a1db7d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Feb 2020 20:55:22 +0100 Subject: [PATCH 703/784] Experiment ORDER_ENABLE_NEGATIVE --- htdocs/commande/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 3c1bf672c0f..d4855e8933f 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2556,7 +2556,7 @@ if ($action == 'create' && $usercancreate) } // Valid - if ($object->statut == Commande::STATUS_DRAFT && $object->total_ttc >= 0 && $numlines > 0 && $usercanvalidate) + if ($object->statut == Commande::STATUS_DRAFT && ($object->total_ttc >= 0 || ! empty($conf->global->ORDER_ENABLE_NEGATIVE)) && $numlines > 0 && $usercanvalidate) { print ''.$langs->trans('Validate').''; } @@ -2631,7 +2631,7 @@ if ($action == 'create' && $usercancreate) // Create bill and Classify billed // Note: Even if module invoice is not enabled, we should be able to use button "Classified billed" - if ($object->statut > Commande::STATUS_DRAFT && !$object->billed) { + if ($object->statut > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0) { if (!empty($conf->facture->enabled) && $user->rights->facture->creer && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) { print ''; } From 0dcb83e6bfc698082a40a196fd0a30b4885d01a8 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 3 Feb 2020 23:10:04 +0000 Subject: [PATCH 704/784] referer XSS patches --- htdocs/comm/action/card.php | 4 ++-- htdocs/public/error-401.php | 2 +- htdocs/public/error-404.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index e44e5c3a973..0199bebc01e 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -831,7 +831,7 @@ if ($action == 'create') print ''; print ''; print ''; - if ($backtopage) print ''; + if ($backtopage) print ''; if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) print ''; if (GETPOST("actioncode", 'aZ09') == 'AC_RDV') print load_fiche_titre($langs->trans("AddActionRendezVous"), '', 'title_agenda'); @@ -1232,7 +1232,7 @@ if ($id > 0) print ''; print ''; print ''; - if ($backtopage) print ''; + if ($backtopage) print ''; if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) print ''; dol_fiche_head($head, 'card', $langs->trans("Action"), 0, 'action'); diff --git a/htdocs/public/error-401.php b/htdocs/public/error-401.php index d6a6ed548ff..ac921fc9f78 100644 --- a/htdocs/public/error-401.php +++ b/htdocs/public/error-401.php @@ -21,7 +21,7 @@ Sorry. You are not allowed to access this resource.
- +
diff --git a/htdocs/public/error-404.php b/htdocs/public/error-404.php index 36547d26704..34a4ac03e9e 100644 --- a/htdocs/public/error-404.php +++ b/htdocs/public/error-404.php @@ -21,7 +21,7 @@ You requested a website or a page that does not exists.
- +
From fa1606387561fd5d12ede6ad8b27d4e4d3f871f8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Feb 2020 22:39:01 +0100 Subject: [PATCH 705/784] Fix bad accounting code set --- htdocs/product/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index ebf9c093c02..27bf63f08fd 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1187,7 +1187,7 @@ else { print '
'; print ''; print ''; @@ -472,33 +472,33 @@ if ($id) { // Determine le nom du champ par rapport aux noms possibles // dans les dictionnaires de donnees - $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut - $valuetoshow=$langs->trans($valuetoshow); // try to translate - $class="left"; - if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } - if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') + $valuetoshow = ucfirst($fieldlist[$field]); // Par defaut + $valuetoshow = $langs->trans($valuetoshow); // try to translate + $class = "left"; + if ($fieldlist[$field] == 'code') { $valuetoshow = $langs->trans("Code"); } + if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') { - $valuetoshow=$langs->trans("Label"); + $valuetoshow = $langs->trans("Label"); } - if ($fieldlist[$field]=='country') { + if ($fieldlist[$field] == 'country') { if (in_array('region_id', $fieldlist)) { print ''; continue; } // For region page, we do not show the country input - $valuetoshow=$langs->trans("Country"); + $valuetoshow = $langs->trans("Country"); } - if ($fieldlist[$field]=='country_id') { $valuetoshow=''; } - if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); } + if ($fieldlist[$field] == 'country_id') { $valuetoshow = ''; } + if ($fieldlist[$field] == 'pcg_version' || $fieldlist[$field] == 'fk_pcg_version') { $valuetoshow = $langs->trans("Pcg_version"); } if ($valuetoshow != '') { print ''; } - if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1; + if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1; } print ''; print ""; - $colspan=count($fieldlist)+3; + $colspan = count($fieldlist) + 3; - print ''; // Keep   to have a line with enough height + print ''; // Keep   to have a line with enough height } // List of available values in database dol_syslog("htdocs/admin/dict", LOG_DEBUG); - $resql=$db->query($sql); + $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; $param = '&id='.$id; - if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id; + if ($search_country_id > 0) $param .= '&search_country_id='.$search_country_id; $paramwithsearch = $param; - if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder; - if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield; + if ($sortorder) $paramwithsearch .= '&sortorder='.$sortorder; + if ($sortfield) $paramwithsearch .= '&sortfield='.$sortfield; // There is several pages if ($num > $listlimit) { - print ''; } @@ -570,9 +570,9 @@ if ($id) print ''; foreach ($fieldlist as $field => $value) { - $showfield=1; // By defaut + $showfield = 1; // By defaut - if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; } + if ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') { $showfield = 0; } if ($showfield) { @@ -590,17 +590,17 @@ if ($id) } print ''; print ''; print ''; // Title of lines print ''; - print getTitleFieldOfList($langs->trans("Pcg_version"), 0, $_SERVER["PHP_SELF"], "pcg_version", ($page?'page='.$page.'&':''), $param, '', $sortfield, $sortorder, ''); - print getTitleFieldOfList($langs->trans("Label"), 0, $_SERVER["PHP_SELF"], "label", ($page?'page='.$page.'&':''), $param, '', $sortfield, $sortorder, ''); - print getTitleFieldOfList($langs->trans("Country"), 0, $_SERVER["PHP_SELF"], "country_code", ($page?'page='.$page.'&':''), $param, '', $sortfield, $sortorder, ''); - print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, '', $sortfield, $sortorder, 'center '); + print getTitleFieldOfList($langs->trans("Pcg_version"), 0, $_SERVER["PHP_SELF"], "pcg_version", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, ''); + print getTitleFieldOfList($langs->trans("Label"), 0, $_SERVER["PHP_SELF"], "label", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, ''); + print getTitleFieldOfList($langs->trans("Country"), 0, $_SERVER["PHP_SELF"], "country_code", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, ''); + print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, 'center '); print getTitleFieldOfList(''); print getTitleFieldOfList(''); print ''; @@ -613,81 +613,81 @@ if ($id) $obj = $db->fetch_object($resql); //print_r($obj); print ''; - if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code))) + if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) { print ''; print ''; print ''; print ''; - $tmpaction='edit'; - $parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); - $reshook=$hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks - $error=$hookmanager->error; $errors=$hookmanager->errors; + $tmpaction = 'edit'; + $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); + $reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks + $error = $hookmanager->error; $errors = $hookmanager->errors; if (empty($reshook)) fieldListAccountModel($fieldlist, $obj, $tabname[$id], 'edit'); - print ''; } else { $tmpaction = 'view'; - $parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); - $reshook=$hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks + $parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); + $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks - $error=$hookmanager->error; $errors=$hookmanager->errors; + $error = $hookmanager->error; $errors = $hookmanager->errors; if (empty($reshook)) { foreach ($fieldlist as $field => $value) { - $showfield=1; - $class="left"; - $valuetoshow=$obj->{$fieldlist[$field]}; + $showfield = 1; + $class = "left"; + $valuetoshow = $obj->{$fieldlist[$field]}; if ($value == 'type_template') { - $valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow; + $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow; } if ($value == 'element') { - $valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow; + $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow; } elseif ($value == 'source') { - $valuetoshow = isset($sourceList[$valuetoshow])?$sourceList[$valuetoshow]:$valuetoshow; + $valuetoshow = isset($sourceList[$valuetoshow]) ? $sourceList[$valuetoshow] : $valuetoshow; } - elseif ($valuetoshow=='all') { - $valuetoshow=$langs->trans('All'); + elseif ($valuetoshow == 'all') { + $valuetoshow = $langs->trans('All'); } - elseif ($fieldlist[$field]=='country') { + elseif ($fieldlist[$field] == 'country') { if (empty($obj->country_code)) { - $valuetoshow='-'; + $valuetoshow = '-'; } else { - $key=$langs->trans("Country".strtoupper($obj->country_code)); - $valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country); + $key = $langs->trans("Country".strtoupper($obj->country_code)); + $valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country); } } - elseif ($fieldlist[$field]=='country_id') { - $showfield=0; + elseif ($fieldlist[$field] == 'country_id') { + $showfield = 0; } - $class='tddict'; - if ($fieldlist[$field] == 'tracking') $class.=' tdoverflowauto'; + $class = 'tddict'; + if ($fieldlist[$field] == 'tracking') $class .= ' tdoverflowauto'; // Show value for field if ($showfield) print ''; } } // Can an entry be erased or disabled ? - $iserasable=1;$canbedisabled=1;$canbemodified=1; // true by default + $iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default - $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):''); + $url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : ''); if ($param) $url .= '&'.$param; - $url.='&'; + $url .= '&'; // Active print ''; } elseif ($fieldlist[$field] == 'country_id') { - if (! in_array('country', $fieldlist)) // If there is already a field country, we don't show country_id (avoid duplicate) + if (!in_array('country', $fieldlist)) // If there is already a field country, we don't show country_id (avoid duplicate) { - $country_id = (! empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : 0); + $country_id = (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : 0); print ''; @@ -776,24 +776,24 @@ function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context = if ($fieldlist[$field] == 'type_cdr') print ''; } elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) { - print ''; + print ''; } else { print ''; } } diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 2924feb58eb..f04f17c6e8c 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -153,7 +153,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) if ($value == 'formula' && empty($_POST['formula'])) continue; if ($value == 'range_account' && empty($_POST['range_account'])) continue; if ($value == 'country' || $value == 'country_id') continue; - if (! GETPOSTISSET($value) || GETPOST($value) == '') + if (!GETPOSTISSET($value) || GETPOST($value) == '') { $ok = 0; $fieldnamekey = $listfield[$f]; diff --git a/htdocs/admin/events.php b/htdocs/admin/events.php index 66794cd4210..65a03adc4f1 100644 --- a/htdocs/admin/events.php +++ b/htdocs/admin/events.php @@ -32,13 +32,13 @@ if (!$user->admin) accessforbidden(); // Load translation files required by the page -$langs->loadLangs(array("users","admin","other")); +$langs->loadLangs(array("users", "admin", "other")); -$action=GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'aZ09'); -$securityevent=new Events($db); -$eventstolog=$securityevent->eventstolog; +$securityevent = new Events($db); +$eventstolog = $securityevent->eventstolog; /* @@ -46,13 +46,13 @@ $eventstolog=$securityevent->eventstolog; */ if ($action == "save") { - $i=0; + $i = 0; $db->begin(); foreach ($eventstolog as $key => $arr) { - $param='MAIN_LOGEVENTS_'.$arr['id']; + $param = 'MAIN_LOGEVENTS_'.$arr['id']; if (GETPOST($param, 'alphanohtml')) dolibarr_set_const($db, $param, GETPOST($param, 'alphanohtml'), 'chaine', 0, '', $conf->entity); else dolibarr_del_const($db, $param, $conf->entity); } @@ -67,7 +67,7 @@ if ($action == "save") * View */ -$wikihelp='EN:Setup_Security|FR:Paramétrage_Sécurité|ES:Configuración_Seguridad'; +$wikihelp = 'EN:Setup_Security|FR:Paramétrage_Sécurité|ES:Configuración_Seguridad'; llxHeader('', $langs->trans("Audit"), $wikihelp); //$linkback=''.$langs->trans("BackToModuleList").''; @@ -81,7 +81,7 @@ print ''; print ''; print ''; -$head=security_prepare_head(); +$head = security_prepare_head(); dol_fiche_head($head, 'audit', $langs->trans("Security"), -1); @@ -97,9 +97,9 @@ foreach ($eventstolog as $key => $arr) print ''; print ''; print ''."\n"; } } diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 3aa5927af63..734bd9c88ce 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -333,7 +333,7 @@ if (empty($reshook)) if ($i) $sql .= ", "; $sql .= $field."="; - if (GETPOST($keycode) == '' || ($keycode != 'langcode' && $keycode != 'position' && $keycode != 'private' && ! GETPOST($keycode))) $sql .= "null"; // langcode,... must be '' if not defined so the unique key that include lang will work + if (GETPOST($keycode) == '' || ($keycode != 'langcode' && $keycode != 'position' && $keycode != 'private' && !GETPOST($keycode))) $sql .= "null"; // langcode,... must be '' if not defined so the unique key that include lang will work elseif (GETPOST($keycode) == '0' && $keycode == 'langcode') $sql .= "''"; // langcode must be '' if not defined so the unique key that include lang will work elseif ($keycode == 'content') { $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index cd27ef7b6dc..ef58c1042d4 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; // Load translation files required by the page $langs->loadLangs(array("other", "admin")); -$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button +$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button if (!$user->admin) accessforbidden(); @@ -66,7 +66,7 @@ if (GETPOST("menu_handler")) $menu_handler = GETPOST("menu_handler"); if ($action == 'update') { - if (! $cancel) + if (!$cancel) { $leftmenu = ''; $mainmenu = ''; if (GETPOST('menuIdParent', 'alpha') && !is_numeric(GETPOST('menuIdParent', 'alpha'))) diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php index 77a5e95c3a5..d8c65f9a2c5 100644 --- a/htdocs/admin/oauthlogintokens.php +++ b/htdocs/admin/oauthlogintokens.php @@ -24,7 +24,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php'; // This define $list +require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php'; // This define $list require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; use OAuth\Common\Storage\DoliStorage; @@ -149,7 +149,7 @@ if ($mode == 'setup' && $user->admin) $OAUTH_SERVICENAME = 'GitHub'; // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service). // We pass this param list in to 'state' because we need it before and after the redirect. - $shortscope='user,public_repo'; + $shortscope = 'user,public_repo'; $urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $urltocheckperms = 'https://github.com/settings/applications/'; @@ -159,7 +159,7 @@ if ($mode == 'setup' && $user->admin) $OAUTH_SERVICENAME = 'Google'; // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service). // We pass this param list in to 'state' because we need it before and after the redirect. - $shortscope='userinfo_email,userinfo_profile,cloud_print'; + $shortscope = 'userinfo_email,userinfo_profile,cloud_print'; //$scope.=',gmail_full'; $urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index 07891630c1a..f0ad4352b60 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -29,12 +29,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; // Load translation files required by the page -$langs->loadLangs(array("users","admin","other")); +$langs->loadLangs(array("users", "admin", "other")); -if (! $user->admin) +if (!$user->admin) accessforbidden(); -$action=GETPOST('action', 'alpha'); +$action = GETPOST('action', 'alpha'); @@ -44,8 +44,8 @@ $action=GETPOST('action', 'alpha'); if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) { - $code=$reg[1]; - $value=(GETPOST($code, 'alpha') ? GETPOST($code, 'alpha') : 1); + $code = $reg[1]; + $value = (GETPOST($code, 'alpha') ? GETPOST($code, 'alpha') : 1); if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0) { Header("Location: ".$_SERVER["PHP_SELF"]); @@ -56,7 +56,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) dol_print_error($db); } } elseif (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) { - $code=$reg[1]; + $code = $reg[1]; if (dolibarr_del_const($db, $code, $conf->entity) > 0) { Header("Location: ".$_SERVER["PHP_SELF"]); @@ -70,8 +70,8 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) elseif ($action == 'updateform') { - $res1=dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", GETPOST("MAIN_APPLICATION_TITLE", 'alphanohtml'), 'chaine', 0, '', $conf->entity); - $res2=dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", GETPOST("MAIN_SESSION_TIMEOUT", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + $res1 = dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", GETPOST("MAIN_APPLICATION_TITLE", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + $res2 = dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", GETPOST("MAIN_SESSION_TIMEOUT", 'alphanohtml'), 'chaine', 0, '', $conf->entity); if ($res1 && $res2) setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); } @@ -83,7 +83,7 @@ elseif ($action == 'updateform') $form = new Form($db); -$wikihelp='EN:Setup_Security|FR:Paramétrage_Sécurité|ES:Configuración_Seguridad'; +$wikihelp = 'EN:Setup_Security|FR:Paramétrage_Sécurité|ES:Configuración_Seguridad'; llxHeader('', $langs->trans("Miscellaneous"), $wikihelp); print load_fiche_titre($langs->trans("SecuritySetup"), '', 'title_setup'); @@ -97,7 +97,7 @@ print ''; print ''; print ''; -$head=security_prepare_head(); +$head = security_prepare_head(); dol_fiche_head($head, 'misc', $langs->trans("Security"), -1); @@ -115,7 +115,7 @@ print ''; print ''; print ''; print ''; print ''; print "\n"; -$sessiontimeout=ini_get("session.gc_maxlifetime"); -if (empty($conf->global->MAIN_SESSION_TIMEOUT)) $conf->global->MAIN_SESSION_TIMEOUT=$sessiontimeout; +$sessiontimeout = ini_get("session.gc_maxlifetime"); +if (empty($conf->global->MAIN_SESSION_TIMEOUT)) $conf->global->MAIN_SESSION_TIMEOUT = $sessiontimeout; print ''; print ''; print ''; -$sessiontimeout=ini_get("session.gc_maxlifetime"); -if (empty($conf->global->MAIN_APPLICATION_TITLE)) $conf->global->MAIN_APPLICATION_TITLE=""; +$sessiontimeout = ini_get("session.gc_maxlifetime"); +if (empty($conf->global->MAIN_APPLICATION_TITLE)) $conf->global->MAIN_APPLICATION_TITLE = ""; print ''; print ''; diff --git a/htdocs/admin/spip.php b/htdocs/admin/spip.php index d33728286e9..2ed43e97efd 100644 --- a/htdocs/admin/spip.php +++ b/htdocs/admin/spip.php @@ -35,10 +35,10 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; // Load translation files required by the page $langs->loadLangs(array("admin", "members", "mailmanspip")); -if (! $user->admin) accessforbidden(); +if (!$user->admin) accessforbidden(); -$type=array('yesno','texte','chaine'); +$type = array('yesno', 'texte', 'chaine'); $action = GETPOST('action', 'aZ09'); @@ -58,19 +58,19 @@ if ($action == 'update' || $action == 'add') // Action mise a jour ou ajout d'une constante if ($action == 'update' || $action == 'add') { - foreach($constnamearray as $key => $val) + foreach ($constnamearray as $key => $val) { $constname = dol_escape_htmltag($constnamearray[$key]); $constvalue = dol_escape_htmltag($constvaluearray[$key]); $consttype = dol_escape_htmltag($consttypearray[$key]); $constnote = dol_escape_htmltag($constnotearray[$key]); - $res=dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity); + $res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity); - if (! $res > 0) $error++; + if (!$res > 0) $error++; } - if (! $error) + if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } @@ -84,7 +84,7 @@ if ($action == 'update' || $action == 'add') // Action activation d'un sous module du module adherent if ($action == 'set') { - $result=dolibarr_set_const($db, $_GET["name"], $_GET["value"], '', 0, '', $conf->entity); + $result = dolibarr_set_const($db, $_GET["name"], $_GET["value"], '', 0, '', $conf->entity); if ($result < 0) { dol_print_error($db); @@ -94,7 +94,7 @@ if ($action == 'set') // Action desactivation d'un sous module du module adherent if ($action == 'unset') { - $result=dolibarr_del_const($db, $_GET["name"], $conf->entity); + $result = dolibarr_del_const($db, $_GET["name"], $conf->entity); if ($result < 0) { dol_print_error($db); @@ -107,12 +107,12 @@ if ($action == 'unset') * View */ -$help_url=''; +$help_url = ''; llxHeader('', $langs->trans("MailmanSpipSetup"), $help_url); -$linkback=''.$langs->trans("BackToModuleList").''; +$linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("MailmanSpipSetup"), $linkback, 'title_setup'); @@ -122,7 +122,7 @@ $head = mailmanspip_admin_prepare_head(); /* * Spip */ -if (! empty($conf->global->ADHERENT_USE_SPIP)) +if (!empty($conf->global->ADHERENT_USE_SPIP)) { print ''; print ''; @@ -131,12 +131,12 @@ if (! empty($conf->global->ADHERENT_USE_SPIP)) dol_fiche_head($head, 'spip', $langs->trans("Setup"), -1, 'user'); //$link=img_picto($langs->trans("Active"),'tick').' '; - $link=''; + $link = ''; //$link.=$langs->trans("Disable"); - $link.=img_picto($langs->trans("Activated"), 'switch_on'); - $link.=''; + $link .= img_picto($langs->trans("Activated"), 'switch_on'); + $link .= ''; // Edition des varibales globales - $constantes=array( + $constantes = array( 'ADHERENT_SPIP_SERVEUR', 'ADHERENT_SPIP_DB', 'ADHERENT_SPIP_USER', @@ -158,10 +158,10 @@ else { dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user'); - $link=''; + $link = ''; //$link.=$langs->trans("Activate"); - $link.=img_picto($langs->trans("Disabled"), 'switch_off'); - $link.=''; + $link .= img_picto($langs->trans("Disabled"), 'switch_off'); + $link .= ''; print load_fiche_titre($langs->trans('SPIPTitle'), $link, ''); dol_fiche_end(); diff --git a/htdocs/admin/website.php b/htdocs/admin/website.php index 689b65cc954..2d201421f20 100644 --- a/htdocs/admin/website.php +++ b/htdocs/admin/website.php @@ -34,13 +34,13 @@ require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; // Load translation files required by the page $langs->loadlangs(array('errors', 'admin', 'companies', 'website')); -$action=GETPOST('action', 'alpha')?GETPOST('action', 'alpha'):'view'; -$confirm=GETPOST('confirm', 'alpha'); +$action = GETPOST('action', 'alpha') ?GETPOST('action', 'alpha') : 'view'; +$confirm = GETPOST('confirm', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); -$rowid=GETPOST('rowid', 'alpha'); +$rowid = GETPOST('rowid', 'alpha'); -$id=1; +$id = 1; if (!$user->admin) accessforbidden(); @@ -52,7 +52,7 @@ $actl[1] = img_picto($langs->trans("Activated"), 'switch_on'); $status = 1; // Load variable for pagination -$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha'); $page = GETPOST('page', 'int'); @@ -65,55 +65,55 @@ $pagenext = $page + 1; $hookmanager->initHooks(array('website')); // Name of SQL tables of dictionaries -$tabname=array(); +$tabname = array(); $tabname[1] = MAIN_DB_PREFIX."website"; // Dictionary labels -$tablib=array(); +$tablib = array(); $tablib[1] = "Websites"; // Requests to extract data -$tabsql=array(); +$tabsql = array(); $tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.virtualhost, f.status FROM ".MAIN_DB_PREFIX.'website as f WHERE f.entity IN ('.getEntity('website').')'; // Criteria to sort dictionaries -$tabsqlsort=array(); -$tabsqlsort[1] ="ref ASC"; +$tabsqlsort = array(); +$tabsqlsort[1] = "ref ASC"; // Nom des champs en resultat de select pour affichage du dictionnaire -$tabfield=array(); +$tabfield = array(); $tabfield[1] = "ref,description,virtualhost"; // Nom des champs d'edition pour modification d'un enregistrement -$tabfieldvalue=array(); +$tabfieldvalue = array(); $tabfieldvalue[1] = "ref,description,virtualhost"; // Nom des champs dans la table pour insertion d'un enregistrement -$tabfieldinsert=array(); +$tabfieldinsert = array(); $tabfieldinsert[1] = "ref,description,virtualhost,entity"; // Nom du rowid si le champ n'est pas de type autoincrement // Example: "" if id field is "rowid" and has autoincrement on // "nameoffield" if id field is not "rowid" or has not autoincrement on -$tabrowid=array(); +$tabrowid = array(); $tabrowid[1] = ""; // Condition to show dictionary in setup page -$tabcond=array(); -$tabcond[1] = (! empty($conf->website->enabled)); +$tabcond = array(); +$tabcond[1] = (!empty($conf->website->enabled)); // List of help for fields -$tabhelp=array(); -$tabhelp[1] = array('ref'=>$langs->trans("EnterAnyCode"), 'virtualhost'=>$langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/website/websiteref')); +$tabhelp = array(); +$tabhelp[1] = array('ref'=>$langs->trans("EnterAnyCode"), 'virtualhost'=>$langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/website/websiteref')); // List of check for fields (NOT USED YET) -$tabfieldcheck=array(); -$tabfieldcheck[1] = array(); +$tabfieldcheck = array(); +$tabfieldcheck[1] = array(); // Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact") $elementList = array(); -$sourceList=array(); +$sourceList = array(); /* @@ -123,35 +123,35 @@ $sourceList=array(); // Actions add or modify a website if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { - $listfield=explode(',', $tabfield[$id]); - $listfieldinsert=explode(',', $tabfieldinsert[$id]); - $listfieldmodify=explode(',', $tabfieldinsert[$id]); - $listfieldvalue=explode(',', $tabfieldvalue[$id]); + $listfield = explode(',', $tabfield[$id]); + $listfieldinsert = explode(',', $tabfieldinsert[$id]); + $listfieldmodify = explode(',', $tabfieldinsert[$id]); + $listfieldvalue = explode(',', $tabfieldvalue[$id]); // Check that all fields are filled - $ok=1; + $ok = 1; foreach ($listfield as $f => $value) { - if ($value == 'ref' && (! GETPOSTISSET($value) || GETPOST($value) == '')) + if ($value == 'ref' && (!GETPOSTISSET($value) || GETPOST($value) == '')) { - $ok=0; - $fieldnamekey=$listfield[$f]; + $ok = 0; + $fieldnamekey = $listfield[$f]; setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors'); break; } - elseif ($value == 'ref' && ! preg_match('/^[a-z0-9_\-\.]+$/i', $_POST[$value])) + elseif ($value == 'ref' && !preg_match('/^[a-z0-9_\-\.]+$/i', $_POST[$value])) { - $ok=0; - $fieldnamekey=$listfield[$f]; + $ok = 0; + $fieldnamekey = $listfield[$f]; setEventMessages($langs->transnoentities("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentities($fieldnamekey)), null, 'errors'); break; } } // Clean parameters - if (! empty($_POST['ref'])) + if (!empty($_POST['ref'])) { - $websitekey=strtolower($_POST['ref']); + $websitekey = strtolower($_POST['ref']); } // Si verif ok et action add, on ajoute la ligne @@ -160,13 +160,13 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) if ($tabrowid[$id]) { // Recupere id libre pour insertion - $newid=0; + $newid = 0; $sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id]; $result = $db->query($sql); if ($result) { $obj = $db->fetch_object($result); - $newid=($obj->newid + 1); + $newid = ($obj->newid + 1); } else { dol_print_error($db); } @@ -181,16 +181,16 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) // Add new entry $sql = "INSERT INTO ".$tabname[$id]." ("; // List of fields - if ($tabrowid[$id] && ! in_array($tabrowid[$id], $listfieldinsert)) - $sql.= $tabrowid[$id].","; - $sql.= $tabfieldinsert[$id]; - $sql.=",status)"; - $sql.= " VALUES("; + if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) + $sql .= $tabrowid[$id].","; + $sql .= $tabfieldinsert[$id]; + $sql .= ",status)"; + $sql .= " VALUES("; // List of values - if ($tabrowid[$id] && ! in_array($tabrowid[$id], $listfieldinsert)) - $sql.= $newid.","; - $i=0; + if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) + $sql .= $newid.","; + $i = 0; foreach ($listfieldinsert as $f => $value) { if ($value == 'entity') { @@ -199,19 +199,19 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) if ($value == 'ref') { $_POST[$listfieldvalue[$i]] = strtolower($_POST[$listfieldvalue[$i]]); } - if ($i) $sql.=","; - if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; - else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'"; + if ($i) $sql .= ","; + if ($_POST[$listfieldvalue[$i]] == '') $sql .= "null"; + else $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'"; $i++; } - $sql.=",1)"; + $sql .= ",1)"; dol_syslog("actionadd", LOG_DEBUG); $result = $db->query($sql); if ($result) // Add is ok { setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); - unset($_POST); // Clean $_POST array, we keep only + unset($_POST); // Clean $_POST array, we keep only } else { @@ -227,22 +227,22 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) // Si verif ok et action modify, on modifie la ligne if ($ok && GETPOST('actionmodify', 'alpha')) { - if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } - else { $rowidcol="rowid"; } + if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } + else { $rowidcol = "rowid"; } $db->begin(); - $website=new Website($db); - $rowid=GETPOST('rowid', 'int'); + $website = new Website($db); + $rowid = GETPOST('rowid', 'int'); $website->fetch($rowid); // Modify entry $sql = "UPDATE ".$tabname[$id]." SET "; // Modifie valeur des champs - if ($tabrowid[$id] && ! in_array($tabrowid[$id], $listfieldmodify)) + if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify)) { - $sql.= $tabrowid[$id]."="; - $sql.= "'".$db->escape($rowid)."', "; + $sql .= $tabrowid[$id]."="; + $sql .= "'".$db->escape($rowid)."', "; } $i = 0; foreach ($listfieldmodify as $field) @@ -250,13 +250,13 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) if ($field == 'entity') { $_POST[$listfieldvalue[$i]] = $conf->entity; } - if ($i) $sql.=","; - $sql.= $field."="; - if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; - else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'"; + if ($i) $sql .= ","; + $sql .= $field."="; + if ($_POST[$listfieldvalue[$i]] == '') $sql .= "null"; + else $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'"; $i++; } - $sql.= " WHERE ".$rowidcol." = '".$rowid."'"; + $sql .= " WHERE ".$rowidcol." = '".$rowid."'"; dol_syslog("actionmodify", LOG_DEBUG); //print $sql; @@ -266,8 +266,8 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) $newname = dol_sanitizeFileName(GETPOST('ref', 'aZ09')); if ($newname != $website->ref) { - $srcfile=DOL_DATA_ROOT.'/website/'.$website->ref; - $destfile=DOL_DATA_ROOT.'/website/'.$newname; + $srcfile = DOL_DATA_ROOT.'/website/'.$website->ref; + $destfile = DOL_DATA_ROOT.'/website/'.$newname; if (dol_is_dir($destfile)) { @@ -294,7 +294,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) setEventMessages($db->lasterror(), null, 'errors'); } - if (! $error) + if (!$error) { $db->commit(); } @@ -313,8 +313,8 @@ if (GETPOST('actioncancel', 'alpha')) if ($action == 'confirm_delete' && $confirm == 'yes') // delete { - if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } - else { $rowidcol="rowid"; } + if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } + else { $rowidcol = "rowid"; } $website = new Website($db); $website->fetch($rowid); @@ -332,7 +332,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete $sql = "DELETE from ".MAIN_DB_PREFIX."website WHERE rowid ='".$rowid."'"; $result = $db->query($sql); - if (! $result) + if (!$result) { if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') { @@ -358,8 +358,8 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete // activate if ($action == $acts[0]) { - if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } - else { $rowidcol="rowid"; } + if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } + else { $rowidcol = "rowid"; } if ($rowid) { $sql = "UPDATE ".$tabname[$id]." SET status = 1 WHERE rowid ='".$rowid."'"; @@ -375,8 +375,8 @@ if ($action == $acts[0]) // disable if ($action == $acts[1]) { - if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } - else { $rowidcol="rowid"; } + if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } + else { $rowidcol = "rowid"; } if ($rowid) { $sql = "UPDATE ".$tabname[$id]." SET status = 0 WHERE rowid ='".$rowid."'"; @@ -396,16 +396,16 @@ if ($action == $acts[1]) */ $form = new Form($db); -$formadmin=new FormAdmin($db); +$formadmin = new FormAdmin($db); llxHeader('', $langs->trans("WebsiteSetup")); -$titre=$langs->trans("WebsiteSetup"); -$linkback=''.$langs->trans("BackToModuleList").''; +$titre = $langs->trans("WebsiteSetup"); +$linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($titre, $linkback, 'title_setup'); // Onglets -$head=array(); +$head = array(); $h = 0; $head[$h][0] = DOL_URL_ROOT."/admin/website.php"; @@ -428,7 +428,7 @@ print "
\n"; // Confirmation de la suppression de la ligne if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid, $langs->trans('DeleteWebsite'), $langs->trans('ConfirmDeleteWebsite'), 'confirm_delete', '', 0, 1); + print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid, $langs->trans('DeleteWebsite'), $langs->trans('ConfirmDeleteWebsite'), 'confirm_delete', '', 0, 1); } //var_dump($elementList); @@ -438,12 +438,12 @@ if ($action == 'delete') if ($id) { // Complete requete recherche valeurs avec critere de tri - $sql=$tabsql[$id]; - $sql.=$db->order($sortfield, $sortorder); - $sql.=$db->plimit($limit+1, $offset); + $sql = $tabsql[$id]; + $sql .= $db->order($sortfield, $sortorder); + $sql .= $db->plimit($limit + 1, $offset); //print $sql; - $fieldlist=explode(',', $tabfield[$id]); + $fieldlist = explode(',', $tabfield[$id]); print ''; print ''; @@ -452,10 +452,10 @@ if ($id) // Form to add a new line if ($tabname[$id]) { - $alabelisused=0; - $var=false; + $alabelisused = 0; + $var = false; - $fieldlist=explode(',', $tabfield[$id]); + $fieldlist = explode(',', $tabfield[$id]); // Line for title print ''; @@ -463,15 +463,15 @@ if ($id) { // Determine le nom du champ par rapport aux noms possibles // dans les dictionnaires de donnees - $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut - $valuetoshow=$langs->trans($valuetoshow); // try to translate - $align=''; - if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); } + $valuetoshow = ucfirst($fieldlist[$field]); // Par defaut + $valuetoshow = $langs->trans($valuetoshow); // try to translate + $align = ''; + if ($fieldlist[$field] == 'lang') { $valuetoshow = $langs->trans("Language"); } if ($valuetoshow != '') { print ''; } - if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1; + if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1; } print ''; print ""; - $colspan=count($fieldlist)+2; + $colspan = count($fieldlist) + 2; } print '
- - +
Date et signature

+ From d1652ee9e308eacc57f3de619aa74a16e4762e2a Mon Sep 17 00:00:00 2001 From: oscim Date: Mon, 17 Feb 2020 11:18:34 +0100 Subject: [PATCH 668/784] Update bank.php For authorize line manager to see wages paid --- htdocs/user/bank.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 188a6b59d31..9ff7bd56634 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -289,7 +289,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco * Last salaries */ if (!empty($conf->salaries->enabled) && - ($user->rights->salaries->read && $object->id == $user->id) + ( ($object->fk_user == $user->id) || ($user->rights->salaries->read && $object->id == $user->id) ) ) { $salary = new PaymentSalary($db); From bf281b7dabd1d398a953ffb17ba2688a151d0197 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Feb 2020 11:51:49 +0100 Subject: [PATCH 669/784] Comment --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 681fc28f92a..d2de83c18ce 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -817,7 +817,7 @@ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0) * With native = 1: Use PHP clone. Property that are reference are same pointer. This means $this->db of new object is still valid but point to same this->db than original object. * * @param object $object Object to clone - * @param int $native Native method or full isolation method + * @param int $native 0=Full isolation method, 1=Native PHP method * @return object Clone object * @see https://php.net/manual/language.oop5.cloning.php */ From 523d09536c4e710db05daee7e2a8d168f6cdebbb Mon Sep 17 00:00:00 2001 From: gauthier Date: Mon, 17 Feb 2020 12:20:19 +0100 Subject: [PATCH 670/784] FIX : must be == and not = --- htdocs/product/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 565cb6f7565..ebf9c093c02 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1174,7 +1174,7 @@ else // Accountancy_code_sell print ''; print ''; // Name From 6555f5d74f1933c0ef2743f09ccaa571cb23b7ca Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Feb 2020 20:55:17 +0100 Subject: [PATCH 683/784] More default hmtl tags in restricthtmlonly --- htdocs/core/lib/functions.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f7976904e10..431e0f0dadc 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5591,8 +5591,8 @@ function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto = function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1) { $allowed_tags = array( - "html", "head", "meta", "body", "article", "a", "b", "br", "div", "dl", "dd", "dt", "em", "font", "img", "ins", "hr", "i", "li", "link", - "ol", "p", "s", "section", "span", "strong", "title", + "html", "head", "meta", "body", "article", "a", "abbr", "b", "blockquote", "br", "cite", "div", "dl", "dd", "dt", "em", "font", "img", "ins", "hr", "i", "li", "link", + "ol", "p", "q", "s", "section", "span", "strike", "strong", "title", "table", "tr", "th", "td", "u", "ul" ); $allowed_tags_string = join("><", $allowed_tags); From 1d760f0e42f65c79ea74c5e344b61f80c4ae4640 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Feb 2020 21:24:59 +0100 Subject: [PATCH 684/784] Add MO in project overwiew --- htdocs/langs/en_US/projects.lang | 1 + htdocs/mrp/class/mo.class.php | 1 + htdocs/projet/class/project.class.php | 2 +- htdocs/projet/element.php | 21 +++++++++++++++++++-- htdocs/theme/eldy/theme_vars.inc.php | 2 +- 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 14d0e9d2b19..508087f85d2 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -104,6 +104,7 @@ ListDonationsAssociatedProject=List of donations related to the project ListVariousPaymentsAssociatedProject=List of miscellaneous payments related to the project ListSalariesAssociatedProject=List of payments of salaries related to the project ListActionsAssociatedProject=List of events related to the project +ListMOAssociatedProject=List of manufacturing orders related to the project ListTaskTimeUserProject=List of time consumed on tasks of project ListTaskTimeForTask=List of time consumed on task ActivityOnProjectToday=Activity on project today diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 9e9b317196e..ebbe5950f13 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -106,6 +106,7 @@ class Mo extends CommonObject 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62, 'notnull'=>-1,), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>-1,), + 'date_valid' => array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>2, 'position'=>502,), 'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'user.rowid',), 'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,), 'date_start_planned' => array('type'=>'datetime', 'label'=>'DateStartPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'notnull'=>-1, 'index'=>1, 'help'=>'KeepEmptyForAsap'), diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 10e091e1244..74c82423966 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -700,7 +700,7 @@ class Project extends CommonObject 'propal'=>'fk_projet', 'commande'=>'fk_projet', 'facture'=>'fk_projet', 'supplier_proposal'=>'fk_projet', 'commande_fournisseur'=>'fk_projet', 'facture_fourn'=>'fk_projet', 'expensereport_det'=>'fk_projet', 'contrat'=>'fk_projet', 'fichinter'=>'fk_projet', 'don'=>'fk_projet', - 'actioncomm'=>'fk_project' + 'actioncomm'=>'fk_project', 'mo'=>'fk_project' ); foreach ($listoftables as $key => $value) { diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index cfc01f85a5f..f944114e43c 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -55,6 +55,7 @@ if (!empty($conf->tax->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/socia if (!empty($conf->banque->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php'; if (!empty($conf->salaries->enabled)) require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php'; if (!empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +if (!empty($conf->mrp->enabled)) require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; // Load translation files required by the page $langs->loadLangs(array('projects', 'companies', 'suppliers', 'compta')); @@ -67,6 +68,7 @@ if (!empty($conf->expensereport->enabled)) $langs->load("trips"); if (!empty($conf->don->enabled)) $langs->load("donations"); if (!empty($conf->loan->enabled)) $langs->load("loan"); if (!empty($conf->salaries->enabled)) $langs->load("salaries"); +if (!empty($conf->mrp->enabled)) $langs->load("mrp"); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); @@ -384,6 +386,18 @@ $listofreferent = array( 'buttonnew'=>'CreateShipment', 'testnew'=>0, 'test'=>$conf->expedition->enabled && $user->rights->expedition->lire), +'mrp'=>array( + 'name'=>"MO", + 'title'=>"ListMOAssociatedProject", + 'class'=>'Mo', + 'table'=>'mrp_mo', + 'datefieldname'=>'date_valid', + 'urlnew'=>DOL_URL_ROOT.'/mrp/mo_card.php?action=create&origin=project&originid='.$id.'&socid='.$socid, + 'lang'=>'mrp', + 'buttonnew'=>'CreateMO', + 'testnew'=>'$user->rights->mrp->write', + 'project_field'=>'fk_project', + 'test'=>$conf->mrp->enabled && $user->rights->mrp->read), 'trip'=>array( 'name'=>"TripsAndExpenses", 'title'=>"ListExpenseReportsAssociatedProject", @@ -829,7 +843,7 @@ foreach ($listofreferent as $key => $value) $addform .= '
'; if ($testnew) $addform .= ''.($buttonnew ? $langs->trans($buttonnew) : $langs->trans("Create")).''; elseif (empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)) { - $addform .= ''.($buttonnew ? $langs->trans($buttonnew) : $langs->trans("Create")).''; + $addform .= ''.($buttonnew ? $langs->trans($buttonnew) : $langs->trans("Create")).''; } $addform .= '
'; } @@ -1015,10 +1029,13 @@ foreach ($listofreferent as $key => $value) elseif ($tablename == 'fichinter') $date = $element->datev; // There is no other date for this elseif ($tablename == 'projet_task') $date = ''; // We show no date. Showing date of beginning of task make user think it is date of time consumed else - { + { $date = $element->date; // invoice, ... if (empty($date)) $date = $element->date_contrat; if (empty($date)) $date = $element->datev; + if (empty($date) && !empty($datefieldname)) { + $date = $element->$datefieldname; + } } } elseif ($key == 'loan') { diff --git a/htdocs/theme/eldy/theme_vars.inc.php b/htdocs/theme/eldy/theme_vars.inc.php index 61c5a53672e..f4e207143be 100644 --- a/htdocs/theme/eldy/theme_vars.inc.php +++ b/htdocs/theme/eldy/theme_vars.inc.php @@ -55,7 +55,7 @@ $theme_bgcoloronglet = array(hexdec('DE'), hexdec('E7'), hexdec('EC')); // Colors $colorbackhmenu1 = '55,61,90'; // topmenu $colorbackvmenu1 = '250,250,250'; // vmenu -$colortopbordertitle1 = '200,200,200'; // top border of title +$colortopbordertitle1 = '215,215,215'; // top border of title $colorbacktitle1 = '233,234,237'; // title of tables,list $colorbacktabcard1 = '255,255,255'; // card $colorbacktabactive = '234,234,234'; From 7b4c674bdc4ee9f5e6e9ff09693e453f108242ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Feb 2020 21:43:53 +0100 Subject: [PATCH 685/784] Fix css --- htdocs/projet/element.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 10137156233..46cf12356c5 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -829,7 +829,7 @@ foreach ($listofreferent as $key => $value) $addform.='
'; if ($testnew) $addform.=''.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).''; elseif (empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)) { - $addform.=''.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).''; + $addform.=''.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).''; } $addform.='
'; } From 49dd8e30aae0005ce4c8cc540af612ed71db3a5c Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Tue, 18 Feb 2020 08:28:39 +0100 Subject: [PATCH 686/784] Fix not display data --- htdocs/comm/index.php | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 651d2c54ec7..c374120c8d2 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2020 Pierre Ardoin * * 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 @@ -141,6 +142,9 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) $sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; $sql.= ", s.code_client"; + $sql.= ", s.email"; + $sql.= ", s.entity"; + $sql.= ", s.code_compta"; $sql.= " FROM ".MAIN_DB_PREFIX."propal as p"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -184,6 +188,9 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) $companystatic->client=$obj->client; $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; + $companystatic->entity = $obj->entity; + $companystatic->email = $obj->email; + $companystatic->code_compta = $obj->code_compta; $companystatic->canvas=$obj->canvas; print $companystatic->getNomUrl(1, 'customer', 16); print ''; @@ -226,6 +233,8 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos $sql = "SELECT p.rowid, p.ref, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; $sql.= ", s.code_client"; + $sql.= ", s.entity"; + $sql.= ", s.email"; $sql.= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -268,6 +277,8 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos $companystatic->client=$obj->client; $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; + $companystatic->entity = $obj->entity; + $companystatic->email = $obj->email; $companystatic->canvas=$obj->canvas; print $companystatic->getNomUrl(1, 'supplier', 16); print ''; @@ -308,6 +319,9 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) $sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.tva as total_tva, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; $sql.= ", s.code_client"; + $sql.= ", s.email"; + $sql.= ", s.entity"; + $sql.= ", s.code_compta"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as c"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -350,6 +364,9 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) $companystatic->client=$obj->client; $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; + $companystatic->canvas=$obj->canvas; + $companystatic->email=$obj->email; + $companystatic->entity=$obj->entity; $companystatic->canvas=$obj->canvas; print $companystatic->getNomUrl(1, 'customer', 16); print ''; @@ -398,6 +415,8 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande $sql = "SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; $sql.= ", s.code_client"; $sql.= ", s.code_fournisseur"; + $sql.= ", s.entity"; + $sql.= ", s.email"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -441,6 +460,8 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande $companystatic->client=$obj->client; $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; + $companystatic->entity=$obj->entity; + $companystatic->email=$obj->email; $companystatic->canvas=$obj->canvas; print $companystatic->getNomUrl(1, 'supplier', 16); print ''; @@ -492,6 +513,9 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire) $sql = "SELECT s.rowid, s.nom as name, s.client, s.datec, s.tms, s.canvas"; $sql.= ", s.code_client"; + $sql.= ", s.code_compta"; + $sql.= ", s.entity"; + $sql.= ", s.email"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.client IN (1, 2, 3)"; @@ -527,6 +551,9 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire) $companystatic->client=$objp->client; $companystatic->code_client = $objp->code_client; $companystatic->code_fournisseur = $objp->code_fournisseur; + $companystatic->code_compta = $objp->code_compta; + $companystatic->entity = $objp->entity; + $companystatic->email = $objp->email; $companystatic->canvas=$objp->canvas; print '
'; print ''; @@ -556,6 +583,8 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->societe->lire) $sql = "SELECT s.nom as name, s.rowid, s.datec as dc, s.canvas, s.tms as dm"; $sql.= ", s.code_fournisseur"; + $sql.= ", s.entity"; + $sql.= ", s.email"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.fournisseur = 1"; @@ -586,6 +615,8 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->societe->lire) $companystatic->name=$objp->name; $companystatic->code_client = $objp->code_client; $companystatic->code_fournisseur = $objp->code_fournisseur; + $companystatic->entity = $objp->entity; + $companystatic->email = $objp->email; $companystatic->canvas=$objp->canvas; print ''; print ''; @@ -632,6 +663,8 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TO $sql = "SELECT s.nom as name, s.rowid, s.canvas, "; $sql.= ", s.code_client"; + $sql.= ", s.entity"; + $sql.= ", s.email"; $sql.= " c.statut, c.rowid as contratid, p.ref, c.mise_en_service as datemes, c.fin_validite as datefin, c.date_cloture as dateclo"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."contrat as c"; @@ -668,6 +701,8 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TO $companystatic->name=$objp->name; $companystatic->code_client = $objp->code_client; $companystatic->code_fournisseur = $objp->code_fournisseur; + $companystatic->entity = $objp->entity; + $companystatic->email = $objp->email; $companystatic->canvas=$objp->canvas; print $companystatic->getNomUrl(1, 'customer', 44); print ''."\n"; @@ -693,6 +728,8 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) $langs->load("propal"); $sql = "SELECT s.nom as name, s.rowid, s.code_client"; + $sql.= ", s.entity"; + $sql.= ", s.email"; $sql.= ", p.rowid as propalid, p.entity, p.total as total_ttc, p.total_ht, p.tva as total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."propal as p"; @@ -755,6 +792,8 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) $companystatic->client=$obj->client; $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; + $companystatic->entity = $objp->entity; + $companystatic->email = $objp->email; $companystatic->canvas=$obj->canvas; print $companystatic->getNomUrl(1, 'customer', 44); print ''; @@ -798,6 +837,8 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) $sql = "SELECT s.nom as name, s.rowid, c.rowid as commandeid, c.total_ttc, c.total_ht, c.tva as total_tva, c.ref, c.ref_client, c.fk_statut, c.date_valid as dv, c.facture as billed"; $sql.= ", s.code_client"; + $sql.= ", s.entity"; + $sql.= ", s.email"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."commande as c"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -859,6 +900,8 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) $companystatic->client=$obj->client; $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; + $companystatic->entity = $objp->entity; + $companystatic->email = $objp->email; $companystatic->canvas=$obj->canvas; print $companystatic->getNomUrl(1, 'customer', 44); print ''; From f6f0d9d4a214aac173d64019d556b8dd9baea5f1 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 18 Feb 2020 08:35:51 +0100 Subject: [PATCH 687/784] FIX better method to check user rights AND usergroup rights ! --- htdocs/fourn/commande/index.php | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index 39855ea7500..1c4e0aad9e4 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -251,8 +251,6 @@ if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY } $sql.= " u.rowid, u.lastname, u.firstname, u.email"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; -$sql.= ",".MAIN_DB_PREFIX."user_rights as ur"; -$sql.= ",".MAIN_DB_PREFIX."rights_def as rd"; if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { $sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug"; @@ -263,13 +261,7 @@ if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY else { $sql.= " WHERE (u.entity IN (".getEntity('user').")"; - $sql.= " AND ur.entity = ".$conf->entity.")"; } -$sql.= " AND u.rowid = ur.fk_user"; -$sql.= " AND ur.fk_id = rd.id"; -$sql.= " AND module = 'fournisseur'"; -$sql.= " AND perms = 'commande'"; -$sql.= " AND subperms = 'approuver'"; $resql = $db->query($sql); if ($resql) @@ -285,15 +277,22 @@ if ($resql) { $obj = $db->fetch_object($resql); - print ''; - print ''; - print "\n"; + $userstatic = new User($db); + $userstatic->id = $obj->rowid; + $userstatic->getrights('fournisseur'); + + if (! empty($userstatic->rights->fournisseur->commande->approuver)) + { + print ''; + print ''; + print "\n"; + } + $i++; } print "
Date et signature
'; + $CodeDon = ''; } else { - $CodeDon = ''; + $CodeDon = ''; } */ @@ -204,7 +204,7 @@ class html_cerfafr extends ModeleDon $form = str_replace('__ModePaiement__', $ModePaiement, $form); $frencharticle=''; - if (preg_match('/fr/i', $outputlangs->defaultlang)) $frencharticle='Article 200, 238 bis et 885-0 V bis A du code général des impôts (CGI)'; + if (preg_match('/fr/i', $outputlangs->defaultlang)) $frencharticle='Article 200, 238 bis et 978 du code général des impôts (CGI)'; $form = str_replace('__FrenchArticle__', $frencharticle, $form); $frencheligibility=''; @@ -237,18 +237,18 @@ class html_cerfafr extends ModeleDon } $form = str_replace('__ARTICLE238__', $art238, $form); - $art885=''; + $art978=''; if (preg_match('/fr/i', $outputlangs->defaultlang)) { - if ($conf->global->DONATION_ART885 >= 1) + if ($conf->global->DONATION_ART978 >= 1) { - $art885='885-0 V bis du CGI'; + $art978='978 du CGI'; } else { - $art885='885-0 V bis du CGI'; + $art978='978 du CGI'; } } - $form = str_replace('__ARTICLE885__', $art885, $form); + $form = str_replace('__ARTICLE978__', $art978, $form); // Save file on disk dol_syslog("html_cerfafr::write_file $file"); diff --git a/htdocs/core/modules/modDon.class.php b/htdocs/core/modules/modDon.class.php index 42b4a8ef2b2..f4999f309c2 100644 --- a/htdocs/core/modules/modDon.class.php +++ b/htdocs/core/modules/modDon.class.php @@ -91,10 +91,10 @@ class modDon extends DolibarrModules $this->const[$r][4] = 0; $r++; - $this->const[$r][0] = "DONATION_ART885"; + $this->const[$r][0] = "DONATION_ART978"; $this->const[$r][1] = "yesno"; $this->const[$r][2] = "0"; - $this->const[$r][3] = 'Option Française - Eligibilité Art885-0 V bis du CGI'; + $this->const[$r][3] = 'Option Française - Eligibilité Art978 du CGI'; $this->const[$r][4] = 0; $r++; diff --git a/htdocs/don/admin/donation.php b/htdocs/don/admin/donation.php index 9387c1a099d..e8e7fa4f5b9 100644 --- a/htdocs/don/admin/donation.php +++ b/htdocs/don/admin/donation.php @@ -2,9 +2,9 @@ /* Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2012-2015 Juanjo Menent * Copyright (C) 2013-2017 Philippe Grand - * Copyright (C) 2015-2017 Alexandre Spangaro + * Copyright (C) 2015-2020 Alexandre Spangaro * Copyright (C) 2015 Benoit Bruchard - * Copyright (C) 2019 Thibault FOUCART + * Copyright (C) 2019 Thibault FOUCART * * 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 @@ -431,13 +431,13 @@ if (preg_match('/fr/i', $conf->global->MAIN_INFO_SOCIETE_COUNTRY)) print ''; print ''; - print ''; + print ''; print ''; print "
diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php index bcda35459f6..01ebd673041 100644 --- a/htdocs/core/modules/dons/html_cerfafr.modules.php +++ b/htdocs/core/modules/dons/html_cerfafr.modules.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2006 Laurent Destailleur * Copyright (C) 2012 Regis Houssin * Copyright (C) 2012 Marcos García - * Copyright (C) 2014-2015 Alexandre Spangaro + * Copyright (C) 2014-2020 Alexandre Spangaro * Copyright (C) 2015 Benoit Bruchard * * This program is free software; you can redistribute it and/or modify @@ -46,7 +46,7 @@ class html_cerfafr extends ModeleDon $this->db = $db; $this->name = "cerfafr"; - $this->description = $langs->trans('DonationsReceiptModel').' - fr_FR - Cerfa 11580*03'; + $this->description = $langs->trans('DonationsReceiptModel').' - fr_FR - Cerfa 11580*04'; // Dimension page for size A4 $this->type = 'html'; @@ -150,11 +150,11 @@ class html_cerfafr extends ModeleDon /* if (empty($don->societe)) { - $CodeDon = ' 200 du CGI 238 bis du CGI 885-0 V bis A du CGI 200 du CGI 238 bis du CGI 978 du CGI 200 du CGI 238 bis du CGI 885-0 V bis A du CGI 200 du CGI 238 bis du CGI 978 du CGI
'.$langs->trans("DONATION_ART885").''.$langs->trans("DONATION_ART978").''; if ($conf->use_javascript_ajax) { - print ajax_constantonoff('DONATION_ART885'); + print ajax_constantonoff('DONATION_ART978'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("DONATION_ART885", $arrval, $conf->global->DONATION_ART885); + print $form->selectarray("DONATION_ART978", $arrval, $conf->global->DONATION_ART978); } print '
\n"; diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index d13e4a19d00..fe0c74e6e85 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -161,3 +161,4 @@ INSERT INTO llx_c_ticket_resolution (code, pos, label, active, use_default, desc INSERT INTO llx_c_ticket_resolution (code, pos, label, active, use_default, description) VALUES('CANCELED', '50', 'Canceled', 1, 0, NULL); INSERT INTO llx_c_ticket_resolution (code, pos, label, active, use_default, description) VALUES('OTHER', '90', 'Other', 1, 0, NULL); +DELETE FROM llx_const WHERE name = __ENCRYPT('DONATION_ART885')__; \ No newline at end of file From aa9d00c62e84a672e4de2713050dfc72d894a259 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 17 Feb 2020 07:47:08 +0100 Subject: [PATCH 667/784] FIX --- htdocs/core/modules/dons/html_cerfafr.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/dons/html_cerfafr.html b/htdocs/core/modules/dons/html_cerfafr.html index 75e046bf565..4c5b69aadb8 100644 --- a/htdocs/core/modules/dons/html_cerfafr.html +++ b/htdocs/core/modules/dons/html_cerfafr.html @@ -22,7 +22,7 @@
- - +
+
N° 11580*04
DGFIP @@ -152,7 +152,7 @@
Autres organisme : ………………………………………………………………………………………………Autres organismes : ………………………………………………………………………………………………
'.$langs->trans("ProductAccountancySellCode").''; - if($type = 0) { + if($type == 0) { $accountancy_code_sell = (GETPOST('accountancy_code_sell', 'alpha')?(GETPOST('accountancy_code_sell', 'alpha')):$conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT); } else { $accountancy_code_sell = (GETPOST('accountancy_code_sell', 'alpha')?(GETPOST('accountancy_code_sell', 'alpha')):$conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT); From a02f5cde9246b528557304df2cbfee1379e6b412 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Feb 2020 12:21:07 +0100 Subject: [PATCH 671/784] FIX Type of contact for event does not exists and not supported FIX Type of contact not saved when creating a contact FIX SQL Overload in default contact trigger. FIX Trigger name PROPAL_SUPPLIER_TRIGGER into PROPOSAL_SUPPLIER_TRIGGER --- htdocs/contact/card.php | 2 + htdocs/contact/class/contact.class.php | 6 +- htdocs/core/class/commonobject.class.php | 34 +++++---- htdocs/core/class/html.formcompany.class.php | 2 +- ...rface_90_modSociete_ContactRoles.class.php | 70 ++++++++++--------- htdocs/langs/en_US/main.lang | 2 +- .../class/supplier_proposal.class.php | 2 +- 7 files changed, 67 insertions(+), 51 deletions(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index f1491d73bf4..bc680c5250a 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -218,6 +218,8 @@ if (empty($reshook)) $object->priv = GETPOST("priv", 'int'); $object->note_public = GETPOST("note_public", 'none'); $object->note_private = GETPOST("note_private", 'none'); + $object->roles = GETPOST("roles", 'array'); + $object->statut = 1; //Defult status to Actif // Note: Correct date should be completed with location to have exact GM time of birth. diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index c8fca10fee4..381dd8f13de 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -358,7 +358,7 @@ class Contact extends CommonObject if (!$error) { - $result = $this->update($this->id, $user, 1, 'add'); + $result = $this->update($this->id, $user, 1, 'add'); // This include updateRoles(), ... if ($result < 0) { $error++; @@ -1643,6 +1643,10 @@ class Contact extends CommonObject { $tab = array(); + if ($element == 'action') { + $element = 'agenda'; + } + $sql = "SELECT sc.fk_socpeople as id, sc.fk_c_type_contact"; $sql .= " FROM ".MAIN_DB_PREFIX."c_type_contact tc"; $sql .= ", ".MAIN_DB_PREFIX."societe_contacts sc"; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index fdedc7b733b..57ecf509c08 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1265,14 +1265,15 @@ abstract class CommonObject /** * Return array with list of possible values for type of contacts * - * @param string $source 'internal', 'external' or 'all' - * @param int $option 0=Return array id->label, 1=Return array code->label - * @param int $activeonly 0=all status of contact, 1=only the active - * @param string $code Type of contact (Example: 'CUSTOMER', 'SERVICE') - * @param string $element Filter Element Type - * @return array Array list of type of contacts (id->label if option=0, code->label if option=1) + * @param string $source 'internal', 'external' or 'all' + * @param int $option 0=Return array id->label, 1=Return array code->label + * @param int $activeonly 0=all status of contact, 1=only the active + * @param string $code Type of contact (Example: 'CUSTOMER', 'SERVICE') + * @param string $element Filter on 1 element type + * @param string $excludeelement Exclude 1 element type. Example: 'agenda' + * @return array Array list of type of contacts (id->label if option=0, code->label if option=1) */ - public function listeTypeContacts($source = 'internal', $option = 0, $activeonly = 0, $code = '', $element = '') + public function listeTypeContacts($source = 'internal', $option = 0, $activeonly = 0, $code = '', $element = '', $excludeelement = '') { // phpcs:enable global $langs, $conf; @@ -1283,8 +1284,12 @@ abstract class CommonObject $sql .= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc"; $sqlWhere = array(); - if (!empty($element)) + if (!empty($element)) { $sqlWhere[] = " tc.element='".$this->db->escape($element)."'"; + } + if (!empty($excludeelement)) { + $sqlWhere[] = " tc.element <> '".$this->db->escape($excludeelement)."'"; + } if ($activeonly == 1) $sqlWhere[] = " tc.active=1"; // only the active types @@ -1307,18 +1312,19 @@ abstract class CommonObject $num = $this->db->num_rows($resql); if ($num > 0) { while ($obj = $this->db->fetch_object($resql)) { + $modulename = $obj->element; if (strpos($obj->element, 'project') !== false) { - $element = 'projet'; + $modulename = 'projet'; } elseif ($obj->element == 'contrat') { $element = 'contract'; + } elseif ($obj->element == 'action') { + $modulename = 'agenda'; } elseif (strpos($obj->element, 'supplier') !== false && $obj->element != 'supplier_proposal') { - $element = 'fournisseur'; + $modulename = 'fournisseur'; } elseif (strpos($obj->element, 'supplier') !== false && $obj->element != 'supplier_proposal') { - $element = 'fournisseur'; - } else { - $element = $obj->element; + $modulename = 'fournisseur'; } - if ($conf->{$element}->enabled) { + if ($conf->{$modulename}->enabled) { $libelle_element = $langs->trans('ContactDefault_'.$obj->element); $transkey = "TypeContact_".$this->element."_".$source."_".$obj->code; $libelle_type = ($langs->trans($transkey) != $transkey ? $langs->trans($transkey) : $obj->libelle); diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index a08694560ec..df9d4798c63 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -767,7 +767,7 @@ class FormCompany extends Form if ($rendermode === 'edit') { - $contactType = $contact->listeTypeContacts('external', '', 1); + $contactType = $contact->listeTypeContacts('external', '', 1, '', '', 'agenda'); // We exclude agenda as there is no contact on such element if (count($selected) > 0) { $newselected = array(); foreach ($selected as $key=>$val) { diff --git a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php index b50008dba2e..e22411ac180 100644 --- a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php +++ b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php @@ -66,48 +66,52 @@ class InterfaceContactRoles extends DolibarrTriggers public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { - if ($action === 'PROPAL_CREATE' || $action === 'ORDER_CREATE' || $action === 'BILL_CREATE' || $action === 'ORDER_SUPPLIER_CREATE' || $action === 'BILL_SUPPLIER_CREATE' - || $action === 'CONTRACT_CREATE' || $action === 'FICHINTER_CREATE' || $action === 'PROJECT_CREATE' || $action === 'TICKET_CREATE' || $action === 'ACTION_CREATE') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + if ($action === 'PROPAL_CREATE' || $action === 'ORDER_CREATE' || $action === 'BILL_CREATE' + || $action === 'ORDER_SUPPLIER_CREATE' || $action === 'BILL_SUPPLIER_CREATE' || $action === 'PROPOSAL_SUPPLIER_CREATE' + || $action === 'CONTRACT_CREATE' || $action === 'FICHINTER_CREATE' || $action === 'PROJECT_CREATE' || $action === 'TICKET_CREATE') { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $socid=(property_exists($object, 'socid')?$object->socid:$object->fk_soc); + $socid = (property_exists($object, 'socid') ? $object->socid : $object->fk_soc); - if (! empty($socid) && $socid > 0) { - require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; - $contactdefault = new Contact($this->db); - $contactdefault->socid=$socid; - $TContact = $contactdefault->getContactRoles($object->element); + if (! empty($socid) && $socid > 0) { + require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; + $contactdefault = new Contact($this->db); + $contactdefault->socid = $socid; + $TContact = $contactdefault->getContactRoles($object->element); - $TContactAlreadyLinked = array(); - if ($object->id > 0) - { - $class = get_class($object); - $cloneFrom = new $class($this->db); - $r = $cloneFrom->fetch($object->id); + if (is_array($TContact) && ! empty($TContact)) + { + $TContactAlreadyLinked = array(); + if ($object->id > 0) + { + /* $class = get_class($object); + $cloneFrom = new $class($this->db); + $r = $cloneFrom->fetch($object->id); */ + $cloneFrom = dol_clone($object, 1); - if (!empty($cloneFrom->id)) $TContactAlreadyLinked = array_merge($cloneFrom->liste_contact(-1, 'external'), $cloneFrom->liste_contact(-1, 'internal')); - } - - if (is_array($TContact)) - { - foreach($TContact as $i => $infos) { - foreach ($TContactAlreadyLinked as $contactData) { - if ($contactData['id'] == $infos['fk_socpeople'] && $contactData['fk_c_type_contact'] == $infos['type_contact']) unset($TContact[$i]); + if (!empty($cloneFrom->id)) { + $TContactAlreadyLinked = array_merge($cloneFrom->liste_contact(-1, 'external'), $cloneFrom->liste_contact(-1, 'internal')); + } } - } - $nb = 0; - foreach($TContact as $infos) { - $res = $object->add_contact($infos['fk_socpeople'], $infos['type_contact']); - if ($res > 0) $nb++; - } + foreach($TContact as $i => $infos) { + foreach ($TContactAlreadyLinked as $contactData) { + if ($contactData['id'] == $infos['fk_socpeople'] && $contactData['fk_c_type_contact'] == $infos['type_contact']) unset($TContact[$i]); + } + } - if($nb > 0) { - setEventMessages($langs->trans('ContactAddedAutomatically', $nb), null, 'mesgs'); + $nb = 0; + foreach($TContact as $infos) { + $res = $object->add_contact($infos['fk_socpeople'], $infos['type_contact']); + if ($res > 0) $nb++; + } + + if($nb > 0) { + setEventMessages($langs->trans('ContactAddedAutomatically', $nb), null, 'mesgs'); + } } } } - } - return 0; + return 0; } } diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 3054b813f72..958cb6e5487 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1010,7 +1010,7 @@ ContactDefault_project=Project ContactDefault_project_task=Task ContactDefault_propal=Proposal ContactDefault_supplier_proposal=Supplier Proposal -ContactDefault_ticketsup=Ticket +ContactDefault_ticket=Ticket ContactAddedAutomatically=Contact added from contact thirdparty roles More=More ShowDetails=Show details diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 35adc33c749..b8737ead703 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1069,7 +1069,7 @@ class SupplierProposal extends CommonObject if (!$error && !$notrigger) { // Call trigger - $result = $this->call_trigger('PROPAL_SUPPLIER_CREATE', $user); + $result = $this->call_trigger('PROPOSAL_SUPPLIER_CREATE', $user); if ($result < 0) { $error++; } // End call triggers } From 549bf076d7e00b5c7907590ceafa2d35412f847d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Feb 2020 12:22:52 +0100 Subject: [PATCH 672/784] Fix prefix of log --- htdocs/core/class/commonobject.class.php | 4 ++-- htdocs/exports/class/export.class.php | 4 ++-- htdocs/product/class/product.class.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 2289d280139..1a32599a56f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1080,7 +1080,7 @@ abstract class CommonObject * Get array of all contacts for an object * * @param int $status Status of links to get (-1=all) - * @param string $source Source of contact: external or thirdparty (llx_socpeople) or internal (llx_user) + * @param string $source Source of contact: 'external' or 'thirdparty' (llx_socpeople) or 'internal' (llx_user) * @param int $list 0:Return array contains all properties, 1:Return array contains just id * @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...) * @return array|int Array of contacts, -1 if error @@ -1701,7 +1701,7 @@ abstract class CommonObject $sql .= " WHERE ".$id_field." = ".$id; - dol_syslog(get_class($this)."::".__FUNCTION__."", LOG_DEBUG); + dol_syslog(__METHOD__."", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index b43fddad60d..5e6be580742 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -547,7 +547,7 @@ class Export $indice=0; asort($array_selected); - dol_syslog(get_class($this)."::".__FUNCTION__." ".$model.", ".$datatoexport.", ".implode(",", $array_selected)); + dol_syslog(__METHOD__." ".$model.", ".$datatoexport.", ".implode(",", $array_selected)); // Check parameters or context properties if (empty($this->array_export_fields) || ! is_array($this->array_export_fields)) @@ -588,7 +588,7 @@ class Export // Run the sql $this->sqlusedforexport=$sql; - dol_syslog(get_class($this)."::".__FUNCTION__."", LOG_DEBUG); + dol_syslog(__METHOD__."", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 746f3ce20dd..bfdc9338b87 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1457,7 +1457,7 @@ class Product extends CommonObject $sql .= "$field = '".$this->db->escape($value)."'"; $sql .= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::".__FUNCTION__." sql=".$sql, LOG_DEBUG); + dol_syslog(__METHOD__." sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { From 1904ae0e82beb5c179b60bda2c5edd0e49eec555 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Feb 2020 12:21:07 +0100 Subject: [PATCH 673/784] FIX Type of contact for event does not exists and not supported FIX Type of contact not saved when creating a contact FIX SQL Overload in default contact trigger. FIX Trigger name PROPAL_SUPPLIER_TRIGGER into PROPOSAL_SUPPLIER_TRIGGER Conflicts: htdocs/supplier_proposal/class/supplier_proposal.class.php --- htdocs/contact/card.php | 2 + htdocs/contact/class/contact.class.php | 6 +- htdocs/core/class/commonobject.class.php | 34 +++++---- htdocs/core/class/html.formcompany.class.php | 2 +- ...rface_90_modSociete_ContactRoles.class.php | 70 ++++++++++--------- htdocs/langs/en_US/main.lang | 2 +- .../class/supplier_proposal.class.php | 4 +- 7 files changed, 68 insertions(+), 52 deletions(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index c6cdb05f45a..ed58d976d7c 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -218,6 +218,8 @@ if (empty($reshook)) $object->priv = GETPOST("priv", 'int'); $object->note_public = GETPOST("note_public", 'none'); $object->note_private = GETPOST("note_private", 'none'); + $object->roles = GETPOST("roles", 'array'); + $object->statut = 1; //Defult status to Actif // Note: Correct date should be completed with location to have exact GM time of birth. diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 9c6602f7a2e..9ac6e837e97 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -354,7 +354,7 @@ class Contact extends CommonObject if (!$error) { - $result = $this->update($this->id, $user, 1, 'add'); + $result = $this->update($this->id, $user, 1, 'add'); // This include updateRoles(), ... if ($result < 0) { $error++; @@ -1639,6 +1639,10 @@ class Contact extends CommonObject { $tab = array(); + if ($element == 'action') { + $element = 'agenda'; + } + $sql = "SELECT sc.fk_socpeople as id, sc.fk_c_type_contact"; $sql .= " FROM ".MAIN_DB_PREFIX."c_type_contact tc"; $sql .= ", ".MAIN_DB_PREFIX."societe_contacts sc"; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1a32599a56f..41194359a9c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1242,14 +1242,15 @@ abstract class CommonObject /** * Return array with list of possible values for type of contacts * - * @param string $source 'internal', 'external' or 'all' - * @param int $option 0=Return array id->label, 1=Return array code->label - * @param int $activeonly 0=all status of contact, 1=only the active - * @param string $code Type of contact (Example: 'CUSTOMER', 'SERVICE') - * @param string $element Filter Element Type - * @return array Array list of type of contacts (id->label if option=0, code->label if option=1) + * @param string $source 'internal', 'external' or 'all' + * @param int $option 0=Return array id->label, 1=Return array code->label + * @param int $activeonly 0=all status of contact, 1=only the active + * @param string $code Type of contact (Example: 'CUSTOMER', 'SERVICE') + * @param string $element Filter on 1 element type + * @param string $excludeelement Exclude 1 element type. Example: 'agenda' + * @return array Array list of type of contacts (id->label if option=0, code->label if option=1) */ - public function listeTypeContacts($source = 'internal', $option = 0, $activeonly = 0, $code = '', $element = '') + public function listeTypeContacts($source = 'internal', $option = 0, $activeonly = 0, $code = '', $element = '', $excludeelement = '') { // phpcs:enable global $langs, $conf; @@ -1260,8 +1261,12 @@ abstract class CommonObject $sql .= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc"; $sqlWhere = array(); - if (!empty($element)) + if (!empty($element)) { $sqlWhere[] = " tc.element='".$this->db->escape($element)."'"; + } + if (!empty($excludeelement)) { + $sqlWhere[] = " tc.element <> '".$this->db->escape($excludeelement)."'"; + } if ($activeonly == 1) $sqlWhere[] = " tc.active=1"; // only the active types @@ -1284,18 +1289,19 @@ abstract class CommonObject $num = $this->db->num_rows($resql); if ($num > 0) { while ($obj = $this->db->fetch_object($resql)) { + $modulename = $obj->element; if (strpos($obj->element, 'project') !== false) { - $element = 'projet'; + $modulename = 'projet'; } elseif ($obj->element == 'contrat') { $element = 'contract'; + } elseif ($obj->element == 'action') { + $modulename = 'agenda'; } elseif (strpos($obj->element, 'supplier') !== false && $obj->element != 'supplier_proposal') { - $element = 'fournisseur'; + $modulename = 'fournisseur'; } elseif (strpos($obj->element, 'supplier') !== false && $obj->element != 'supplier_proposal') { - $element = 'fournisseur'; - } else { - $element = $obj->element; + $modulename = 'fournisseur'; } - if ($conf->{$element}->enabled) { + if ($conf->{$modulename}->enabled) { $libelle_element = $langs->trans('ContactDefault_'.$obj->element); $transkey = "TypeContact_".$this->element."_".$source."_".$obj->code; $libelle_type = ($langs->trans($transkey) != $transkey ? $langs->trans($transkey) : $obj->libelle); diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index a08694560ec..df9d4798c63 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -767,7 +767,7 @@ class FormCompany extends Form if ($rendermode === 'edit') { - $contactType = $contact->listeTypeContacts('external', '', 1); + $contactType = $contact->listeTypeContacts('external', '', 1, '', '', 'agenda'); // We exclude agenda as there is no contact on such element if (count($selected) > 0) { $newselected = array(); foreach ($selected as $key=>$val) { diff --git a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php index b50008dba2e..e22411ac180 100644 --- a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php +++ b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php @@ -66,48 +66,52 @@ class InterfaceContactRoles extends DolibarrTriggers public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { - if ($action === 'PROPAL_CREATE' || $action === 'ORDER_CREATE' || $action === 'BILL_CREATE' || $action === 'ORDER_SUPPLIER_CREATE' || $action === 'BILL_SUPPLIER_CREATE' - || $action === 'CONTRACT_CREATE' || $action === 'FICHINTER_CREATE' || $action === 'PROJECT_CREATE' || $action === 'TICKET_CREATE' || $action === 'ACTION_CREATE') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + if ($action === 'PROPAL_CREATE' || $action === 'ORDER_CREATE' || $action === 'BILL_CREATE' + || $action === 'ORDER_SUPPLIER_CREATE' || $action === 'BILL_SUPPLIER_CREATE' || $action === 'PROPOSAL_SUPPLIER_CREATE' + || $action === 'CONTRACT_CREATE' || $action === 'FICHINTER_CREATE' || $action === 'PROJECT_CREATE' || $action === 'TICKET_CREATE') { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $socid=(property_exists($object, 'socid')?$object->socid:$object->fk_soc); + $socid = (property_exists($object, 'socid') ? $object->socid : $object->fk_soc); - if (! empty($socid) && $socid > 0) { - require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; - $contactdefault = new Contact($this->db); - $contactdefault->socid=$socid; - $TContact = $contactdefault->getContactRoles($object->element); + if (! empty($socid) && $socid > 0) { + require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; + $contactdefault = new Contact($this->db); + $contactdefault->socid = $socid; + $TContact = $contactdefault->getContactRoles($object->element); - $TContactAlreadyLinked = array(); - if ($object->id > 0) - { - $class = get_class($object); - $cloneFrom = new $class($this->db); - $r = $cloneFrom->fetch($object->id); + if (is_array($TContact) && ! empty($TContact)) + { + $TContactAlreadyLinked = array(); + if ($object->id > 0) + { + /* $class = get_class($object); + $cloneFrom = new $class($this->db); + $r = $cloneFrom->fetch($object->id); */ + $cloneFrom = dol_clone($object, 1); - if (!empty($cloneFrom->id)) $TContactAlreadyLinked = array_merge($cloneFrom->liste_contact(-1, 'external'), $cloneFrom->liste_contact(-1, 'internal')); - } - - if (is_array($TContact)) - { - foreach($TContact as $i => $infos) { - foreach ($TContactAlreadyLinked as $contactData) { - if ($contactData['id'] == $infos['fk_socpeople'] && $contactData['fk_c_type_contact'] == $infos['type_contact']) unset($TContact[$i]); + if (!empty($cloneFrom->id)) { + $TContactAlreadyLinked = array_merge($cloneFrom->liste_contact(-1, 'external'), $cloneFrom->liste_contact(-1, 'internal')); + } } - } - $nb = 0; - foreach($TContact as $infos) { - $res = $object->add_contact($infos['fk_socpeople'], $infos['type_contact']); - if ($res > 0) $nb++; - } + foreach($TContact as $i => $infos) { + foreach ($TContactAlreadyLinked as $contactData) { + if ($contactData['id'] == $infos['fk_socpeople'] && $contactData['fk_c_type_contact'] == $infos['type_contact']) unset($TContact[$i]); + } + } - if($nb > 0) { - setEventMessages($langs->trans('ContactAddedAutomatically', $nb), null, 'mesgs'); + $nb = 0; + foreach($TContact as $infos) { + $res = $object->add_contact($infos['fk_socpeople'], $infos['type_contact']); + if ($res > 0) $nb++; + } + + if($nb > 0) { + setEventMessages($langs->trans('ContactAddedAutomatically', $nb), null, 'mesgs'); + } } } } - } - return 0; + return 0; } } diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 43331220bd0..0409f4326f3 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1010,7 +1010,7 @@ ContactDefault_project=Project ContactDefault_project_task=Task ContactDefault_propal=Proposal ContactDefault_supplier_proposal=Supplier Proposal -ContactDefault_ticketsup=Ticket +ContactDefault_ticket=Ticket ContactAddedAutomatically=Contact added from contact thirdparty roles More=More ShowDetails=Show details diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index e881eeb3b78..97e3b12b92f 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1069,7 +1069,7 @@ class SupplierProposal extends CommonObject if (! $error && ! $notrigger) { // Call trigger - $result=$this->call_trigger('PROPAL_SUPPLIER_CREATE', $user); + $result = $this->call_trigger('PROPOSAL_SUPPLIER_CREATE', $user); if ($result < 0) { $error++; } // End call triggers } @@ -2834,7 +2834,7 @@ class SupplierProposalLine extends CommonObjectLine // From llx_product /** * @deprecated - * @see product_ref + * @see $product_ref */ public $ref; From 504a67daee53b9fdc85c91d34774844d6f73975d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Feb 2020 12:34:00 +0100 Subject: [PATCH 674/784] FIX duplicate class name into some log lines --- htdocs/accountancy/class/bookkeeping.class.php | 8 ++++---- .../class/html.formadvtargetemailing.class.php | 6 +++--- htdocs/contact/class/contact.class.php | 8 ++++---- htdocs/core/class/commonobject.class.php | 4 ++-- htdocs/core/class/html.formaccounting.class.php | 4 ++-- htdocs/core/modules/mailings/modules_mailings.php | 10 +++++----- .../product/class/propalmergepdfproduct.class.php | 14 +++++++------- htdocs/user/class/user.class.php | 2 +- test/phpunit/CodingPhpTest.php | 13 +++++++++++++ 9 files changed, 41 insertions(+), 28 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 7177e79b427..a5af9ba4cd5 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1554,7 +1554,7 @@ class BookKeeping extends CommonObject $sql .= " WHERE piece_num = ".$piecenum; $sql .= " AND entity IN (".getEntity('accountancy').")"; - dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG); + dol_syslog(__METHOD__, LOG_DEBUG); $result = $this->db->query($sql); if ($result) { $obj = $this->db->fetch_object($result); @@ -1568,7 +1568,7 @@ class BookKeeping extends CommonObject $this->date_creation = $obj->date_creation; } else { $this->error = "Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::".__METHOD__.$this->error, LOG_ERR); + dol_syslog(__METHOD__.$this->error, LOG_ERR); return -1; } @@ -1622,7 +1622,7 @@ class BookKeeping extends CommonObject $sql .= " WHERE piece_num = ".$piecenum; $sql .= " AND entity IN (".getEntity('accountancy').")"; - dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG); + dol_syslog(__METHOD__, LOG_DEBUG); $result = $this->db->query($sql); if ($result) { while ($obj = $this->db->fetch_object($result)) { @@ -1654,7 +1654,7 @@ class BookKeeping extends CommonObject } } else { $this->error = "Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::".__METHOD__.$this->error, LOG_ERR); + dol_syslog(__METHOD__.$this->error, LOG_ERR); return -1; } diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index f5acafcfb19..8b3937f3e1a 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -297,7 +297,7 @@ class FormAdvTargetEmailing extends Form $sql = "SELECT rowid, code, label as civilite, active FROM ".MAIN_DB_PREFIX."c_civility"; $sql .= " WHERE active = 1"; - dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG); + dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -385,7 +385,7 @@ class FormAdvTargetEmailing extends Form $sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."categorie"; $sql .= " WHERE type=".$type; - dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG); + dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -432,7 +432,7 @@ class FormAdvTargetEmailing extends Form $sql .= " WHERE type_element='$type_element'"; $sql .= " ORDER BY c.name"; - dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG); + dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $out .= '
'.$companystatic->getNomUrl(1, 'customer', 48).'
'.$companystatic->getNomUrl(1, 'supplier', 44).'
'; - $userstatic->id=$obj->rowid; - $userstatic->lastname=$obj->lastname; - $userstatic->firstname=$obj->firstname; - $userstatic->email=$obj->email; - print $userstatic->getNomUrl(1); - print '
'; + $userstatic->lastname = $obj->lastname; + $userstatic->firstname = $obj->firstname; + $userstatic->email = $obj->email; + print $userstatic->getNomUrl(1); + print '

"; From 4511cf1060b59d04facb934654e7394d28455ad8 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 18 Feb 2020 09:03:25 +0100 Subject: [PATCH 688/784] FIX missing "statut" for getNomUrl() function --- htdocs/fourn/commande/index.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index 1c4e0aad9e4..01af73cb76e 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -249,7 +249,7 @@ $sql = "SELECT"; if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { $sql .= " DISTINCT"; } -$sql.= " u.rowid, u.lastname, u.firstname, u.email"; +$sql.= " u.rowid, u.lastname, u.firstname, u.email, u.statut"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { @@ -288,6 +288,7 @@ if ($resql) $userstatic->lastname = $obj->lastname; $userstatic->firstname = $obj->firstname; $userstatic->email = $obj->email; + $userstatic->statut = $obj->statut; print $userstatic->getNomUrl(1); print '
'.$langs->trans("EnableMultilangInterface").''; -//print $form->selectyesno('MAIN_MULTILANGS', $conf->global->MAIN_MULTILANGS, 1); print ajax_constantonoff('MAIN_MULTILANGS'); print ' 
'.$langs->trans("EnableShowLogo").''; if ($edit) { - print $form->selectyesno('MAIN_SHOW_LOGO', $conf->global->MAIN_SHOW_LOGO, 1); + print ajax_constantonoff('MAIN_SHOW_LOGO', array(), null, 0, 0, 1); + //print $form->selectyesno('MAIN_SHOW_LOGO', $conf->global->MAIN_SHOW_LOGO, 1); } else { @@ -494,7 +495,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''; if ($edit) { - print $form->selectyesno('THEME_TOPMENU_DISABLE_IMAGE', $conf->global->THEME_TOPMENU_DISABLE_IMAGE, 1); + print ajax_constantonoff('THEME_TOPMENU_DISABLE_IMAGE', array(), null, 0, 0, 1); + //print $form->selectyesno('THEME_TOPMENU_DISABLE_IMAGE', $conf->global->THEME_TOPMENU_DISABLE_IMAGE, 1); } else { diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 815674a5b76..738b8b6ec18 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1715,8 +1715,8 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead if ($helpbaseurl && $helppage) { $text = ''; - $title .= $langs->trans($mode == 'wiki' ? 'GoToWikiHelpPage' : 'GoToHelpPage'); - if ($mode == 'wiki') $title .= ' - '.$langs->trans("PageWiki").' "'.dol_escape_htmltag(strtr($helppage, '_', ' ')).'"'; + $title = $langs->trans($mode == 'wiki' ? 'GoToWikiHelpPage' : 'GoToHelpPage'); + if ($mode == 'wiki') $title .= ' - '.$langs->trans("PageWiki").' "'.dol_escape_htmltag(strtr($helppage, '_', ' ')).'"'.""; $text .= 'database_name; } - $text = ''.DOL_VERSION.''; + $text = ''.DOL_VERSION.''; $toprightmenu .= @Form::textwithtooltip('', $appli, 2, 1, $text, 'login_block_elem', 2); } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 2761b697ed7..f76a58d6f50 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -2105,6 +2105,9 @@ div.login_block a { color: #; display: inline-block; } +div.login_block span.aversion { + color: #888; +} div.login_block table { display: inline; } From 110a23623bab0f8f6c60e6614ba914e7421ee661 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 18 Feb 2020 11:04:11 +0100 Subject: [PATCH 691/784] FIX an external user can not approved --- htdocs/fourn/commande/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index 01af73cb76e..50a9150a9a1 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -262,6 +262,7 @@ else { $sql.= " WHERE (u.entity IN (".getEntity('user').")"; } +$sql.= " AND u.fk_soc IS NULL"; // An external user can not approved $resql = $db->query($sql); if ($resql) From d1e9f3a5050622fbca30dbcbfe3bae0427d8dace Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Tue, 18 Feb 2020 11:18:00 +0100 Subject: [PATCH 692/784] FIX keep assigned users in session when loading projects and tasks --- htdocs/comm/action/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index c057dc2dee3..066d5cf8b7a 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -908,7 +908,7 @@ if ($action == 'create') $numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:-1), $projectid, 'projectid', 0, 0, 1, 1); print '   '.$langs->trans("AddProject").''; - $urloption='?action=create'; + $urloption = '?action=create&donotclearsession=1'; $url = dol_buildpath('comm/action/card.php', 2).$urloption; // update task list @@ -1325,7 +1325,7 @@ if ($id > 0) { print ''; - $urloption='?action=create'; // we use create not edit for more flexibility + $urloption = '?action=create&donotclearsession=1'; // we use create not edit for more flexibility $url = DOL_URL_ROOT.'/comm/action/card.php'.$urloption; // update task list From 9ce0e6869e54824f4b9a93e87158a155b174f38e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Feb 2020 11:55:39 +0100 Subject: [PATCH 693/784] Fix trans --- htdocs/comm/propal/list.php | 4 ++-- htdocs/langs/en_US/admin.lang | 3 ++- htdocs/langs/en_US/main.lang | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 4bb794a372a..d4d227f8b7c 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -164,8 +164,8 @@ $arrayfields = array( 'p.total_ht'=>array('label'=>"AmountHT", 'checked'=>1), 'p.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0), 'p.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0), - 'p.total_ht_invoiced'=>array('label'=>$langs->trans("AmountInvoicedHT"), 'checked'=>0, 'enabled'=>$conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT), - 'p.total_invoiced'=>array('label'=>$langs->trans("AmountInvoicedTTC"), 'checked'=>0, 'enabled'=>$conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT), + 'p.total_ht_invoiced'=>array('label'=>"AmountInvoicedHT", 'checked'=>0, 'enabled'=>$conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT), + 'p.total_invoiced'=>array('label'=>"AmountInvoicedTTC", 'checked'=>0, 'enabled'=>$conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT), 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>10), 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>1), 'p.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 0bf914d0e22..3fde658960e 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1973,4 +1973,5 @@ NotAPublicIp=Not a public IP MakeAnonymousPing=Make an anonymous Ping '+1' to the Dolibarr foundation server (done 1 time only after installation) to allow the foundation to count the number of Dolibarr installation. FeatureNotAvailableWithReceptionModule=Feature not available when module Reception is enabled EmailTemplate=Template for email -EMailsWillHaveMessageID=Emails will have a tag 'References' matching this syntax \ No newline at end of file +EMailsWillHaveMessageID=Emails will have a tag 'References' matching this syntax +FafaIconSocialNetworksDesc=Enter here the code of a FontAwesome icon. If you don't know what is FontAwesome, you can use the generic value fa-address-book. \ No newline at end of file diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 0409f4326f3..8f8480a03cb 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -352,6 +352,8 @@ PriceUTTC=U.P. (inc. tax) Amount=Amount AmountInvoice=Invoice amount AmountInvoiced=Amount invoiced +AmountInvoicedHT=Amount invoiced (incl. tax) +AmountInvoicedTTC=Amount invoiced (excl. tax) AmountPayment=Payment amount AmountHTShort=Amount (excl.) AmountTTCShort=Amount (inc. tax) From 7e814e2a08e47eeddae1ffc3bd475bf67d3193eb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Feb 2020 12:01:19 +0100 Subject: [PATCH 694/784] FIX Menu truncated. Add tooltip to have all content. --- htdocs/core/menus/standard/auguria.lib.php | 4 ++-- htdocs/core/menus/standard/eldy.lib.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index e35f45576d1..390c50aa748 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -548,7 +548,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t if ($menu_array[$i]['enabled']) // Enabled so visible { print '
'.$langs->trans("ProductAccountancySellIntraCode").''; - if($type = 0) { + if($type == 0) { $accountancy_code_sell_intra = (GETPOST('accountancy_code_sell_intra', 'alpha')?(GETPOST('accountancy_code_sell_intra', 'alpha')):$conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT); } else { $accountancy_code_sell_intra = GETPOST('accountancy_code_sell_intra', 'alpha'); @@ -1199,7 +1199,7 @@ else // Accountancy_code_sell_export print '
'.$langs->trans("ProductAccountancySellExportCode").''; - if($type = 0) + if($type == 0) { $accountancy_code_sell_export = (GETPOST('accountancy_code_sell_export', 'alpha')?(GETPOST('accountancy_code_sell_export', 'alpha')):$conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT); } else { From b859d4670a406ca248303f1914f7d3e07fa1d290 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Feb 2020 22:49:53 +0100 Subject: [PATCH 706/784] Fix perm --- htdocs/api/class/api_documents.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 9bde1f0108f..c2b57158aec 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -279,7 +279,8 @@ class Documents extends DolibarrApi { require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; - if (!DolibarrApiAccess::$user->rights->societe->lire) { + // Can get doc if has permission to read all user or if it is user itself + if (!DolibarrApiAccess::$user->rights->user->user->lire && $user->id != $id) { throw new RestException(401); } From 97081affdcd96e33a2a6cc22b6754bd7232fc9dc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Feb 2020 22:50:13 +0100 Subject: [PATCH 707/784] Fix perm --- htdocs/api/class/api_documents.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index c2b57158aec..98970c67546 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -280,7 +280,7 @@ class Documents extends DolibarrApi require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; // Can get doc if has permission to read all user or if it is user itself - if (!DolibarrApiAccess::$user->rights->user->user->lire && $user->id != $id) { + if (!DolibarrApiAccess::$user->rights->user->user->lire && DolibarrApiAccess::$user->id != $id) { throw new RestException(401); } From 0212bc5cf2d5d1940a97009f0ef1e8fb09c12c9d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Feb 2020 22:54:03 +0100 Subject: [PATCH 708/784] Try to fix eclipse warnings on doxygen --- htdocs/api/class/api_setup.class.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 66c4c1358cb..7c471dfd0bd 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -59,8 +59,7 @@ class Setup extends DolibarrApi * * @return array [List of ordering methods] * - * @throws 400 RestException - * @throws 200 OK + * @throws RestException 400 */ public function getOrderingMethods($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') { @@ -121,8 +120,7 @@ class Setup extends DolibarrApi * * @return array [List of payment types] * - * @throws 400 RestException - * @throws 200 OK + * @throws RestException 400 */ public function getPaymentTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') { @@ -339,8 +337,7 @@ class Setup extends DolibarrApi * * @return array [List of availability] * - * @throws 400 RestException - * @throws 200 OK + * @throws RestException 400 */ public function getAvailability($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') { @@ -908,8 +905,7 @@ class Setup extends DolibarrApi * * @return array List of payment terms * - * @throws 400 RestException - * @throws 200 OK + * @throws RestException 400 */ public function getPaymentTerms($sortfield = "sortorder", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') { @@ -969,8 +965,7 @@ class Setup extends DolibarrApi * * @return array List of shipping methods * - * @throws 400 RestException - * @throws 200 OK + * @throws RestException 400 */ public function getShippingModes($limit = 100, $page = 0, $active = 1, $sqlfilters = '') { From 97b4f68e48455bf2961b5a9c313066cf81c9a4e1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Feb 2020 22:56:37 +0100 Subject: [PATCH 709/784] Update bank.php --- htdocs/user/bank.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 9ff7bd56634..050c892abb5 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -289,7 +289,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco * Last salaries */ if (!empty($conf->salaries->enabled) && - ( ($object->fk_user == $user->id) || ($user->rights->salaries->read && $object->id == $user->id) ) + (($object->fk_user == $user->id) || ($user->rights->salaries->read && $object->id == $user->id)) ) { $salary = new PaymentSalary($db); From 8c52f324acfeb406c8045105f44052d1dd4ff8cd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Feb 2020 22:58:51 +0100 Subject: [PATCH 710/784] Fix doxygen --- htdocs/api/class/api_documents.class.php | 43 +++++++++++------------- htdocs/api/class/api_login.class.php | 5 ++- 2 files changed, 21 insertions(+), 27 deletions(-) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 98970c67546..891c3969f81 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -60,10 +60,9 @@ class Documents extends DolibarrApi * @param string $original_file Relative path with filename, relative to modulepart (for example: IN201701-999/IN201701-999.pdf) * @return array List of documents * - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 200 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 * * @url GET /download */ @@ -118,12 +117,11 @@ class Documents extends DolibarrApi * @param string $langcode Language code like 'en_US', 'fr_FR', 'es_ES', ... (If not set, use the default language). * @return array List of documents * - * @throws 500 - * @throws 501 - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 200 + * @throws RestException 500 + * @throws RestException 501 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 * * @url PUT /builddoc */ @@ -237,11 +235,10 @@ class Documents extends DolibarrApi * @param string $sortorder Sort order ('asc' or 'desc') * @return array Array of documents with path * - * @throws 200 - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 500 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 500 * * @url GET / */ @@ -447,11 +444,10 @@ class Documents extends DolibarrApi * @param int $overwriteifexists Overwrite file if exists (1 by default) * @return string * - * @throws 200 - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 500 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 500 * * @url POST /upload */ @@ -627,10 +623,9 @@ class Documents extends DolibarrApi * @param string $original_file Relative path with filename, relative to modulepart (for example: PRODUCT-REF-999/IMAGE-999.jpg) * @return array List of documents * - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 200 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 * * @url DELETE / */ diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php index 59a527d251c..748d1f2ac31 100644 --- a/htdocs/api/class/api_login.class.php +++ b/htdocs/api/class/api_login.class.php @@ -48,9 +48,8 @@ class Login * @param int $reset Reset token (0=get current token, 1=ask a new token and canceled old token. This means access using current existing API token of user will fails: new token will be required for new access) * @return array Response status and user token * - * @throws 200 - * @throws 403 - * @throws 500 + * @throws RestException 403 + * @throws RestException 500 * * @url GET / * @url POST / From b0016764c40e508f7f3c9109fa3eb22a2b21c0bf Mon Sep 17 00:00:00 2001 From: oscim Date: Mon, 17 Feb 2020 11:18:34 +0100 Subject: [PATCH 711/784] Update bank.php For authorize line manager to see wages paid --- htdocs/user/bank.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 188a6b59d31..9ff7bd56634 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -289,7 +289,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco * Last salaries */ if (!empty($conf->salaries->enabled) && - ($user->rights->salaries->read && $object->id == $user->id) + ( ($object->fk_user == $user->id) || ($user->rights->salaries->read && $object->id == $user->id) ) ) { $salary = new PaymentSalary($db); From ce09ec88057d4fe8c8727b1b4717c087ac8d4829 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Feb 2020 23:35:45 +0100 Subject: [PATCH 712/784] Fix phpcs --- htdocs/core/modules/modProjet.class.php | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index 668bf22104e..aa68fdeb698 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -216,29 +216,6 @@ class modProjet extends DolibarrModules $this->export_label[$r]='ProjectsAndTasksLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r]=array(array("projet","export")); $this->export_dependencies_array[$r]=array('projecttask'=>'pt.rowid', 'task_time'=>'ptt.rowid'); -/* - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) - { - print ' '; - $htmltext = $langs->trans("ProjectFollowOpportunity"); - print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); - print '
'; - } - if (empty($conf->global->PROJECT_HIDE_TASKS)) - { - print ' '; - $htmltext = $langs->trans("ProjectFollowTasks"); - print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); - print '
'; - } - if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) - { - print ' '; - $htmltext = $langs->trans("ProjectBillTimeDescription"); - print $form->textwithpicto($langs->trans("BillTime"), $htmltext); - print '
'; - } -*/ $this->export_TypeFields_array[$r]=array( 's.rowid'=>"List:societe:nom::thirdparty",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label', From fd48877dc689edf3b23de862e9ab54faefb07f8d Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Tue, 18 Feb 2020 22:47:25 +0000 Subject: [PATCH 713/784] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- htdocs/accountancy/admin/accountmodel.php | 350 +++++++++--------- htdocs/accountancy/admin/categories_list.php | 2 +- htdocs/admin/events.php | 22 +- htdocs/admin/mails_templates.php | 2 +- htdocs/admin/menus/edit.php | 4 +- htdocs/admin/oauthlogintokens.php | 6 +- htdocs/admin/security_other.php | 32 +- htdocs/admin/spip.php | 36 +- htdocs/admin/website.php | 262 ++++++------- htdocs/cashdesk/tpl/facturation1.tpl.php | 18 +- .../html.formadvtargetemailing.class.php | 2 +- htdocs/contact/class/contact.class.php | 6 +- htdocs/core/class/coreobject.class.php | 56 +-- htdocs/core/class/html.formcompany.class.php | 2 +- htdocs/core/login/functions_openid.php | 30 +- .../modules/mailings/modules_mailings.php | 64 ++-- .../modules/oauth/github_oauthcallback.php | 22 +- .../modules/oauth/google_oauthcallback.php | 22 +- ...rface_90_modSociete_ContactRoles.class.php | 16 +- htdocs/don/payment/payment.php | 50 +-- .../class/expensereport_ik.class.php | 54 +-- .../class/expensereport_rule.class.php | 28 +- htdocs/exports/export.php | 2 +- .../mailinglist_mymodule_myobject.modules.php | 50 +-- htdocs/product/admin/dynamic_prices.php | 42 +-- .../class/propalmergepdfproduct.class.php | 252 ++++++------- htdocs/variants/ajax/orderAttribute.php | 14 +- 27 files changed, 723 insertions(+), 723 deletions(-) diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index da23d3cc33b..2ed3ad44695 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -39,31 +39,31 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; -if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; +if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; // Load translation files required by the page -$langs->loadLangs(array("errors","admin","companies","resource","holiday","compta","accountancy","hrm")); +$langs->loadLangs(array("errors", "admin", "companies", "resource", "holiday", "compta", "accountancy", "hrm")); -$action=GETPOST('action', 'aZ09')?GETPOST('action', 'aZ09'):'view'; -$confirm=GETPOST('confirm', 'alpha'); -$id=31; -$rowid=GETPOST('rowid', 'alpha'); -$code=GETPOST('code', 'alpha'); +$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; +$confirm = GETPOST('confirm', 'alpha'); +$id = 31; +$rowid = GETPOST('rowid', 'alpha'); +$code = GETPOST('code', 'alpha'); $acts[0] = "activate"; $acts[1] = "disable"; $actl[0] = img_picto($langs->trans("Disabled"), 'switch_off'); $actl[1] = img_picto($langs->trans("Activated"), 'switch_on'); -$listoffset=GETPOST('listoffset', 'alpha'); -$listlimit=GETPOST('listlimit', 'int')>0?GETPOST('listlimit', 'int'):1000; +$listoffset = GETPOST('listoffset', 'alpha'); +$listlimit = GETPOST('listlimit', 'int') > 0 ?GETPOST('listlimit', 'int') : 1000; $active = 1; $sortfield = GETPOST("sortfield", 'aZ09comma'); $sortorder = GETPOST("sortorder", 'aZ09comma'); $page = GETPOST("page", 'int'); if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 -$offset = $listlimit * $page ; +$offset = $listlimit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -72,7 +72,7 @@ $search_country_id = GETPOST('search_country_id', 'int'); // Security check if ($user->socid > 0) accessforbidden(); -if (! $user->rights->accounting->chartofaccount) accessforbidden(); +if (!$user->rights->accounting->chartofaccount) accessforbidden(); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -82,56 +82,56 @@ $hookmanager->initHooks(array('admin')); // Put here declaration of dictionaries properties // Name of SQL tables of dictionaries -$tabname=array(); +$tabname = array(); -$tabname[31]= MAIN_DB_PREFIX."accounting_system"; +$tabname[31] = MAIN_DB_PREFIX."accounting_system"; // Dictionary labels -$tablib=array(); -$tablib[31]= "Pcg_version"; +$tablib = array(); +$tablib[31] = "Pcg_version"; // Requests to extract data -$tabsql=array(); -$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.fk_country as country_id, c.code as country_code, c.label as country, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_country as c WHERE s.fk_country=c.rowid and c.active=1"; +$tabsql = array(); +$tabsql[31] = "SELECT s.rowid as rowid, pcg_version, s.label, s.fk_country as country_id, c.code as country_code, c.label as country, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_country as c WHERE s.fk_country=c.rowid and c.active=1"; // Criteria to sort dictionaries -$tabsqlsort=array(); -$tabsqlsort[31]="pcg_version ASC"; +$tabsqlsort = array(); +$tabsqlsort[31] = "pcg_version ASC"; // Nom des champs en resultat de select pour affichage du dictionnaire -$tabfield=array(); -$tabfield[31]= "pcg_version,label,country_id,country"; +$tabfield = array(); +$tabfield[31] = "pcg_version,label,country_id,country"; // Nom des champs d'edition pour modification d'un enregistrement -$tabfieldvalue=array(); -$tabfieldvalue[31]= "pcg_version,label,country"; +$tabfieldvalue = array(); +$tabfieldvalue[31] = "pcg_version,label,country"; // Nom des champs dans la table pour insertion d'un enregistrement -$tabfieldinsert=array(); -$tabfieldinsert[31]= "pcg_version,label,fk_country"; +$tabfieldinsert = array(); +$tabfieldinsert[31] = "pcg_version,label,fk_country"; // Nom du rowid si le champ n'est pas de type autoincrement // Example: "" if id field is "rowid" and has autoincrement on // "nameoffield" if id field is not "rowid" or has not autoincrement on -$tabrowid=array(); -$tabrowid[31]= ""; +$tabrowid = array(); +$tabrowid[31] = ""; // Condition to show dictionary in setup page -$tabcond=array(); -$tabcond[31]= ! empty($conf->accounting->enabled); +$tabcond = array(); +$tabcond[31] = !empty($conf->accounting->enabled); // List of help for fields -$tabhelp=array(); +$tabhelp = array(); $tabhelp[31] = array('pcg_version'=>$langs->trans("EnterAnyCode")); // List of check for fields (NOT USED YET) -$tabfieldcheck=array(); +$tabfieldcheck = array(); $tabfieldcheck[31] = array(); // Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact") $elementList = array(); -$sourceList=array(); +$sourceList = array(); @@ -147,38 +147,38 @@ if (GETPOST('button_removefilter', 'alpha') || GETPOST('button_removefilter.x', // Actions add or modify an entry into a dictionary if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { - $listfield=explode(',', str_replace(' ', '', $tabfield[$id])); - $listfieldinsert=explode(',', $tabfieldinsert[$id]); - $listfieldmodify=explode(',', $tabfieldinsert[$id]); - $listfieldvalue=explode(',', $tabfieldvalue[$id]); + $listfield = explode(',', str_replace(' ', '', $tabfield[$id])); + $listfieldinsert = explode(',', $tabfieldinsert[$id]); + $listfieldmodify = explode(',', $tabfieldinsert[$id]); + $listfieldvalue = explode(',', $tabfieldvalue[$id]); // Check that all fields are filled - $ok=1; + $ok = 1; foreach ($listfield as $f => $value) { - if ($value == 'country_id' && in_array($tablib[$id], array('Pcg_version'))) continue; // For some pages, country is not mandatory - if ((! GETPOSTISSET($value)) || GETPOST($value) == '') + if ($value == 'country_id' && in_array($tablib[$id], array('Pcg_version'))) continue; // For some pages, country is not mandatory + if ((!GETPOSTISSET($value)) || GETPOST($value) == '') { - $ok=0; - $fieldnamekey=$listfield[$f]; + $ok = 0; + $fieldnamekey = $listfield[$f]; // We take translate key of field - if ($fieldnamekey == 'pcg_version') $fieldnamekey='Pcg_version'; - if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label'; + if ($fieldnamekey == 'pcg_version') $fieldnamekey = 'Pcg_version'; + if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey = 'Label'; setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors'); } } // Other checks - if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && GETPOSTISSET("type") && in_array($_POST["type"], array('system','systemauto'))) { - $ok=0; + if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && GETPOSTISSET("type") && in_array($_POST["type"], array('system', 'systemauto'))) { + $ok = 0; setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors'); } if (GETPOSTISSET("pcg_version")) { if (GETPOST("pcg_version") == '0') { - $ok=0; + $ok = 0; setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors'); } /*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base @@ -187,9 +187,9 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) $msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'
'; }*/ } - if (isset($_POST["country"]) && ($_POST["country"]=='0') && ($id != 2)) + if (isset($_POST["country"]) && ($_POST["country"] == '0') && ($id != 2)) { - $ok=0; + $ok = 0; setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities("Country")), null, 'errors'); } @@ -199,13 +199,13 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) if ($tabrowid[$id]) { // Recupere id libre pour insertion - $newid=0; + $newid = 0; $sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id]; $result = $db->query($sql); if ($result) { $obj = $db->fetch_object($result); - $newid=($obj->newid + 1); + $newid = ($obj->newid + 1); } else { dol_print_error($db); } @@ -214,16 +214,16 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) // Add new entry $sql = "INSERT INTO ".$tabname[$id]." ("; // List of fields - if ($tabrowid[$id] && ! in_array($tabrowid[$id], $listfieldinsert)) - $sql.= $tabrowid[$id].","; - $sql.= $tabfieldinsert[$id]; - $sql.=",active)"; - $sql.= " VALUES("; + if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) + $sql .= $tabrowid[$id].","; + $sql .= $tabfieldinsert[$id]; + $sql .= ",active)"; + $sql .= " VALUES("; // List of values - if ($tabrowid[$id] && ! in_array($tabrowid[$id], $listfieldinsert)) - $sql.= $newid.","; - $i=0; + if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) + $sql .= $newid.","; + $i = 0; foreach ($listfieldinsert as $f => $value) { if ($value == 'price' || preg_match('/^amount/i', $value) || $value == 'taux') { @@ -232,19 +232,19 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) elseif ($value == 'entity') { $_POST[$listfieldvalue[$i]] = $conf->entity; } - if ($i) $sql.=","; - if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; - else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'"; + if ($i) $sql .= ","; + if ($_POST[$listfieldvalue[$i]] == '') $sql .= "null"; + else $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'"; $i++; } - $sql.=",1)"; + $sql .= ",1)"; dol_syslog("actionadd", LOG_DEBUG); $result = $db->query($sql); if ($result) // Add is ok { setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); - $_POST=array('id'=>$id); // Clean $_POST array, we keep only + $_POST = array('id'=>$id); // Clean $_POST array, we keep only } else { @@ -260,16 +260,16 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) // Si verif ok et action modify, on modifie la ligne if ($ok && GETPOST('actionmodify', 'alpha')) { - if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } - else { $rowidcol="rowid"; } + if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } + else { $rowidcol = "rowid"; } // Modify entry $sql = "UPDATE ".$tabname[$id]." SET "; // Modifie valeur des champs - if ($tabrowid[$id] && ! in_array($tabrowid[$id], $listfieldmodify)) + if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify)) { - $sql.= $tabrowid[$id]."="; - $sql.= "'".$db->escape($rowid)."', "; + $sql .= $tabrowid[$id]."="; + $sql .= "'".$db->escape($rowid)."', "; } $i = 0; foreach ($listfieldmodify as $field) @@ -280,18 +280,18 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) elseif ($field == 'entity') { $_POST[$listfieldvalue[$i]] = $conf->entity; } - if ($i) $sql.=","; - $sql.= $field."="; - if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; - else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'"; + if ($i) $sql .= ","; + $sql .= $field."="; + if ($_POST[$listfieldvalue[$i]] == '') $sql .= "null"; + else $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'"; $i++; } - $sql.= " WHERE ".$rowidcol." = '".$rowid."'"; + $sql .= " WHERE ".$rowidcol." = '".$rowid."'"; dol_syslog("actionmodify", LOG_DEBUG); //print $sql; $resql = $db->query($sql); - if (! $resql) + if (!$resql) { setEventMessages($db->error(), null, 'errors'); } @@ -306,14 +306,14 @@ if (GETPOST('actioncancel', 'alpha')) if ($action == 'confirm_delete' && $confirm == 'yes') // delete { - if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } - else { $rowidcol="rowid"; } + if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } + else { $rowidcol = "rowid"; } $sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'"; dol_syslog("delete", LOG_DEBUG); $result = $db->query($sql); - if (! $result) + if (!$result) { if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') { @@ -329,8 +329,8 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete // activate if ($action == $acts[0]) { - if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } - else { $rowidcol="rowid"; } + if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } + else { $rowidcol = "rowid"; } if ($rowid) { $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'"; @@ -349,8 +349,8 @@ if ($action == $acts[0]) // disable if ($action == $acts[1]) { - if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } - else { $rowidcol="rowid"; } + if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } + else { $rowidcol = "rowid"; } if ($rowid) { $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'"; @@ -369,8 +369,8 @@ if ($action == $acts[1]) // favorite if ($action == 'activate_favorite') { - if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } - else { $rowidcol="rowid"; } + if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } + else { $rowidcol = "rowid"; } if ($rowid) { $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$rowid."'"; @@ -389,8 +389,8 @@ if ($action == 'activate_favorite') // disable favorite if ($action == 'disable_favorite') { - if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } - else { $rowidcol="rowid"; } + if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } + else { $rowidcol = "rowid"; } if ($rowid) { $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$rowid."'"; @@ -412,12 +412,12 @@ if ($action == 'disable_favorite') */ $form = new Form($db); -$formadmin=new FormAdmin($db); +$formadmin = new FormAdmin($db); llxHeader(); -$titre=$langs->trans($tablib[$id]); -$linkback=''; +$titre = $langs->trans($tablib[$id]); +$linkback = ''; print load_fiche_titre($titre, $linkback, 'title_accountancy'); @@ -425,7 +425,7 @@ print load_fiche_titre($titre, $linkback, 'title_accountancy'); // Confirmation de la suppression de la ligne if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.urlencode($page).'&':'').'sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder).'&rowid='.urlencode($rowid).'&code='.urlencode($code).'&id='.urlencode($id), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1); + print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.urlencode($page).'&' : '').'sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder).'&rowid='.urlencode($rowid).'&code='.urlencode($code).'&id='.urlencode($id), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1); } //var_dump($elementList); @@ -435,22 +435,22 @@ if ($action == 'delete') if ($id) { // Complete requete recherche valeurs avec critere de tri - $sql=$tabsql[$id]; + $sql = $tabsql[$id]; if ($search_country_id > 0) { - if (preg_match('/ WHERE /', $sql)) $sql.= " AND "; - else $sql.=" WHERE "; - $sql.= " c.rowid = ".$search_country_id; + if (preg_match('/ WHERE /', $sql)) $sql .= " AND "; + else $sql .= " WHERE "; + $sql .= " c.rowid = ".$search_country_id; } // If sort order is "country", we use country_code instead - if ($sortfield == 'country') $sortfield='country_code'; - $sql.=$db->order($sortfield, $sortorder); - $sql.=$db->plimit($listlimit+1, $offset); + if ($sortfield == 'country') $sortfield = 'country_code'; + $sql .= $db->order($sortfield, $sortorder); + $sql .= $db->plimit($listlimit + 1, $offset); //print $sql; - $fieldlist=explode(',', $tabfield[$id]); + $fieldlist = explode(',', $tabfield[$id]); print ''; print ''; @@ -461,10 +461,10 @@ if ($id) // Form to add a new line if ($tabname[$id]) { - $alabelisused=0; - $var=false; + $alabelisused = 0; + $var = false; - $fieldlist=explode(',', $tabfield[$id]); + $fieldlist = explode(',', $tabfield[$id]); // Line for title print '
 '; - if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) { + if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) { print ''.$valuetoshow.' '.img_help(1, $valuetoshow).''; - } elseif (! empty($tabhelp[$id][$value])) { + } elseif (!empty($tabhelp[$id][$value])) { print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]); } else { print $valuetoshow; } print ''; @@ -518,14 +518,14 @@ if ($id) foreach ($fieldlist as $key=>$val) { if (GETPOST($val)) - $obj->$val=GETPOST($val); + $obj->$val = GETPOST($val); } } $tmpaction = 'create'; - $parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); - $reshook=$hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks - $error=$hookmanager->error; $errors=$hookmanager->errors; + $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); + $reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks + $error = $hookmanager->error; $errors = $hookmanager->errors; if (empty($reshook)) { @@ -537,32 +537,32 @@ if ($id) print '
 
 
'; - print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), ''); + print '
'; + print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), ''); print '
'; - $searchpicto=$form->showFilterAndCheckAddButtons(0); + $searchpicto = $form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
 '; + print ' '; print ' '.$valuetoshow.''; @@ -737,10 +737,10 @@ $db->close(); */ function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context = '') { - global $conf,$langs,$db; + global $conf, $langs, $db; global $form; global $region_id; - global $elementList,$sourceList; + global $elementList, $sourceList; $formadmin = new FormAdmin($db); $formcompany = new FormCompany($db); @@ -758,15 +758,15 @@ function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context = continue; } // For state page, we do not show the country input (we link to region, not country) print ''; - $fieldname='country'; - print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); + $fieldname = 'country'; + print $form->select_country((!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country : '')), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); print ''; print ''; print ''; else print ''; if ($fieldlist[$field] == 'type_cdr') { - print $form->selectarray($fieldlist[$field], array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')); + print $form->selectarray($fieldlist[$field], array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'')); } else { - print $form->selectyesno($fieldlist[$field], (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 1); + print $form->selectyesno($fieldlist[$field], (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1); } print ''; - $size=''; $class=''; - if ($fieldlist[$field]=='code') $size='size="8" '; - if ($fieldlist[$field]=='position') $size='size="4" '; - if ($fieldlist[$field]=='libelle') $size='centpercent'; - if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" '; - print ''; + $size = ''; $class = ''; + if ($fieldlist[$field] == 'code') $size = 'size="8" '; + if ($fieldlist[$field] == 'position') $size = 'size="4" '; + if ($fieldlist[$field] == 'libelle') $size = 'centpercent'; + if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'sens' || $fieldlist[$field] == 'category_type') $size = 'size="2" '; + print ''; print '
'.$arr['id'].''; - $key='MAIN_LOGEVENTS_'.$arr['id']; - $value=$conf->global->$key; - print ''; + $key = 'MAIN_LOGEVENTS_'.$arr['id']; + $value = $conf->global->$key; + print ''; print '
'.$langs->trans("UseCaptchaCode").''; if (function_exists("imagecreatefrompng")) { - if (! empty($conf->use_javascript_ajax)) + if (!empty($conf->use_javascript_ajax)) { print ajax_constantonoff('MAIN_SECURITY_ENABLECAPTCHA'); } @@ -142,7 +142,7 @@ print '
'.$langs->trans("UseAdvancedPerms").''; -if (! empty($conf->use_javascript_ajax)) +if (!empty($conf->use_javascript_ajax)) { print ajax_constantonoff('MAIN_USE_ADVANCED_PERMS'); } @@ -173,8 +173,8 @@ print ''.$langs->trans("Value").'
'.$langs->trans("SessionTimeOut").''; print $form->textwithpicto('', $langs->trans("SessionExplanation", ini_get("session.gc_probability"), ini_get("session.gc_divisor"))); @@ -185,8 +185,8 @@ print '
'.$langs->trans("MAIN_APPLICATION_TITLE").''; print '
'; - if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) print ''.$valuetoshow.' '.img_help(1, $valuetoshow).''; - elseif (! empty($tabhelp[$id][$value])) + if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) print ''.$valuetoshow.' '.img_help(1, $valuetoshow).''; + elseif (!empty($tabhelp[$id][$value])) { if ($value == 'virtualhost') print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltipvirtual'); else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]); @@ -479,7 +479,7 @@ if ($id) else print $valuetoshow; print ''; @@ -496,7 +496,7 @@ if ($id) foreach ($fieldlist as $key=>$val) { if (GETPOST($val, 'alpha')) - $obj->$val=GETPOST($val); + $obj->$val = GETPOST($val); } } @@ -510,7 +510,7 @@ if ($id) print '
'; @@ -518,7 +518,7 @@ if ($id) // List of websites in database - $resql=$db->query($sql); + $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); @@ -540,10 +540,10 @@ if ($id) { // Determine le nom du champ par rapport aux noms possibles // dans les dictionnaires de donnees - $showfield=1; // Par defaut - $align="left"; - $sortable=1; - $valuetoshow=''; + $showfield = 1; // Par defaut + $align = "left"; + $sortable = 1; + $valuetoshow = ''; /* $tmparray=getLabelOfField($fieldlist[$field]); $showfield=$tmp['showfield']; @@ -551,20 +551,20 @@ if ($id) $align=$tmp['align']; $sortable=$tmp['sortable']; */ - $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut - $valuetoshow=$langs->trans($valuetoshow); // try to translate - if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); } - if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); } - if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } + $valuetoshow = ucfirst($fieldlist[$field]); // Par defaut + $valuetoshow = $langs->trans($valuetoshow); // try to translate + if ($fieldlist[$field] == 'lang') { $valuetoshow = $langs->trans("Language"); } + if ($fieldlist[$field] == 'type') { $valuetoshow = $langs->trans("Type"); } + if ($fieldlist[$field] == 'code') { $valuetoshow = $langs->trans("Code"); } // Affiche nom du champ if ($showfield) { - print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), "", "align=".$align, $sortfield, $sortorder); + print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), "", "align=".$align, $sortfield, $sortorder); } } - print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "status", ($page?'page='.$page.'&':''), "", 'align="center"', $sortfield, $sortorder); + print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "status", ($page ? 'page='.$page.'&' : ''), "", 'align="center"', $sortfield, $sortorder); print getTitleFieldOfList(''); print getTitleFieldOfList(''); print ''; @@ -575,34 +575,34 @@ if ($id) $obj = $db->fetch_object($resql); //print_r($obj); print ''; - if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code))) + if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) { - $tmpaction='edit'; - $parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); - $reshook=$hookmanager->executeHooks('editWebsiteFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks - $error=$hookmanager->error; $errors=$hookmanager->errors; + $tmpaction = 'edit'; + $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); + $reshook = $hookmanager->executeHooks('editWebsiteFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks + $error = $hookmanager->error; $errors = $hookmanager->errors; if (empty($reshook)) fieldListWebsites($fieldlist, $obj, $tabname[$id], 'edit'); - print ' '; + print ' '; print ' '; } else { $tmpaction = 'view'; - $parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); - $reshook=$hookmanager->executeHooks('viewWebsiteFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks + $parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); + $reshook = $hookmanager->executeHooks('viewWebsiteFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks - $error=$hookmanager->error; $errors=$hookmanager->errors; + $error = $hookmanager->error; $errors = $hookmanager->errors; if (empty($reshook)) { foreach ($fieldlist as $field => $value) { - $showfield=1; - $align="left"; - $fieldname=$fieldlist[$field]; - $valuetoshow=$obj->$fieldname; + $showfield = 1; + $align = "left"; + $fieldname = $fieldlist[$field]; + $valuetoshow = $obj->$fieldname; // Show value for field if ($showfield) print ''.$valuetoshow.''; @@ -610,14 +610,14 @@ if ($id) } // Can an entry be erased or disabled ? - $iserasable=1; $isdisable=1; // true by default - if ($obj->status) $iserasable=0; // We can't delete a website on. Disable it first. + $iserasable = 1; $isdisable = 1; // true by default + if ($obj->status) $iserasable = 0; // We can't delete a website on. Disable it first. - $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'').'&'; + $url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '').'&'; // Active print ''; - print ''.$actl[($obj->status?1:0)].''; + print ''.$actl[($obj->status ? 1 : 0)].''; print ""; // Modify link @@ -660,10 +660,10 @@ $db->close(); */ function fieldListWebsites($fieldlist, $obj = '', $tabname = '', $context = '') { - global $conf,$langs,$db; + global $conf, $langs, $db; global $form; global $region_id; - global $elementList,$sourceList,$localtax_typeList; + global $elementList, $sourceList, $localtax_typeList; global $bc; $formadmin = new FormAdmin($db); @@ -678,18 +678,18 @@ function fieldListWebsites($fieldlist, $obj = '', $tabname = '', $context = '') print ''; } elseif ($fieldlist[$field] == 'code' && isset($obj->$fieldname)) { - print ''; + print ''; } else { print ''; - $size=''; - if ($fieldlist[$field]=='code') $size='size="8" '; - if ($fieldlist[$field]=='position') $size='size="4" '; - if ($fieldlist[$field]=='libelle') $size='size="32" '; - if ($fieldlist[$field]=='tracking') $size='size="92" '; - if ($fieldlist[$field]=='sortorder') $size='size="2" '; - print ''; + $size = ''; + if ($fieldlist[$field] == 'code') $size = 'size="8" '; + if ($fieldlist[$field] == 'position') $size = 'size="4" '; + if ($fieldlist[$field] == 'libelle') $size = 'size="32" '; + if ($fieldlist[$field] == 'tracking') $size = 'size="92" '; + if ($fieldlist[$field] == 'sortorder') $size = 'size="2" '; + print ''; print ''; } } diff --git a/htdocs/cashdesk/tpl/facturation1.tpl.php b/htdocs/cashdesk/tpl/facturation1.tpl.php index b543abefb8b..f1e19b4df20 100644 --- a/htdocs/cashdesk/tpl/facturation1.tpl.php +++ b/htdocs/cashdesk/tpl/facturation1.tpl.php @@ -21,14 +21,14 @@ */ // Protection to avoid direct call of template -if (empty($langs) || ! is_object($langs)) +if (empty($langs) || !is_object($langs)) { print "Error, template page can't be called as URL"; exit; } // Load translation files required by the page -$langs->loadLangs(array("main","bills","cashdesk")); +$langs->loadLangs(array("main", "bills", "cashdesk")); // Object $form must de defined @@ -64,7 +64,7 @@ $id = $obj_facturation->id(); // Si trop d'articles ont ete trouves, on n'affiche que les X premiers (defini dans le fichier de configuration) ... $nbtoshow = $nbr_enreg; -if (! empty($conf_taille_listes) && $nbtoshow > $conf_taille_listes) $nbtoshow = $conf_taille_listes; +if (!empty($conf_taille_listes) && $nbtoshow > $conf_taille_listes) $nbtoshow = $conf_taille_listes; for ($i = 0; $i < $nbtoshow; $i++) { @@ -77,8 +77,8 @@ for ($i = 0; $i < $nbtoshow; $i++) $label = $tab_designations[$i]['label']; print ''."\n"; } @@ -101,19 +101,19 @@ for ($i = 0; $i < $nbtoshow; $i++) - + - + vatrate; // To get vat rate we just have selected + $vatrate = $obj_facturation->vatrate; // To get vat rate we just have selected $buyer = new Societe($db); if ($_SESSION["CASHDESK_ID_THIRDPARTY"] > 0) $buyer->fetch($_SESSION["CASHDESK_ID_THIRDPARTY"]); @@ -152,7 +152,7 @@ for ($i = 0; $i < $nbtoshow; $i++) - + diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index 04e2ec69d88..b9782515735 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -433,7 +433,7 @@ class FormAdvTargetEmailing extends Form dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - $out .= ''; if ($showempty) $out .= ''; $num = $this->db->num_rows($resql); diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 9f1b9c440d1..16279187b97 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -64,7 +64,7 @@ class Contact extends CommonObject /** * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ - public $fields=array( + public $fields = array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>15), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20), @@ -358,7 +358,7 @@ class Contact extends CommonObject if (!$error) { - $result = $this->update($this->id, $user, 1, 'add'); // This include updateRoles(), ... + $result = $this->update($this->id, $user, 1, 'add'); // This include updateRoles(), ... if ($result < 0) { $error++; @@ -1007,7 +1007,7 @@ class Contact extends CommonObject { $this->gender = 'man'; } - elseif(in_array($this->civility_id, array('MME','MLE')) || in_array($this->civility_code, array('MME','MLE'))) + elseif (in_array($this->civility_id, array('MME', 'MLE')) || in_array($this->civility_code, array('MME', 'MLE'))) { $this->gender = 'woman'; } diff --git a/htdocs/core/class/coreobject.class.php b/htdocs/core/class/coreobject.class.php index 82a644eabf2..999b01341f0 100644 --- a/htdocs/core/class/coreobject.class.php +++ b/htdocs/core/class/coreobject.class.php @@ -36,7 +36,7 @@ class CoreObject extends CommonObject /** * @var Array $_fields Fields to synchronize with Database */ - protected $fields=array(); + protected $fields = array(); /** * Constructor @@ -70,8 +70,8 @@ class CoreObject extends CommonObject else $this->{$field} = ''; } - $this->to_delete=false; - $this->is_clone=false; + $this->to_delete = false; + $this->is_clone = false; return true; } @@ -110,7 +110,7 @@ class CoreObject extends CommonObject public function fetch($id, $loadChild = true) { $res = $this->fetchCommon($id); - if($res>0) { + if ($res > 0) { if ($loadChild) $this->fetchChild(); } @@ -129,11 +129,11 @@ class CoreObject extends CommonObject */ public function addChild($tabName, $id = 0, $key = 'id', $try_to_load = false) { - if(!empty($id)) + if (!empty($id)) { - foreach($this->{$tabName} as $k=>&$object) + foreach ($this->{$tabName} as $k=>&$object) { - if($object->{$key} === $id) return $k; + if ($object->{$key} === $id) return $k; } } @@ -141,7 +141,7 @@ class CoreObject extends CommonObject $className = ucfirst($tabName); $this->{$tabName}[$k] = new $className($this->db); - if($id>0 && $key==='id' && $try_to_load) + if ($id > 0 && $key === 'id' && $try_to_load) { $this->{$tabName}[$k]->fetch($id); } @@ -181,20 +181,20 @@ class CoreObject extends CommonObject { if ($this->withChild && !empty($this->childtables) && !empty($this->fk_element)) { - foreach($this->childtables as &$childTable) + foreach ($this->childtables as &$childTable) { $className = ucfirst($childTable); - $this->{$className}=array(); + $this->{$className} = array(); $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.$childTable.' WHERE '.$this->fk_element.' = '.$this->id; $res = $this->db->query($sql); - if($res) + if ($res) { - while($obj = $this->db->fetch_object($res)) + while ($obj = $this->db->fetch_object($res)) { - $o=new $className($this->db); + $o = new $className($this->db); $o->fetch($obj->rowid); $this->{$className}[] = $o; @@ -216,19 +216,19 @@ class CoreObject extends CommonObject */ public function saveChild(User &$user) { - if($this->withChild && !empty($this->childtables) && !empty($this->fk_element)) + if ($this->withChild && !empty($this->childtables) && !empty($this->fk_element)) { - foreach($this->childtables as &$childTable) + foreach ($this->childtables as &$childTable) { $className = ucfirst($childTable); - if(!empty($this->{$className})) + if (!empty($this->{$className})) { - foreach($this->{$className} as $i => &$object) + foreach ($this->{$className} as $i => &$object) { $object->{$this->fk_element} = $this->id; $object->update($user); - if($this->unsetChildDeleted && isset($object->to_delete) && $object->to_delete==true) unset($this->{$className}[$i]); + if ($this->unsetChildDeleted && isset($object->to_delete) && $object->to_delete == true) unset($this->{$className}[$i]); } } } @@ -245,7 +245,7 @@ class CoreObject extends CommonObject public function update(User &$user) { if (empty($this->id)) return $this->create($user); // To test, with that, no need to test on high level object, the core decide it, update just needed - elseif (isset($this->to_delete) && $this->to_delete==true) return $this->delete($user); + elseif (isset($this->to_delete) && $this->to_delete == true) return $this->delete($user); $error = 0; $this->db->begin(); @@ -253,7 +253,7 @@ class CoreObject extends CommonObject $res = $this->updateCommon($user); if ($res) { - $result = $this->call_trigger(strtoupper($this->element). '_UPDATE', $user); + $result = $this->call_trigger(strtoupper($this->element).'_UPDATE', $user); if ($result < 0) $error++; else $this->saveChild($user); } @@ -284,17 +284,17 @@ class CoreObject extends CommonObject */ public function create(User &$user) { - if($this->id > 0) return $this->update($user); + if ($this->id > 0) return $this->update($user); $error = 0; $this->db->begin(); $res = $this->createCommon($user); - if($res) + if ($res) { $this->id = $this->db->last_insert_id($this->table_element); - $result = $this->call_trigger(strtoupper($this->element). '_CREATE', $user); + $result = $this->call_trigger(strtoupper($this->element).'_CREATE', $user); if ($result < 0) $error++; else $this->saveChild($user); } @@ -330,20 +330,20 @@ class CoreObject extends CommonObject $error = 0; $this->db->begin(); - $result = $this->call_trigger(strtoupper($this->element). '_DELETE', $user); + $result = $this->call_trigger(strtoupper($this->element).'_DELETE', $user); if ($result < 0) $error++; if (!$error) { $this->deleteCommon($user); - if($this->withChild && !empty($this->childtables)) + if ($this->withChild && !empty($this->childtables)) { - foreach($this->childtables as &$childTable) + foreach ($this->childtables as &$childTable) { $className = ucfirst($childTable); if (!empty($this->{$className})) { - foreach($this->{$className} as &$object) + foreach ($this->{$className} as &$object) { $object->delete($user); } @@ -376,7 +376,7 @@ class CoreObject extends CommonObject */ public function getDate($field, $format = '') { - if(empty($this->{$field})) return ''; + if (empty($this->{$field})) return ''; else { return dol_print_date($this->{$field}, $format); diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index df9d4798c63..2a538aa3b47 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -767,7 +767,7 @@ class FormCompany extends Form if ($rendermode === 'edit') { - $contactType = $contact->listeTypeContacts('external', '', 1, '', '', 'agenda'); // We exclude agenda as there is no contact on such element + $contactType = $contact->listeTypeContacts('external', '', 1, '', '', 'agenda'); // We exclude agenda as there is no contact on such element if (count($selected) > 0) { $newselected = array(); foreach ($selected as $key=>$val) { diff --git a/htdocs/core/login/functions_openid.php b/htdocs/core/login/functions_openid.php index 87a8acfd800..a401dfd7764 100644 --- a/htdocs/core/login/functions_openid.php +++ b/htdocs/core/login/functions_openid.php @@ -36,11 +36,11 @@ include_once DOL_DOCUMENT_ROOT.'/core/class/openid.class.php'; */ function check_user_password_openid($usertotest, $passwordtotest, $entitytotest) { - global $_POST,$db,$conf,$langs; + global $_POST, $db, $conf, $langs; dol_syslog("functions_openid::check_user_password_openid usertotest=".$usertotest); - $login=''; + $login = ''; // Get identity from user and redirect browser to OpenID Server if (GETPOSISSET('username')) @@ -48,14 +48,14 @@ function check_user_password_openid($usertotest, $passwordtotest, $entitytotest) $openid = new SimpleOpenID(); $openid->SetIdentity($_POST['username']); $protocol = ($conf->file->main_force_https ? 'https://' : 'http://'); - $openid->SetTrustRoot($protocol . $_SERVER["HTTP_HOST"]); - $openid->SetRequiredFields(array('email','fullname')); + $openid->SetTrustRoot($protocol.$_SERVER["HTTP_HOST"]); + $openid->SetRequiredFields(array('email', 'fullname')); $_SESSION['dol_entity'] = $_POST["entity"]; //$openid->SetOptionalFields(array('dob','gender','postcode','country','language','timezone')); if ($openid->sendDiscoveryRequestToGetXRDS()) { - $openid->SetApprovedURL($protocol . $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"]); // Send Response from OpenID server to this script - $openid->Redirect(); // This will redirect user to OpenID Server + $openid->SetApprovedURL($protocol.$_SERVER["HTTP_HOST"].$_SERVER["SCRIPT_NAME"]); // Send Response from OpenID server to this script + $openid->Redirect(); // This will redirect user to OpenID Server } else { @@ -65,7 +65,7 @@ function check_user_password_openid($usertotest, $passwordtotest, $entitytotest) return false; } // Perform HTTP Request to OpenID server to validate key - elseif($_GET['openid_mode'] == 'id_res') + elseif ($_GET['openid_mode'] == 'id_res') { $openid = new SimpleOpenID(); $openid->SetIdentity($_GET['openid_identity']); @@ -74,23 +74,23 @@ function check_user_password_openid($usertotest, $passwordtotest, $entitytotest) { // OK HERE KEY IS VALID - $sql ="SELECT login"; - $sql.=" FROM ".MAIN_DB_PREFIX."user"; - $sql.=" WHERE openid = '".$db->escape($_GET['openid_identity'])."'"; - $sql.=" AND entity IN (0," . ($_SESSION["dol_entity"] ? $_SESSION["dol_entity"] : 1) . ")"; + $sql = "SELECT login"; + $sql .= " FROM ".MAIN_DB_PREFIX."user"; + $sql .= " WHERE openid = '".$db->escape($_GET['openid_identity'])."'"; + $sql .= " AND entity IN (0,".($_SESSION["dol_entity"] ? $_SESSION["dol_entity"] : 1).")"; dol_syslog("functions_openid::check_user_password_openid", LOG_DEBUG); - $resql=$db->query($sql); + $resql = $db->query($sql); if ($resql) { - $obj=$db->fetch_object($resql); + $obj = $db->fetch_object($resql); if ($obj) { - $login=$obj->login; + $login = $obj->login; } } } - elseif($openid->IsError() === true) + elseif ($openid->IsError() === true) { // ON THE WAY, WE GOT SOME ERROR $error = $openid->GetError(); diff --git a/htdocs/core/modules/mailings/modules_mailings.php b/htdocs/core/modules/mailings/modules_mailings.php index 9d66ae32e5f..ffba2571d23 100644 --- a/htdocs/core/modules/mailings/modules_mailings.php +++ b/htdocs/core/modules/mailings/modules_mailings.php @@ -39,9 +39,9 @@ class MailingTargets // This can't be abstract as it is used for some method /** * @var string Error code (or message) */ - public $error=''; + public $error = ''; - public $tooltip=''; + public $tooltip = ''; /** @@ -64,12 +64,12 @@ class MailingTargets // This can't be abstract as it is used for some method global $langs, $form; $langs->load("mails"); - $transstring="MailingModuleDesc".$this->name; - $s=''; + $transstring = "MailingModuleDesc".$this->name; + $s = ''; - if ($langs->trans($this->name) != $this->name) $s=$langs->trans($this->name); - elseif ($langs->trans($transstring) != $transstring) $s=$langs->trans($transstring); - else $s=$this->desc; + if ($langs->trans($this->name) != $this->name) $s = $langs->trans($this->name); + elseif ($langs->trans($transstring) != $transstring) $s = $langs->trans($transstring); + else $s = $this->desc; if ($this->tooltip && is_object($form)) $s .= ' '.$form->textwithpicto('', $langs->trans($this->tooltip), 1, 1); return $s; @@ -93,7 +93,7 @@ class MailingTargets // This can't be abstract as it is used for some method */ public function getNbOfRecipients($sql) { - $result=$this->db->query($sql); + $result = $this->db->query($sql); if ($result) { $obj = $this->db->fetch_object($result); @@ -101,7 +101,7 @@ class MailingTargets // This can't be abstract as it is used for some method } else { - $this->error=$this->db->lasterror(); + $this->error = $this->db->lasterror(); return -1; } } @@ -130,18 +130,18 @@ class MailingTargets // This can't be abstract as it is used for some method // Mise a jour nombre de destinataire dans table des mailings $sql = "SELECT COUNT(*) nb FROM ".MAIN_DB_PREFIX."mailing_cibles"; $sql .= " WHERE fk_mailing = ".$mailing_id; - $result=$this->db->query($sql); + $result = $this->db->query($sql); if ($result) { - $obj=$this->db->fetch_object($result); - $nb=$obj->nb; + $obj = $this->db->fetch_object($result); + $nb = $obj->nb; $sql = "UPDATE ".MAIN_DB_PREFIX."mailing"; $sql .= " SET nbemail = ".$nb." WHERE rowid = ".$mailing_id; if (!$this->db->query($sql)) { dol_syslog($this->db->error()); - $this->error=$this->db->error(); + $this->error = $this->db->error(); return -1; } } @@ -169,26 +169,26 @@ class MailingTargets // This can't be abstract as it is used for some method $num = count($cibles); foreach ($cibles as $targetarray) { - if (! empty($targetarray['email'])) // avoid empty email address + if (!empty($targetarray['email'])) // avoid empty email address { $sql = "INSERT INTO ".MAIN_DB_PREFIX."mailing_cibles"; - $sql.= " (fk_mailing,"; - $sql.= " fk_contact,"; - $sql.= " lastname, firstname, email, other, source_url, source_id,"; - $sql.= " tag,"; - $sql.= " source_type)"; - $sql.= " VALUES (".$mailing_id.","; - $sql.= (empty($targetarray['fk_contact']) ? '0' : "'".$targetarray['fk_contact']."'") .","; - $sql.= "'".$this->db->escape($targetarray['lastname'])."',"; - $sql.= "'".$this->db->escape($targetarray['firstname'])."',"; - $sql.= "'".$this->db->escape($targetarray['email'])."',"; - $sql.= "'".$this->db->escape($targetarray['other'])."',"; - $sql.= "'".$this->db->escape($targetarray['source_url'])."',"; - $sql.= (empty($targetarray['source_id']) ? 'null' : "'".$this->db->escape($targetarray['source_id'])."'").","; + $sql .= " (fk_mailing,"; + $sql .= " fk_contact,"; + $sql .= " lastname, firstname, email, other, source_url, source_id,"; + $sql .= " tag,"; + $sql .= " source_type)"; + $sql .= " VALUES (".$mailing_id.","; + $sql .= (empty($targetarray['fk_contact']) ? '0' : "'".$targetarray['fk_contact']."'").","; + $sql .= "'".$this->db->escape($targetarray['lastname'])."',"; + $sql .= "'".$this->db->escape($targetarray['firstname'])."',"; + $sql .= "'".$this->db->escape($targetarray['email'])."',"; + $sql .= "'".$this->db->escape($targetarray['other'])."',"; + $sql .= "'".$this->db->escape($targetarray['source_url'])."',"; + $sql .= (empty($targetarray['source_id']) ? 'null' : "'".$this->db->escape($targetarray['source_id'])."'").","; $sql .= "'".$this->db->escape(dol_hash($targetarray['email'].';'.$targetarray['lastname'].';'.$mailing_id.';'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY))."',"; $sql .= "'".$this->db->escape($targetarray['source_type'])."')"; dol_syslog(__METHOD__, LOG_DEBUG); - $result=$this->db->query($sql); + $result = $this->db->query($sql); if ($result) { $j++; @@ -199,7 +199,7 @@ class MailingTargets // This can't be abstract as it is used for some method { // Si erreur autre que doublon dol_syslog($this->db->error().' : '.$targetarray['email']); - $this->error=$this->db->error().' : '.$targetarray['email']; + $this->error = $this->db->error().' : '.$targetarray['email']; $this->db->rollback(); return -1; } @@ -232,8 +232,8 @@ class MailingTargets // This can't be abstract as it is used for some method $sql .= " WHERE fk_mailing=".$mailing_id." AND email IN (SELECT mu.email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe AS mu WHERE mu.entity IN ('".getEntity('mailing')."'))"; dol_syslog(__METHOD__.":mailing update status to display emails that do not want to be contacted anymore", LOG_DEBUG); - $result=$this->db->query($sql); - if (! $result) + $result = $this->db->query($sql); + if (!$result) { dol_print_error($this->db); } @@ -258,7 +258,7 @@ class MailingTargets // This can't be abstract as it is used for some method $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles"; $sql .= " WHERE fk_mailing = ".$mailing_id; - if (! $this->db->query($sql)) + if (!$this->db->query($sql)) { dol_syslog($this->db->error()); } diff --git a/htdocs/core/modules/oauth/github_oauthcallback.php b/htdocs/core/modules/oauth/github_oauthcallback.php index e84fd023c78..4320481abb1 100644 --- a/htdocs/core/modules/oauth/github_oauthcallback.php +++ b/htdocs/core/modules/oauth/github_oauthcallback.php @@ -29,8 +29,8 @@ use OAuth\Common\Consumer\Credentials; use OAuth\OAuth2\Service\GitHub; // Define $urlwithroot -$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); -$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file +$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); +$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current @@ -70,8 +70,8 @@ $credentials = new Credentials( $currentUri->getAbsoluteUri() ); -$requestedpermissionsarray=array(); -if (GETPOST('state')) $requestedpermissionsarray=explode(',', GETPOST('state')); // Example: 'user'. 'state' parameter is standard to retrieve some parameters back +$requestedpermissionsarray = array(); +if (GETPOST('state')) $requestedpermissionsarray = explode(',', GETPOST('state')); // Example: 'user'. 'state' parameter is standard to retrieve some parameters back if ($action != 'delete' && empty($requestedpermissionsarray)) { print 'Error, parameter state is not defined'; @@ -99,11 +99,11 @@ if ($action == 'delete') setEventMessages($langs->trans('TokenDeleted'), null, 'mesgs'); - header('Location: ' . $backtourl); + header('Location: '.$backtourl); exit(); } -if (! empty($_GET['code'])) // We are coming from oauth provider page +if (!empty($_GET['code'])) // We are coming from oauth provider page { // We should have //$_GET=array('code' => string 'aaaaaaaaaaaaaa' (length=20), 'state' => string 'user,public_repo' (length=16)) @@ -132,12 +132,12 @@ if (! empty($_GET['code'])) // We are coming from oauth provider page // parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri) // has not the ending parameter to true like the Google class constructor. - setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token + setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token $backtourl = $_SESSION["backtourlsavedbeforeoauthjump"]; unset($_SESSION["backtourlsavedbeforeoauthjump"]); - header('Location: ' . $backtourl); + header('Location: '.$backtourl); exit(); } catch (Exception $e) { print $e->getMessage(); @@ -145,7 +145,7 @@ if (! empty($_GET['code'])) // We are coming from oauth provider page } else // If entry on page with no parameter, we arrive here { - $_SESSION["backtourlsavedbeforeoauthjump"]=$backtourl; + $_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl; // This may create record into oauth_state before the header redirect. // Creation of record with state in this tables depend on the Provider used (see its constructor). @@ -155,11 +155,11 @@ else // If entry on page with no parameter, we arrive here } else { - $url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated + $url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated } // we go on oauth provider authorization page - header('Location: ' . $url); + header('Location: '.$url); exit(); } diff --git a/htdocs/core/modules/oauth/google_oauthcallback.php b/htdocs/core/modules/oauth/google_oauthcallback.php index 4a313b6736b..68aba389f31 100644 --- a/htdocs/core/modules/oauth/google_oauthcallback.php +++ b/htdocs/core/modules/oauth/google_oauthcallback.php @@ -29,8 +29,8 @@ use OAuth\Common\Consumer\Credentials; use OAuth\OAuth2\Service\Google; // Define $urlwithroot -$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); -$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file +$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); +$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current @@ -70,8 +70,8 @@ $credentials = new Credentials( $currentUri->getAbsoluteUri() ); -$requestedpermissionsarray=array(); -if (GETPOST('state')) $requestedpermissionsarray=explode(',', GETPOST('state')); // Example: 'userinfo_email,userinfo_profile,cloud_print'. 'state' parameter is standard to store a hash value and can be used to retrieve some parameters back +$requestedpermissionsarray = array(); +if (GETPOST('state')) $requestedpermissionsarray = explode(',', GETPOST('state')); // Example: 'userinfo_email,userinfo_profile,cloud_print'. 'state' parameter is standard to store a hash value and can be used to retrieve some parameters back if ($action != 'delete' && empty($requestedpermissionsarray)) { print 'Error, parameter state is not defined'; @@ -105,11 +105,11 @@ if ($action == 'delete') setEventMessages($langs->trans('TokenDeleted'), null, 'mesgs'); - header('Location: ' . $backtourl); + header('Location: '.$backtourl); exit(); } -if (! empty($_GET['code'])) // We are coming from oauth provider page +if (!empty($_GET['code'])) // We are coming from oauth provider page { dol_syslog("We are coming from the oauth provider page"); //llxHeader('',$langs->trans("OAuthSetup")); @@ -130,12 +130,12 @@ if (! empty($_GET['code'])) // We are coming from oauth provider page $token = $apiService->requestAccessToken($_GET['code'], $state); - setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token + setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token $backtourl = $_SESSION["backtourlsavedbeforeoauthjump"]; unset($_SESSION["backtourlsavedbeforeoauthjump"]); - header('Location: ' . $backtourl); + header('Location: '.$backtourl); exit(); } catch (Exception $e) { print $e->getMessage(); @@ -143,7 +143,7 @@ if (! empty($_GET['code'])) // We are coming from oauth provider page } else // If entry on page with no parameter, we arrive here { - $_SESSION["backtourlsavedbeforeoauthjump"]=$backtourl; + $_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl; // This may create record into oauth_state before the header redirect. // Creation of record with state in this tables depend on the Provider used (see its constructor). @@ -153,11 +153,11 @@ else // If entry on page with no parameter, we arrive here } else { - $url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated + $url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated } // we go on oauth provider authorization page - header('Location: ' . $url); + header('Location: '.$url); exit(); } diff --git a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php index 0ee3cdb73ab..b51fd0a20b7 100644 --- a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php +++ b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php @@ -26,7 +26,7 @@ * \ingroup agenda * \brief Trigger file for company - contactroles */ -require_once DOL_DOCUMENT_ROOT . '/core/triggers/dolibarrtriggers.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; /** * Class of triggered functions for agenda module @@ -71,23 +71,23 @@ class InterfaceContactRoles extends DolibarrTriggers if ($action === 'PROPAL_CREATE' || $action === 'ORDER_CREATE' || $action === 'BILL_CREATE' || $action === 'ORDER_SUPPLIER_CREATE' || $action === 'BILL_SUPPLIER_CREATE' || $action === 'PROPOSAL_SUPPLIER_CREATE' || $action === 'CONTRACT_CREATE' || $action === 'FICHINTER_CREATE' || $action === 'PROJECT_CREATE' || $action === 'TICKET_CREATE') { - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $socid = (property_exists($object, 'socid') ? $object->socid : $object->fk_soc); - if (! empty($socid) && $socid > 0) { - require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; + if (!empty($socid) && $socid > 0) { + require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; $contactdefault = new Contact($this->db); $contactdefault->socid = $socid; $TContact = $contactdefault->getContactRoles($object->element); - if (is_array($TContact) && ! empty($TContact)) { + if (is_array($TContact) && !empty($TContact)) { $TContactAlreadyLinked = array(); if ($object->id > 0) { $cloneFrom = dol_clone($object, 1); - if (! empty($cloneFrom->id)) { - $TContactAlreadyLinked = array_merge($cloneFrom->liste_contact(- 1, 'external'), $cloneFrom->liste_contact(- 1, 'internal')); + if (!empty($cloneFrom->id)) { + $TContactAlreadyLinked = array_merge($cloneFrom->liste_contact(-1, 'external'), $cloneFrom->liste_contact(-1, 'internal')); } } @@ -102,7 +102,7 @@ class InterfaceContactRoles extends DolibarrTriggers foreach ($TContact as $infos) { $res = $object->add_contact($infos['fk_socpeople'], $infos['type_contact']); if ($res > 0) - $nb ++; + $nb++; } if ($nb > 0) { diff --git a/htdocs/don/payment/payment.php b/htdocs/don/payment/payment.php index 4992c9f8495..b3ab7e2d360 100644 --- a/htdocs/don/payment/payment.php +++ b/htdocs/don/payment/payment.php @@ -29,12 +29,12 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $langs->load("bills"); -$chid=GETPOST("rowid"); -$action=GETPOST('action', 'aZ09'); +$chid = GETPOST("rowid"); +$action = GETPOST('action', 'aZ09'); $amounts = array(); // Security check -$socid=0; +$socid = 0; if ($user->socid > 0) { $socid = $user->socid; } @@ -48,7 +48,7 @@ $object = new Don($db); if ($action == 'add_payment') { - $error=0; + $error = 0; if ($_POST["cancel"]) { @@ -59,7 +59,7 @@ if ($action == 'add_payment') $datepaid = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); - if (! $_POST["paymenttype"] > 0) + if (!$_POST["paymenttype"] > 0) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode")), null, 'errors'); $error++; @@ -69,13 +69,13 @@ if ($action == 'add_payment') setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors'); $error++; } - if (! empty($conf->banque->enabled) && ! $_POST["accountid"] > 0) + if (!empty($conf->banque->enabled) && !$_POST["accountid"] > 0) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountToCredit")), null, 'errors'); $error++; } - if (! $error) + if (!$error) { $paymentid = 0; @@ -92,11 +92,11 @@ if ($action == 'add_payment') if (count($amounts) <= 0) { $error++; - $errmsg='ErrorNoPaymentDefined'; + $errmsg = 'ErrorNoPaymentDefined'; setEventMessages($errmsg, null, 'errors'); } - if (! $error) + if (!$error) { $db->begin(); @@ -104,34 +104,34 @@ if ($action == 'add_payment') $payment = new PaymentDonation($db); $payment->chid = $chid; $payment->datepaid = $datepaid; - $payment->amounts = $amounts; // Tableau de montant + $payment->amounts = $amounts; // Tableau de montant $payment->paymenttype = GETPOST("paymenttype", 'int'); $payment->num_payment = GETPOST("num_payment", 'alphanohtml'); $payment->note_public = GETPOST("note_public", 'none'); - if (! $error) + if (!$error) { $paymentid = $payment->create($user); if ($paymentid < 0) { - $errmsg=$payment->error; + $errmsg = $payment->error; setEventMessages($errmsg, null, 'errors'); $error++; } } - if (! $error) + if (!$error) { - $result=$payment->addPaymentToBank($user, 'payment_donation', '(DonationPayment)', $_POST['accountid'], '', ''); - if (! $result > 0) + $result = $payment->addPaymentToBank($user, 'payment_donation', '(DonationPayment)', $_POST['accountid'], '', ''); + if (!$result > 0) { - $errmsg=$payment->error; + $errmsg = $payment->error; setEventMessages($errmsg, null, 'errors'); $error++; } } - if (! $error) + if (!$error) { $db->commit(); $loc = DOL_URL_ROOT.'/don/card.php?rowid='.$chid; @@ -153,18 +153,18 @@ if ($action == 'add_payment') * View */ -$form=new Form($db); +$form = new Form($db); llxHeader(); $sql = "SELECT sum(p.amount) as total"; -$sql.= " FROM ".MAIN_DB_PREFIX."payment_donation as p"; -$sql.= " WHERE p.fk_donation = ".$chid; +$sql .= " FROM ".MAIN_DB_PREFIX."payment_donation as p"; +$sql .= " WHERE p.fk_donation = ".$chid; $resql = $db->query($sql); if ($resql) { - $obj=$db->fetch_object($resql); + $obj = $db->fetch_object($resql); $sumpaid = $obj->total; $db->free(); } @@ -191,7 +191,7 @@ if ($action == 'create') print ''.$langs->trans("Date").''; $datepaid = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); - $datepayment=empty($conf->global->MAIN_AUTOFILL_DATE)?(empty($_POST["remonth"])?-1:$datepaid):0; + $datepayment = empty($conf->global->MAIN_AUTOFILL_DATE) ? (empty($_POST["remonth"]) ?-1 : $datepaid) : 0; print $form->selectDate($datepayment, '', 0, 0, 0, "add_payment", 1, 1, 0, '', '', $object->date, '', 1, $langs->trans("DonationDate")); print ""; print ''; @@ -204,7 +204,7 @@ if ($action == 'create') print ''; print ''.$langs->trans('AccountToCredit').''; print ''; - $form->select_comptes(GETPOSTISSET("accountid") ? GETPOST("accountid") : $object->accountid, "accountid", 0, '', 1); // Show open bank account list + $form->select_comptes(GETPOSTISSET("accountid") ? GETPOST("accountid") : $object->accountid, "accountid", 0, '', 1); // Show open bank account list print ''; // Number @@ -238,8 +238,8 @@ if ($action == 'create') print ''.$langs->trans("Amount").''; print "\n"; - $total=0; - $totalrecu=0; + $total = 0; + $totalrecu = 0; while ($i < $num) { diff --git a/htdocs/expensereport/class/expensereport_ik.class.php b/htdocs/expensereport/class/expensereport_ik.class.php index a62d033af2d..c7bf959e27e 100644 --- a/htdocs/expensereport/class/expensereport_ik.class.php +++ b/htdocs/expensereport/class/expensereport_ik.class.php @@ -32,17 +32,17 @@ class ExpenseReportIk extends CoreObject /** * @var string ID to identify managed object */ - public $element='expenseik'; + public $element = 'expenseik'; /** * @var string Name of table without prefix where object is stored */ - public $table_element='expensereport_ik'; + public $table_element = 'expensereport_ik'; /** * @var int Field with ID of parent key if this field has a parent */ - public $fk_element='fk_expense_ik'; + public $fk_element = 'fk_expense_ik'; /** * c_exp_tax_cat Id @@ -72,10 +72,10 @@ class ExpenseReportIk extends CoreObject * Attribute object linked with database * @var array */ - public $fields=array( - 'rowid'=>array('type'=>'integer','index'=>true) - ,'fk_c_exp_tax_cat'=>array('type'=>'integer','index'=>true) - ,'fk_range'=>array('type'=>'integer','index'=>true) + public $fields = array( + 'rowid'=>array('type'=>'integer', 'index'=>true) + ,'fk_c_exp_tax_cat'=>array('type'=>'integer', 'index'=>true) + ,'fk_range'=>array('type'=>'integer', 'index'=>true) ,'coef'=>array('type'=>'double') ,'ikoffset'=>array('type'=>'double') ); @@ -109,10 +109,10 @@ class ExpenseReportIk extends CoreObject $categories = array(); $sql = 'SELECT rowid, label, entity, active'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'c_exp_tax_cat'; - $sql.= ' WHERE entity IN ('. getEntity('c_exp_tax_cat').')'; - if ($mode == 1) $sql.= ' AND active = 1'; - elseif ($mode == 2) $sql.= 'AND active = 0'; + $sql .= ' FROM '.MAIN_DB_PREFIX.'c_exp_tax_cat'; + $sql .= ' WHERE entity IN ('.getEntity('c_exp_tax_cat').')'; + if ($mode == 1) $sql .= ' AND active = 1'; + elseif ($mode == 2) $sql .= 'AND active = 0'; dol_syslog(get_called_class().'::getTaxCategories sql='.$sql, LOG_DEBUG); $resql = $db->query($sql); @@ -144,8 +144,8 @@ class ExpenseReportIk extends CoreObject $ranges = self::getRangesByCategory($fk_c_exp_tax_cat); // substract 1 because array start from 0 - if (empty($ranges) || !isset($ranges[$default_range-1])) return false; - else return $ranges[$default_range-1]; + if (empty($ranges) || !isset($ranges[$default_range - 1])) return false; + else return $ranges[$default_range - 1]; } /** @@ -162,10 +162,10 @@ class ExpenseReportIk extends CoreObject $ranges = array(); $sql = 'SELECT r.rowid FROM '.MAIN_DB_PREFIX.'c_exp_tax_range r'; - if ($active) $sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'c_exp_tax_cat c ON (r.fk_c_exp_tax_cat = c.rowid)'; - $sql.= ' WHERE r.fk_c_exp_tax_cat = '.$fk_c_exp_tax_cat; - if ($active) $sql.= ' AND r.active = 1 AND c.active = 1'; - $sql.= ' ORDER BY r.range_ik'; + if ($active) $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'c_exp_tax_cat c ON (r.fk_c_exp_tax_cat = c.rowid)'; + $sql .= ' WHERE r.fk_c_exp_tax_cat = '.$fk_c_exp_tax_cat; + if ($active) $sql .= ' AND r.active = 1 AND c.active = 1'; + $sql .= ' ORDER BY r.range_ik'; dol_syslog(get_called_class().'::getRangesByCategory sql='.$sql, LOG_DEBUG); $resql = $db->query($sql); @@ -203,11 +203,11 @@ class ExpenseReportIk extends CoreObject $ranges = array(); $sql = ' SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, c.label, i.rowid as fk_expense_ik, r.active as range_active, c.active as cat_active'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'c_exp_tax_range r'; - $sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'c_exp_tax_cat c ON (r.fk_c_exp_tax_cat = c.rowid)'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'expensereport_ik i ON (r.rowid = i.fk_range)'; - $sql.= ' WHERE r.entity IN (0, '. getEntity('').')'; - $sql.= ' ORDER BY r.fk_c_exp_tax_cat, r.range_ik'; + $sql .= ' FROM '.MAIN_DB_PREFIX.'c_exp_tax_range r'; + $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'c_exp_tax_cat c ON (r.fk_c_exp_tax_cat = c.rowid)'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'expensereport_ik i ON (r.rowid = i.fk_range)'; + $sql .= ' WHERE r.entity IN (0, '.getEntity('').')'; + $sql .= ' ORDER BY r.fk_c_exp_tax_cat, r.range_ik'; dol_syslog(get_called_class().'::getAllRanges sql='.$sql, LOG_DEBUG); $resql = $db->query($sql); @@ -239,14 +239,14 @@ class ExpenseReportIk extends CoreObject */ public static function getMaxRangeNumber($default_c_exp_tax_cat = 0) { - global $db,$conf; + global $db, $conf; $sql = 'SELECT MAX(counted) as nbRange FROM ('; - $sql.= ' SELECT COUNT(*) as counted'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'c_exp_tax_range r'; - $sql.= ' WHERE r.entity IN (0, '.$conf->entity.')'; + $sql .= ' SELECT COUNT(*) as counted'; + $sql .= ' FROM '.MAIN_DB_PREFIX.'c_exp_tax_range r'; + $sql .= ' WHERE r.entity IN (0, '.$conf->entity.')'; if ($default_c_exp_tax_cat > 0) $sql .= ' AND r.fk_c_exp_tax_cat = '.$default_c_exp_tax_cat; - $sql.= ' GROUP BY r.fk_c_exp_tax_cat'; + $sql .= ' GROUP BY r.fk_c_exp_tax_cat'; $sql .= ') as counts'; dol_syslog(get_called_class().'::getMaxRangeNumber sql='.$sql, LOG_DEBUG); diff --git a/htdocs/expensereport/class/expensereport_rule.class.php b/htdocs/expensereport/class/expensereport_rule.class.php index 08538ac8f61..b98552f681d 100644 --- a/htdocs/expensereport/class/expensereport_rule.class.php +++ b/htdocs/expensereport/class/expensereport_rule.class.php @@ -32,17 +32,17 @@ class ExpenseReportRule extends CoreObject /** * @var string ID to identify managed object */ - public $element='expenserule'; + public $element = 'expenserule'; /** * @var string Name of table without prefix where object is stored */ - public $table_element='expensereport_rules'; + public $table_element = 'expensereport_rules'; /** * @var int Field with ID of parent key if this field has a parent */ - public $fk_element='fk_expense_rule'; + public $fk_element = 'fk_expense_rule'; /** * date start @@ -111,8 +111,8 @@ class ExpenseReportRule extends CoreObject * Attribute object linked with database * @var array */ - public $fields=array( - 'rowid'=>array('type'=>'integer','index'=>true) + public $fields = array( + 'rowid'=>array('type'=>'integer', 'index'=>true) ,'dates'=>array('type'=>'date') ,'datee'=>array('type'=>'date') ,'amount'=>array('type'=>'double') @@ -154,25 +154,25 @@ class ExpenseReportRule extends CoreObject $rules = array(); $sql = 'SELECT er.rowid'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'expensereport_rules er'; - $sql.= ' WHERE er.entity IN (0,'. getEntity('').')'; + $sql .= ' FROM '.MAIN_DB_PREFIX.'expensereport_rules er'; + $sql .= ' WHERE er.entity IN (0,'.getEntity('').')'; if (!empty($fk_c_type_fees)) { - $sql.= ' AND er.fk_c_type_fees IN (-1, '.$fk_c_type_fees.')'; + $sql .= ' AND er.fk_c_type_fees IN (-1, '.$fk_c_type_fees.')'; } if (!empty($date)) { $date = dol_print_date($date, '%Y-%m-%d'); - $sql.= ' AND er.dates <= \''.$date.'\''; - $sql.= ' AND er.datee >= \''.$date.'\''; + $sql .= ' AND er.dates <= \''.$date.'\''; + $sql .= ' AND er.datee >= \''.$date.'\''; } if ($fk_user > 0) { - $sql.= ' AND (er.is_for_all = 1'; - $sql.= ' OR er.fk_user = '.$fk_user; - $sql.= ' OR er.fk_usergroup IN (SELECT ugu.fk_usergroup FROM '.MAIN_DB_PREFIX.'usergroup_user ugu WHERE ugu.fk_user = '.$fk_user.') )'; + $sql .= ' AND (er.is_for_all = 1'; + $sql .= ' OR er.fk_user = '.$fk_user; + $sql .= ' OR er.fk_usergroup IN (SELECT ugu.fk_usergroup FROM '.MAIN_DB_PREFIX.'usergroup_user ugu WHERE ugu.fk_user = '.$fk_user.') )'; } - $sql.= ' ORDER BY er.is_for_all, er.fk_usergroup, er.fk_user'; + $sql .= ' ORDER BY er.is_for_all, er.fk_usergroup, er.fk_user'; dol_syslog("ExpenseReportRule::getAllRule sql=".$sql); diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index ad2c981b8b9..6543747d1f7 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -411,7 +411,7 @@ if ($step == 4 && $action == 'submitFormField') $newcode = (string) preg_replace('/\./', '_', $code); //print 'xxx'.$code."=".$newcode."=".$type."=".$_POST[$newcode]."\n
"; $filterqualified = 1; - if (! GETPOSTISSET($newcode) || GETPOST($newcode, 'restricthtml') == '') $filterqualified = 0; + if (!GETPOSTISSET($newcode) || GETPOST($newcode, 'restricthtml') == '') $filterqualified = 0; elseif (preg_match('/^List/', $type) && (is_numeric(GETPOST($newcode, 'restricthtml')) && GETPOST($newcode, 'restricthtml') <= 0)) $filterqualified = 0; if ($filterqualified) { diff --git a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php index c8654a14d28..b6aa0399447 100644 --- a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php @@ -18,19 +18,19 @@ dol_include_once("/mymodule/class/myobject.class.php"); class mailing_mailinglist_mymodule_myobject extends MailingTargets { // CHANGE THIS: Put here a name not already used - public $name='mailinglist_mymodule_myobject'; + public $name = 'mailinglist_mymodule_myobject'; // CHANGE THIS: Put here a description of your selector module - public $desc='My object emailing target selector'; + public $desc = 'My object emailing target selector'; // CHANGE THIS: Set to 1 if selector is available for admin users only - public $require_admin=0; + public $require_admin = 0; - public $enabled=0; - public $require_module=array(); + public $enabled = 0; + public $require_module = array(); /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ - public $picto='mymodule@mymodule'; + public $picto = 'mymodule@mymodule'; /** * @var DoliDB Database handler. @@ -47,10 +47,10 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets { global $conf; - $this->db=$db; + $this->db = $db; if (is_array($conf->modules)) { - $this->enabled=in_array('mymodule', $conf->modules)?1:0; + $this->enabled = in_array('mymodule', $conf->modules) ? 1 : 0; } } @@ -65,20 +65,20 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets global $langs; $langs->load("members"); - $form=new Form($this->db); + $form = new Form($this->db); - $arraystatus=array(1=>'Option 1', 2=>'Option 2'); + $arraystatus = array(1=>'Option 1', 2=>'Option 2'); - $s=''; - $s.=$langs->trans("Status").': '; - $s.=''; + $s .= ''; + foreach ($arraystatus as $status) { - $s.=''; + $s .= ''; } - $s.=''; - $s.='
'; + $s .= ''; + $s .= '
'; return $s; } @@ -110,13 +110,13 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets $j = 0; $sql = " select rowid as id, email, firstname, lastname, plan, partner"; - $sql.= " from ".MAIN_DB_PREFIX."myobject"; - $sql.= " where email IS NOT NULL AND email != ''"; - if (GETPOSTISSET('filter') && GETPOST('filter', 'alphanohtml') != 'none') $sql.= " AND status = '".$this->db->escape(GETPOST('filter', 'alphanohtml'))."'"; - $sql.= " ORDER BY email"; + $sql .= " from ".MAIN_DB_PREFIX."myobject"; + $sql .= " where email IS NOT NULL AND email != ''"; + if (GETPOSTISSET('filter') && GETPOST('filter', 'alphanohtml') != 'none') $sql .= " AND status = '".$this->db->escape(GETPOST('filter', 'alphanohtml'))."'"; + $sql .= " ORDER BY email"; // Stocke destinataires dans target - $result=$this->db->query($sql); + $result = $this->db->query($sql); if ($result) { $num = $this->db->num_rows($result); @@ -150,7 +150,7 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets else { dol_syslog($this->db->error()); - $this->error=$this->db->error(); + $this->error = $this->db->error(); return -1; } @@ -197,7 +197,7 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets */ public function getNbOfRecipients($filter = 1, $option = '') { - $a=parent::getNbOfRecipients("select count(distinct(email)) as nb from ".MAIN_DB_PREFIX."myobject as p where email IS NOT NULL AND email != ''"); + $a = parent::getNbOfRecipients("select count(distinct(email)) as nb from ".MAIN_DB_PREFIX."myobject as p where email IS NOT NULL AND email != ''"); if ($a < 0) return -1; return $a; diff --git a/htdocs/product/admin/dynamic_prices.php b/htdocs/product/admin/dynamic_prices.php index 73ab40c75b8..a50e22315d5 100644 --- a/htdocs/product/admin/dynamic_prices.php +++ b/htdocs/product/admin/dynamic_prices.php @@ -63,9 +63,9 @@ if ($action == 'edit_updater') { if (!empty($action) && empty($cancel)) { //Global variable actions if ($action == 'create_variable' || $action == 'edit_variable') { - $price_globals->code = GETPOSTISSET('code')?GETPOST('code', 'alpha'):$price_globals->code; - $price_globals->description = GETPOSTISSET('description')?GETPOST('description', 'alpha'):$price_globals->description; - $price_globals->value = GETPOSTISSET('value')?GETPOST('value', 'int'):$price_globals->value; + $price_globals->code = GETPOSTISSET('code') ?GETPOST('code', 'alpha') : $price_globals->code; + $price_globals->description = GETPOSTISSET('description') ?GETPOST('description', 'alpha') : $price_globals->description; + $price_globals->value = GETPOSTISSET('value') ?GETPOST('value', 'int') : $price_globals->value; //Check if record already exists only when saving if (!empty($save)) { foreach ($price_globals->listGlobalVariables() as $entry) { @@ -101,11 +101,11 @@ if (!empty($action) && empty($cancel)) { //Updaters actions if ($action == 'create_updater' || $action == 'edit_updater') { - $price_updaters->type = GETPOSTISSET('type')?GETPOST('type', 'int'):$price_updaters->type; - $price_updaters->description = GETPOSTISSET('description')?GETPOST('description', 'alpha'):$price_updaters->description; - $price_updaters->parameters = GETPOSTISSET('parameters')?GETPOST('parameters'):$price_updaters->parameters; - $price_updaters->fk_variable = GETPOSTISSET('fk_variable')?GETPOST('fk_variable', 'int'):$price_updaters->fk_variable; - $price_updaters->update_interval = GETPOSTISSET('update_interval')?GETPOST('update_interval', 'int'):$price_updaters->update_interval; + $price_updaters->type = GETPOSTISSET('type') ?GETPOST('type', 'int') : $price_updaters->type; + $price_updaters->description = GETPOSTISSET('description') ?GETPOST('description', 'alpha') : $price_updaters->description; + $price_updaters->parameters = GETPOSTISSET('parameters') ?GETPOST('parameters') : $price_updaters->parameters; + $price_updaters->fk_variable = GETPOSTISSET('fk_variable') ?GETPOST('fk_variable', 'int') : $price_updaters->fk_variable; + $price_updaters->update_interval = GETPOSTISSET('update_interval') ?GETPOST('update_interval', 'int') : $price_updaters->update_interval; } if ($action == 'create_updater' && !empty($save)) { //Verify if process() works @@ -150,7 +150,7 @@ $form = new Form($db); llxHeader("", "", $langs->trans("CardProduct".$product->type)); -$linkback=''.$langs->trans("BackToModuleList").''; +$linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("DynamicPriceConfiguration"), $linkback, 'title_setup'); print ''.$langs->trans("DynamicPriceDesc").'
'; @@ -169,8 +169,8 @@ if ($action != 'create_updater' && $action != 'edit_updater') print ' '; //Space for buttons print ''; - $arrayglobalvars=$price_globals->listGlobalVariables(); - if (! empty($arrayglobalvars)) + $arrayglobalvars = $price_globals->listGlobalVariables(); + if (!empty($arrayglobalvars)) { foreach ($arrayglobalvars as $i=>$entry) { $var = !$var; @@ -215,17 +215,17 @@ if ($action == 'create_variable' || $action == 'edit_variable') { //Code print ''; print ''.$langs->trans("Variable").''; - print ''; + print ''; print ''; //Description print ''; print ''.$langs->trans("Description").''; - print ''; + print ''; print ''; //Value print ''; print ''.$langs->trans("Value").''; - print ''; + print ''; print ''; print ''; @@ -254,7 +254,7 @@ if ($action != 'create_variable' && $action != 'edit_variable') print ''; $arraypriceupdaters = $price_updaters->listUpdaters(); - if (! empty($arraypriceupdaters)) + if (!empty($arraypriceupdaters)) { foreach ($arraypriceupdaters as $i=>$entry) { $code = ""; @@ -308,19 +308,19 @@ if ($action == 'create_updater' || $action == 'edit_updater') { print ''.$langs->trans("VariableToUpdate").''; $globals_list = array(); foreach ($price_globals->listGlobalVariables() as $entry) { - $globals_list[$entry->id]=$entry->code; + $globals_list[$entry->id] = $entry->code; } - print $form->selectarray('fk_variable', $globals_list, (empty($price_updaters->fk_variable)?0:$price_updaters->fk_variable)); + print $form->selectarray('fk_variable', $globals_list, (empty($price_updaters->fk_variable) ? 0 : $price_updaters->fk_variable)); print ''; //Description print ''; print ''.$langs->trans("Description").''; - print ''; + print ''; print ''; //Type print ''; print ''.$langs->trans("Type").''; - $type = empty($price_updaters->type)?0:$price_updaters->type; + $type = empty($price_updaters->type) ? 0 : $price_updaters->type; $type_list = array(); foreach ($price_updaters->types as $val) { $type_list[$val] = $langs->trans("GlobalVariableUpdaterType".$val); @@ -342,14 +342,14 @@ if ($action == 'create_updater' || $action == 'edit_updater') { $help = $langs->trans("GlobalVariableUpdaterHelp".$type).'
'.$langs->trans("GlobalVariableUpdaterHelpFormat".$type).''; print ''.$form->textwithpicto($langs->trans("Parameters"), $help, 1).''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('parameters', empty($price_updaters->parameters)?'':$price_updaters->parameters, '', 300, '', '', false, false, false, ROWS_8, '90%'); + $doleditor = new DolEditor('parameters', empty($price_updaters->parameters) ? '' : $price_updaters->parameters, '', 300, '', '', false, false, false, ROWS_8, '90%'); $doleditor->Create(); print ''; print ''; //Interval print ''; print ''.$langs->trans("UpdateInterval").''; - print ''; + print ''; print ''; print ''; diff --git a/htdocs/product/class/propalmergepdfproduct.class.php b/htdocs/product/class/propalmergepdfproduct.class.php index fd8cb125c22..2a2eaa86d23 100644 --- a/htdocs/product/class/propalmergepdfproduct.class.php +++ b/htdocs/product/class/propalmergepdfproduct.class.php @@ -34,22 +34,22 @@ class Propalmergepdfproduct extends CommonObject /** * @var string ID to identify managed object */ - public $element='propal_merge_pdf_product'; + public $element = 'propal_merge_pdf_product'; /** * @var string Name of table without prefix where object is stored */ - public $table_element='propal_merge_pdf_product'; + public $table_element = 'propal_merge_pdf_product'; public $fk_product; public $file_name; public $fk_user_author; public $fk_user_mod; - public $datec=''; - public $tms=''; + public $datec = ''; + public $tms = ''; public $lang; - public $lines=array(); + public $lines = array(); @@ -75,16 +75,16 @@ class Propalmergepdfproduct extends CommonObject public function create($user, $notrigger = 0) { global $conf, $langs; - $error=0; + $error = 0; // Clean parameters - if (isset($this->fk_product)) $this->fk_product=trim($this->fk_product); - if (isset($this->file_name)) $this->file_name=trim($this->file_name); - if (isset($this->fk_user_author)) $this->fk_user_author=trim($this->fk_user_author); - if (isset($this->fk_user_mod)) $this->fk_user_mod=trim($this->fk_user_mod); - if (isset($this->lang)) $this->lang=trim($this->lang); - if (isset($this->import_key)) $this->import_key=trim($this->import_key); + if (isset($this->fk_product)) $this->fk_product = trim($this->fk_product); + if (isset($this->file_name)) $this->file_name = trim($this->file_name); + if (isset($this->fk_user_author)) $this->fk_user_author = trim($this->fk_user_author); + if (isset($this->fk_user_mod)) $this->fk_user_mod = trim($this->fk_user_mod); + if (isset($this->lang)) $this->lang = trim($this->lang); + if (isset($this->import_key)) $this->import_key = trim($this->import_key); @@ -94,41 +94,41 @@ class Propalmergepdfproduct extends CommonObject // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."propal_merge_pdf_product("; - $sql.= "fk_product,"; - $sql.= "file_name,"; + $sql .= "fk_product,"; + $sql .= "file_name,"; if ($conf->global->MAIN_MULTILANGS) { - $sql.= "lang,"; + $sql .= "lang,"; } - $sql.= "fk_user_author,"; - $sql.= "fk_user_mod,"; - $sql.= "datec"; + $sql .= "fk_user_author,"; + $sql .= "fk_user_mod,"; + $sql .= "datec"; - $sql.= ") VALUES ("; + $sql .= ") VALUES ("; - $sql.= " ".(! isset($this->fk_product)?'NULL':"'".$this->db->escape($this->fk_product)."'").","; - $sql.= " ".(! isset($this->file_name)?'NULL':"'".$this->db->escape($this->file_name)."'").","; + $sql .= " ".(!isset($this->fk_product) ? 'NULL' : "'".$this->db->escape($this->fk_product)."'").","; + $sql .= " ".(!isset($this->file_name) ? 'NULL' : "'".$this->db->escape($this->file_name)."'").","; if ($conf->global->MAIN_MULTILANGS) { - $sql.= " ".(! isset($this->lang)?'NULL':"'".$this->db->escape($this->lang)."'").","; + $sql .= " ".(!isset($this->lang) ? 'NULL' : "'".$this->db->escape($this->lang)."'").","; } - $sql.= " ".$user->id.","; - $sql.= " ".$user->id.","; - $sql.= " '".$this->db->idate(dol_now())."'"; + $sql .= " ".$user->id.","; + $sql .= " ".$user->id.","; + $sql .= " '".$this->db->idate(dol_now())."'"; - $sql.= ")"; + $sql .= ")"; $this->db->begin(); dol_syslog(__METHOD__, LOG_DEBUG); - $resql=$this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + $resql = $this->db->query($sql); + if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } - if (! $error) + if (!$error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."propal_merge_pdf_product"); - if (! $notrigger) + if (!$notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -145,13 +145,13 @@ class Propalmergepdfproduct extends CommonObject // Commit or rollback if ($error) { - foreach($this->errors as $errmsg) + foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); } $this->db->rollback(); - return -1*$error; + return -1 * $error; } else { @@ -169,33 +169,33 @@ class Propalmergepdfproduct extends CommonObject */ public function fetch($id) { - global $langs,$conf; + global $langs, $conf; $sql = "SELECT"; - $sql.= " t.rowid,"; + $sql .= " t.rowid,"; - $sql.= " t.fk_product,"; - $sql.= " t.file_name,"; - $sql.= " t.lang,"; - $sql.= " t.fk_user_author,"; - $sql.= " t.fk_user_mod,"; - $sql.= " t.datec,"; - $sql.= " t.tms,"; - $sql.= " t.import_key"; + $sql .= " t.fk_product,"; + $sql .= " t.file_name,"; + $sql .= " t.lang,"; + $sql .= " t.fk_user_author,"; + $sql .= " t.fk_user_mod,"; + $sql .= " t.datec,"; + $sql .= " t.tms,"; + $sql .= " t.import_key"; - $sql.= " FROM ".MAIN_DB_PREFIX."propal_merge_pdf_product as t"; - $sql.= " WHERE t.rowid = ".$id; + $sql .= " FROM ".MAIN_DB_PREFIX."propal_merge_pdf_product as t"; + $sql .= " WHERE t.rowid = ".$id; dol_syslog(__METHOD__, LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { if ($this->db->num_rows($resql)) { $obj = $this->db->fetch_object($resql); - $this->id = $obj->rowid; + $this->id = $obj->rowid; $this->fk_product = $obj->fk_product; $this->file_name = $obj->file_name; @@ -214,7 +214,7 @@ class Propalmergepdfproduct extends CommonObject } else { - $this->error="Error ".$this->db->lasterror(); + $this->error = "Error ".$this->db->lasterror(); dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; } @@ -231,37 +231,37 @@ class Propalmergepdfproduct extends CommonObject public function fetch_by_product($product_id, $lang = '') { // phpcs:enable - global $langs,$conf; + global $langs, $conf; $sql = "SELECT"; - $sql.= " t.rowid,"; + $sql .= " t.rowid,"; - $sql.= " t.fk_product,"; - $sql.= " t.file_name,"; - $sql.= " t.lang,"; - $sql.= " t.fk_user_author,"; - $sql.= " t.fk_user_mod,"; - $sql.= " t.datec,"; - $sql.= " t.tms,"; - $sql.= " t.import_key"; + $sql .= " t.fk_product,"; + $sql .= " t.file_name,"; + $sql .= " t.lang,"; + $sql .= " t.fk_user_author,"; + $sql .= " t.fk_user_mod,"; + $sql .= " t.datec,"; + $sql .= " t.tms,"; + $sql .= " t.import_key"; - $sql.= " FROM ".MAIN_DB_PREFIX."propal_merge_pdf_product as t"; - $sql.= " WHERE t.fk_product = ".$product_id; + $sql .= " FROM ".MAIN_DB_PREFIX."propal_merge_pdf_product as t"; + $sql .= " WHERE t.fk_product = ".$product_id; if ($conf->global->MAIN_MULTILANGS && !empty($lang)) { - $sql.= " AND t.lang = '".$lang."'"; + $sql .= " AND t.lang = '".$lang."'"; } dol_syslog(__METHOD__, LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { if ($this->db->num_rows($resql)) { - while($obj = $this->db->fetch_object($resql)) { + while ($obj = $this->db->fetch_object($resql)) { $line = new PropalmergepdfproductLine(); - $line->id = $obj->rowid; + $line->id = $obj->rowid; $line->fk_product = $obj->fk_product; $line->file_name = $obj->file_name; @@ -276,9 +276,9 @@ class Propalmergepdfproduct extends CommonObject if ($conf->global->MAIN_MULTILANGS) { - $this->lines[$obj->file_name.'_'.$obj->lang]=$line; - }else { - $this->lines[$obj->file_name]=$line; + $this->lines[$obj->file_name.'_'.$obj->lang] = $line; + } else { + $this->lines[$obj->file_name] = $line; } } } @@ -288,7 +288,7 @@ class Propalmergepdfproduct extends CommonObject } else { - $this->error="Error ".$this->db->lasterror(); + $this->error = "Error ".$this->db->lasterror(); dol_syslog(get_class($this)."::fetch_by_product ".$this->error, LOG_ERR); return -1; } @@ -305,14 +305,14 @@ class Propalmergepdfproduct extends CommonObject public function update($user = 0, $notrigger = 0) { global $conf, $langs; - $error=0; + $error = 0; // Clean parameters - if (isset($this->fk_product)) $this->fk_product=trim($this->fk_product); - if (isset($this->file_name)) $this->file_name=trim($this->file_name); - if (isset($this->fk_user_mod)) $this->fk_user_mod=trim($this->fk_user_mod); - if (isset($this->lang)) $this->lang=trim($this->lang); + if (isset($this->fk_product)) $this->fk_product = trim($this->fk_product); + if (isset($this->file_name)) $this->file_name = trim($this->file_name); + if (isset($this->fk_user_mod)) $this->fk_user_mod = trim($this->fk_user_mod); + if (isset($this->lang)) $this->lang = trim($this->lang); // Check parameters // Put here code to add a control on parameters values @@ -320,21 +320,21 @@ class Propalmergepdfproduct extends CommonObject // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."propal_merge_pdf_product SET"; - $sql.= " fk_product=".(isset($this->fk_product)?$this->fk_product:"null").","; - $sql.= " file_name=".(isset($this->file_name)?"'".$this->db->escape($this->file_name)."'":"null").","; + $sql .= " fk_product=".(isset($this->fk_product) ? $this->fk_product : "null").","; + $sql .= " file_name=".(isset($this->file_name) ? "'".$this->db->escape($this->file_name)."'" : "null").","; if ($conf->global->MAIN_MULTILANGS) { - $sql.= " lang=".(isset($this->lang)?"'".$this->db->escape($this->lang)."'":"null").","; + $sql .= " lang=".(isset($this->lang) ? "'".$this->db->escape($this->lang)."'" : "null").","; } - $sql.= " fk_user_mod=".$user->id; + $sql .= " fk_user_mod=".$user->id; - $sql.= " WHERE rowid=".$this->id; + $sql .= " WHERE rowid=".$this->id; $this->db->begin(); dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } //if (! $error) //{ @@ -355,13 +355,13 @@ class Propalmergepdfproduct extends CommonObject // Commit or rollback if ($error) { - foreach($this->errors as $errmsg) + foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); } $this->db->rollback(); - return -1*$error; + return -1 * $error; } else { @@ -381,13 +381,13 @@ class Propalmergepdfproduct extends CommonObject public function delete($user, $notrigger = 0) { global $conf, $langs; - $error=0; + $error = 0; $this->db->begin(); - if (! $error) + if (!$error) { - if (! $notrigger) + if (!$notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -401,26 +401,26 @@ class Propalmergepdfproduct extends CommonObject } } - if (! $error) + if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."propal_merge_pdf_product"; - $sql.= " WHERE rowid=".$this->id; + $sql .= " WHERE rowid=".$this->id; dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } } // Commit or rollback if ($error) { - foreach($this->errors as $errmsg) + foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); } $this->db->rollback(); - return -1*$error; + return -1 * $error; } else { @@ -443,7 +443,7 @@ class Propalmergepdfproduct extends CommonObject { // phpcs:enable global $conf, $langs; - $error=0; + $error = 0; $this->db->begin(); @@ -463,30 +463,30 @@ class Propalmergepdfproduct extends CommonObject // } //} - if (! $error) + if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."propal_merge_pdf_product"; - $sql.= " WHERE fk_product=".$product_id; + $sql .= " WHERE fk_product=".$product_id; if ($conf->global->MAIN_MULTILANGS && !empty($lang_id)) { - $sql.= " AND lang='".$lang_id."'"; + $sql .= " AND lang='".$lang_id."'"; } dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } } // Commit or rollback if ($error) { - foreach($this->errors as $errmsg) + foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); } $this->db->rollback(); - return -1*$error; + return -1 * $error; } else { @@ -506,7 +506,7 @@ class Propalmergepdfproduct extends CommonObject { // phpcs:enable global $conf, $langs; - $error=0; + $error = 0; $this->db->begin(); @@ -526,26 +526,26 @@ class Propalmergepdfproduct extends CommonObject // } //} - if (! $error) + if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."propal_merge_pdf_product"; - $sql.= " WHERE fk_product=".$this->fk_product." AND file_name='".$this->db->escape($this->file_name)."'"; + $sql .= " WHERE fk_product=".$this->fk_product." AND file_name='".$this->db->escape($this->file_name)."'"; dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } } // Commit or rollback if ($error) { - foreach($this->errors as $errmsg) + foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); } $this->db->rollback(); - return -1*$error; + return -1 * $error; } else { @@ -565,40 +565,40 @@ class Propalmergepdfproduct extends CommonObject */ public function createFromClone(User $user, $fromid) { - $error=0; + $error = 0; - $object=new Propalmergepdfproduct($this->db); + $object = new Propalmergepdfproduct($this->db); $this->db->begin(); // Load source object $object->fetch($fromid); - $object->id=0; - $object->statut=0; + $object->id = 0; + $object->statut = 0; // Clear fields // ... // Create clone - $object->context['createfromclone']='createfromclone'; - $result=$object->create($user); + $object->context['createfromclone'] = 'createfromclone'; + $result = $object->create($user); // Other options if ($result < 0) { - $this->error=$object->error; - $this->errors=array_merge($this->errors, $object->errors); + $this->error = $object->error; + $this->errors = array_merge($this->errors, $object->errors); $error++; } - if (! $error) + if (!$error) { } unset($object->context['createfromclone']); // End - if (! $error) + if (!$error) { $this->db->commit(); return $object->id; @@ -619,15 +619,15 @@ class Propalmergepdfproduct extends CommonObject */ public function initAsSpecimen() { - $this->id=0; + $this->id = 0; - $this->fk_product=''; - $this->file_name=''; - $this->fk_user_author=''; - $this->fk_user_mod=''; - $this->datec=''; - $this->tms=''; - $this->import_key=''; + $this->fk_product = ''; + $this->file_name = ''; + $this->fk_user_author = ''; + $this->fk_user_mod = ''; + $this->datec = ''; + $this->tms = ''; + $this->import_key = ''; } } @@ -659,8 +659,8 @@ class PropalmergepdfproductLine */ public $fk_user_mod; - public $datec=''; - public $tms=''; + public $datec = ''; + public $tms = ''; public $import_key; /** diff --git a/htdocs/variants/ajax/orderAttribute.php b/htdocs/variants/ajax/orderAttribute.php index 6b697b1c38c..8b851c9be6b 100644 --- a/htdocs/variants/ajax/orderAttribute.php +++ b/htdocs/variants/ajax/orderAttribute.php @@ -16,12 +16,12 @@ * along with this program. If not, see . */ -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disable token renewal -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); -if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); -if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); -if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); -if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disable token renewal +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); +if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); +if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); +if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); require '../../main.inc.php'; @@ -34,7 +34,7 @@ top_httphead(); // Registering the location of boxes if (GETPOSTISSET('roworder')) { - $roworder=GETPOST('roworder', 'alpha', 2); + $roworder = GETPOST('roworder', 'alpha', 2); dol_syslog("AjaxOrderAttribute roworder=".$roworder, LOG_DEBUG); From 973539db3960094f7ac13734986cdcf53813329b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Feb 2020 23:59:53 +0100 Subject: [PATCH 714/784] Update index.php --- htdocs/projet/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 25c7029f8d5..cd82f25d4d8 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -165,8 +165,8 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useles include DOL_DOCUMENT_ROOT.'/projet/graph_opportunities.inc.php'; -// List of validated projects -print_projecttasks_array($db, $form, $socid, $projectsListId, 0, 1, $listofoppstatus, array('plannedworkload', 'declaredprogress')); +// List of draft projects +print_projecttasks_array($db, $form, $socid, $projectsListId, 0, 0, $listofoppstatus, array('projectlabel', 'plannedworkload', 'declaredprogress')); print '
'; From 4b6c936f72d06ebbe27f0b5bfe45959c962c4978 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Feb 2020 00:56:45 +0100 Subject: [PATCH 715/784] Fix stale process --- .github/workflows/stale-issues.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/stale-issues.yml b/.github/workflows/stale-issues.yml index de9fd8d2e4e..3e2f9b06a35 100644 --- a/.github/workflows/stale-issues.yml +++ b/.github/workflows/stale-issues.yml @@ -12,8 +12,6 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: 'This issue is stale because it has been open 1 year with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. Without comment, this issue will be closed automatically by stale bot in 15 days.' stale-issue-label: 'Issue Stale (automatic label)' - exempt-issue-label: - - 'Bug Security (CVE)' - - 'Priority High / Blocking' + exempt-issue-label: 'Priority High / Blocking' days-before-stale: 365 days-before-close: 10 From 5e355f786eaa37ced04b5d7975edb9da1a837068 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Feb 2020 01:05:29 +0100 Subject: [PATCH 716/784] Update stale bot --- .github/workflows/stale-issues.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/stale-issues.yml b/.github/workflows/stale-issues.yml index 3e2f9b06a35..4d15f84b3f8 100644 --- a/.github/workflows/stale-issues.yml +++ b/.github/workflows/stale-issues.yml @@ -15,3 +15,7 @@ jobs: exempt-issue-label: 'Priority High / Blocking' days-before-stale: 365 days-before-close: 10 + #stale-pr-message: 'This PR is stale because it has been open 1 year with no activity. If this PR is still mergeable (no conflict, nor Continuous Integration errors), please comment to confirm this merge is still expected. Without comment, this issue will be closed automatically by stale bot in 15 days.' + #stale-pr-label: 'PR Stale (automatic label)' + #exempt-pr-label: 'Priority Top Strategic' + \ No newline at end of file From 016c7ad875c571e659e1bf9bd7719e3ae06b28f9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Feb 2020 01:17:16 +0100 Subject: [PATCH 717/784] FIX #13135 --- htdocs/core/class/CMailFile.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index f794c76bcac..6127a7d6044 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -144,6 +144,9 @@ class CMailFile } } + // Add autocopy to (Note: Adding bcc for specific modules are also done from pages) + if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) $addr_bcc .= ($addr_bcc ? ', ' : '').$conf->global->MAIN_MAIL_AUTOCOPY_TO; + $this->subject = $subject; $this->addr_to = $to; $this->addr_from = $from; @@ -268,9 +271,6 @@ class CMailFile } } - // Add autocopy to (Note: Adding bcc for specific modules are also done from pages) - if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) $addr_bcc .= ($addr_bcc ? ', ' : '').$conf->global->MAIN_MAIL_AUTOCOPY_TO; - // We set all data according to choosed sending method. // We also set a value for ->msgid if ($this->sendmode == 'mail') From 43b173ef76e2873313b9becd5ec6aacb04546b24 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Feb 2020 01:23:54 +0100 Subject: [PATCH 718/784] FIX #13131 --- htdocs/compta/facture/card.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 34134f49d79..2f1941ff836 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -101,6 +101,9 @@ $usehm = (!empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? $conf->global- $object = new Facture($db); $extrafields = new ExtraFields($db); +// Fetch optionals attributes and labels +$extrafields->fetch_name_optionals_label($object->table_element); + // Load object if ($id > 0 || !empty($ref)) { if ($action != 'add') { @@ -138,6 +141,7 @@ $result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isd + /* * Actions */ From 7c07589850526007767f8e93866b2356e7145265 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Feb 2020 03:07:12 +0100 Subject: [PATCH 719/784] FIX #13124 --- htdocs/core/class/html.form.class.php | 5 +- htdocs/core/lib/ajax.lib.php | 1 + htdocs/core/tpl/objectline_create.tpl.php | 68 ++++++++++++++--------- 3 files changed, 45 insertions(+), 29 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 73e9ae0709b..83fd976f627 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2432,6 +2432,7 @@ class Form $outlabel = $objp->label; $outdesc = $objp->description; $outbarcode = $objp->barcode; + $outpbq = empty($objp->price_by_qty_rowid) ? '' : $objp->price_by_qty_rowid; $outtype = $objp->fk_product_type; $outdurationvalue = $outtype == Product::TYPE_SERVICE ?substr($objp->duration, 0, dol_strlen($objp->duration) - 1) : ''; @@ -2479,7 +2480,7 @@ class Form $opt .= ($objp->rowid == $selected) ? ' selected' : ''; if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) { - $opt .= ' pbq="'.$objp->price_by_qty_rowid.'" data-pbq="'.$objp->price_by_qty_rowid.'" data-pbqqty="'.$objp->price_by_qty_quantity.'" data-pbqpercent="'.$objp->price_by_qty_remise_percent.'"'; + $opt .= ' pbq="'.$objp->price_by_qty_rowid.'" data-pbq="'.$objp->price_by_qty_rowid.'" data-pbqup="'.$objp->price_by_qty_unitprice.'" data-pbqbase="'.$objp->price_by_qty_price_base_type.'" data-pbqqty="'.$objp->price_by_qty_quantity.'" data-pbqpercent="'.$objp->price_by_qty_remise_percent.'"'; } if (!empty($conf->stock->enabled) && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) { @@ -2665,7 +2666,7 @@ class Form } $opt .= "\n"; - $optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>price2num($outprice_ht), 'price_ttc'=>price2num($outprice_ttc), 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit); + $optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>price2num($outprice_ht), 'price_ttc'=>price2num($outprice_ttc), 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit, 'pbq'=>$outpbq); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index d2626414ba6..a430a1612af 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -107,6 +107,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen } } }); + $("input#search_'.$htmlname.'").autocomplete({ source: function( request, response ) { $.get("'.$url.($urloption?'?'.$urloption:'').'", { '.$htmlname.': request.term }, function(data){ diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index b60c48da09c..6fd135af821 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -541,6 +541,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) else if (npRate == "np_markRate") price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100)); } + $("input[name='price_ht']:first").val(price); // TODO Must use a function like php price to have here a formated value return true; @@ -552,26 +553,26 @@ if (!empty($usemargins) && $user->rights->margins->creer) /* JQuery for product free or predefined select */ jQuery(document).ready(function() { - jQuery("#price_ht").keyup(function(event) { - // console.log(event.which); // discard event tag and arrows - if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery("#price_ht").val() != '') { - jQuery("#price_ttc").val(''); - jQuery("#multicurrency_subprice").val(''); - } + jQuery("#price_ht").keyup(function(event) { + // console.log(event.which); // discard event tag and arrows + if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery("#price_ht").val() != '') { + jQuery("#price_ttc").val(''); + jQuery("#multicurrency_subprice").val(''); + } }); jQuery("#price_ttc").keyup(function(event) { - // console.log(event.which); // discard event tag and arrows - if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') { - jQuery("#price_ht").val(''); - jQuery("#multicurrency_subprice").val(''); - } + // console.log(event.which); // discard event tag and arrows + if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') { + jQuery("#price_ht").val(''); + jQuery("#multicurrency_subprice").val(''); + } }); jQuery("#multicurrency_subprice").keyup(function(event) { - // console.log(event.which); // discard event tag and arrows - if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') { - jQuery("#price_ht").val(''); - jQuery("#price_ttc").val(''); - } + // console.log(event.which); // discard event tag and arrows + if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') { + jQuery("#price_ht").val(''); + jQuery("#price_ttc").val(''); + } }); $("#prod_entry_mode_free").on( "click", function() { @@ -630,15 +631,24 @@ if (!empty($usemargins) && $user->rights->margins->creer) if (empty($conf->global->MAIN_DISABLE_EDIT_PREDEF_PRICEHT) && empty($senderissupplier)) { ?> - // Get the HT price for the product and display it - console.log("Load price without tax and set it into #price_ht"); - $.post('/product/ajax/products.php?action=fetch', - { 'id': $(this).val(), 'socid' : socid; ?> }, - function(data) { jQuery("#price_ht").val(data.price_ht); }, - 'json' - ); + var pbq = parseInt($('option:selected', this).attr('data-pbq')); + if ((jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val()) && ! isNaN(pbq) && pbq > 0) + { + console.log("We are in a price per qty context, we do not call ajax/product"); + } else { + // Get the HT price for the product and display it + console.log("Load price without tax and set it into #price_ht for id="+$(this).val()+" socid=socid; ?>"); + $.post('/product/ajax/products.php?action=fetch', + { 'id': $(this).val(), 'socid': socid; ?> }, + function(data) { + jQuery("#price_ht").val(data.price_ht); + }, + 'json' + ); + } rights->margins->creer) { $langs->load('stocks'); @@ -744,15 +754,20 @@ if (!empty($usemargins) && $user->rights->margins->creer) } ?> - /* To process customer price per quantity */ + /* To process customer price per quantity (CUSTOMER_PRICE_PER_QTY works only if combo product is not an ajax after x key pressed) */ var pbq = parseInt($('option:selected', this).attr('data-pbq')); + var pbqup = parseInt($('option:selected', this).attr('data-pbqup')); + var pbqbase = $('option:selected', this).attr('data-pbqbase'); var pbqqty = parseFloat($('option:selected', this).attr('data-pbqqty')); var pbqpercent = parseFloat($('option:selected', this).attr('data-pbqpercent')); - if ((jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val()) && typeof pbq !== "undefined") + if ((jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val()) && ! isNaN(pbq) && pbq > 0) { - console.log("We choose a price by quanty price_by_qty id = "+pbq+" price_by_qty qty = "+pbqqty+" price_by_qty percent = "+pbqpercent); + var pbqupht = pbqup; /* TODO support of price per qty TTC not yet available */ + + console.log("We choose a price by quanty price_by_qty id = "+pbq+" price_by_qty upht = "+pbqupht+" price_by_qty qty = "+pbqqty+" price_by_qty percent = "+pbqpercent); jQuery("#pbq").val(pbq); + jQuery("#price_ht").val(pbqupht); if (jQuery("#qty").val() < pbqqty) { jQuery("#qty").val(pbqqty); @@ -809,7 +824,6 @@ if (!empty($usemargins) && $user->rights->margins->creer) jQuery("#price_ht").val('').hide(); jQuery("#multicurrency_price_ht").val('').hide(); - jQuery("#price_ht").val(''); jQuery("#price_ttc, #fourn_ref, #tva_tx, #title_vat, #title_up_ht_currency, #title_up_ttc, #title_up_ttc_currency").hide(); jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").hide(); jQuery("#buying_price").show(); From d0d352be1af0d6e4c76dd78c1e20e5b0800853a6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Feb 2020 03:37:28 +0100 Subject: [PATCH 720/784] FIX #13118 --- htdocs/compta/paiement.php | 10 +++++++--- htdocs/fourn/facture/paiement.php | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 5b297eed309..b00ef1d9a0a 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -95,6 +95,8 @@ if (empty($reshook)) $totalpayment = 0; $multicurrency_totalpayment = 0; $atleastonepaymentnotnull = 0; + $formquestion = array(); + $i = 0; // Generate payment array and check if there is payment higher than invoice and payment date before invoice date $tmpinvoice = new Facture($db); @@ -214,7 +216,7 @@ if (empty($reshook)) { $error = 0; - $datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); + $datepaye = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $db->begin(); @@ -260,8 +262,10 @@ if (empty($reshook)) $paiement->amounts = $amounts; // Array with all payments dispatching with invoice id $paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching $paiement->paiementid = dol_getIdFromCode($db, GETPOST('paiementcode'), 'c_paiement', 'code', 'id', 1); - $paiement->num_paiement = GETPOST('num_paiement', 'alpha'); - $paiement->note = GETPOST('comment', 'alpha'); + $paiement->num_payment = GETPOST('num_paiement', 'alpha'); + $paiement->note_private = GETPOST('comment', 'alpha'); + $paiement->num_paiement = $paiement->num_payment; // For bacward compatibility + $paiement->note = $paiement->note_private; // For bacward compatibility if (!$error) { diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index e9198ebcc91..19fed7a3387 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -297,9 +297,13 @@ if (empty($reshook)) $paiement->datepaye = $datepaye; $paiement->amounts = $amounts; // Array of amounts $paiement->multicurrency_amounts = $multicurrency_amounts; - $paiement->paiementid = $_POST['paiementid']; - $paiement->num_paiement = $_POST['num_paiement']; - $paiement->note = $_POST['comment']; + $paiement->paiementid = GETPOST('paiementid', 'int'); + + $paiement->num_payment = GETPOST('num_paiement', 'alpha'); + $paiement->note_private = GETPOST('comment', 'alpha'); + $paiement->num_paiement = $paiement->num_payment; // For bacward compatibility + $paiement->note = $paiement->note_private; // For bacward compatibility + if (!$error) { $paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices') == 'on' ? 1 : 0), $thirdparty); From 34d7fb887fff25636b983f75ae21842b5421da07 Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Wed, 19 Feb 2020 08:50:49 +0100 Subject: [PATCH 721/784] Show project Ref support if enable Add search and Project Ref column in the list, only if project module is enable. --- htdocs/compta/sociales/list.php | 36 ++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 5f7f7d0fc0a..6e7277c2f93 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php' require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; // Load translation files required by the page $langs->loadLangs(array('compta', 'banks', 'bills')); @@ -53,6 +54,11 @@ $search_day_lim = GETPOST('search_day_lim', 'int'); $search_month_lim = GETPOST('search_month_lim', 'int'); $search_year_lim = GETPOST('search_year_lim', 'int'); +if (! empty($conf->projet->enabled)) { + $search_project_ref=GETPOST('search_project_ref', 'alpha'); + $search_project=GETPOST('search_project', 'alpha'); +} + $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); @@ -95,6 +101,11 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_month_lim=''; $toselect=''; $search_array_options=array(); + + if (! empty($conf->projet->enabled)) { + $search_project_ref=''; + $search_project=''; + } } @@ -106,21 +117,25 @@ $form = new Form($db); $formother = new FormOther($db); $formsocialcontrib = new FormSocialContrib($db); $chargesociale_static=new ChargeSociales($db); +if (! empty($conf->projet->enabled)) $projectstatic=new Project($db); llxHeader('', $langs->trans("SocialContributions")); $sql = "SELECT cs.rowid as id, cs.fk_type as type, "; $sql.= " cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode,"; +if (! empty($conf->projet->enabled)) $sql.= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,"; $sql.= " c.libelle as type_lib,"; $sql.= " SUM(pc.amount) as alreadypayed"; $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,"; $sql.= " ".MAIN_DB_PREFIX."chargesociales as cs"; +if (! empty($conf->projet->enabled)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = cs.fk_projet"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid"; $sql.= " WHERE cs.fk_type = c.id"; $sql.= " AND cs.entity = ".$conf->entity; // Search criteria if ($search_ref) $sql.=" AND cs.rowid=".$db->escape($search_ref); if ($search_label) $sql.=natural_search("cs.libelle", $search_label); +if (! empty($conf->projet->enabled)) if ($search_project_ref != '') $sql.= natural_search("p.ref", $search_project_ref); if ($search_amount) $sql.=natural_search("cs.amount", price2num(trim($search_amount)), 1); if ($search_status != '' && $search_status >= 0) $sql.=" AND cs.paye = ".$db->escape($search_status); $sql.= dolSqlDateFilter("cs.periode", $search_day_lim, $search_month_lim, $search_year_lim); @@ -163,6 +178,7 @@ if ($resql) if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); if ($search_ref) $param.='&search_ref='.urlencode($search_ref); if ($search_label) $param.='&search_label='.urlencode($search_label); + if (! empty($conf->projet->enabled)) if ($search_project_ref >= 0) $param.="&search_project_ref=".urlencode($search_project_ref); if ($search_amount) $param.='&search_amount='.urlencode($search_amount); if ($search_typeid) $param.='&search_typeid='.urlencode($search_typeid); if ($search_status != '' && $search_status != '-1') $param.='&search_status='.urlencode($search_status); @@ -219,6 +235,8 @@ if ($resql) print ''; $formsocialcontrib->select_type_socialcontrib($search_typeid, 'search_typeid', 1, 0, 0, 'maxwidth100onsmartphone'); print ''; + // Ref Project + if (! empty($conf->projet->enabled)) print ''; // Period end date print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; @@ -246,6 +264,7 @@ if ($resql) print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "id", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "cs.libelle", "", $param, 'class="left"', $sortfield, $sortorder); print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "type", "", $param, 'class="left"', $sortfield, $sortorder); + if (! empty($conf->projet->enabled)) print_liste_field_titre('ProjectRef', $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "periode", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "cs.amount", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("DateDue", $_SERVER["PHP_SELF"], "cs.date_ech", "", $param, 'align="center"', $sortfield, $sortorder); @@ -263,7 +282,11 @@ if ($resql) $chargesociale_static->ref=$obj->id; $chargesociale_static->lib=$obj->libelle; $chargesociale_static->type_libelle=$obj->type_lib; - + if (! empty($conf->projet->enabled)) { + $projectstatic->id=$obj->project_id; + $projectstatic->ref=$obj->project_ref; + $projectstatic->title=$obj->project_label; + } print ''; // Ref @@ -277,6 +300,16 @@ if ($resql) // Type print ''.$obj->type_lib.''; + // Project Ref + if (! empty($conf->projet->enabled)) { + print ''; + if ($obj->project_id > 0) + { + print $projectstatic->getNomUrl(1); + } + print ''; + } + // Date end period print ''; if ($obj->periode) @@ -314,6 +347,7 @@ if ($resql) else print ''.$langs->trans("Totalforthispage").''; print ''; print ''; + if (! empty($conf->projet->enabled)) print ''; print ''; print ''.price($totalarray['totalttc']).''; print ''; From bebc37abe39fd6371250b1e2954bc4f392be9a66 Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Wed, 19 Feb 2020 08:54:10 +0100 Subject: [PATCH 722/784] Update list.php --- htdocs/compta/sociales/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 6e7277c2f93..11f5fe43d19 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2016 Frédéric France + * Copyright (C) 2020 Pierre Ardoin * * 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 From ac16857501177f44ac3f691926503c7d812df95d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Feb 2020 11:33:45 +0100 Subject: [PATCH 723/784] GETPOST(..., 'alpha') remove " if found instead of returning '' --- htdocs/core/class/html.form.class.php | 3 ++- htdocs/core/lib/functions.lib.php | 12 ++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index ba8fcabe3f1..b5c9920a6a8 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2431,6 +2431,7 @@ class Form $outlabel = $objp->label; $outdesc = $objp->description; $outbarcode = $objp->barcode; + $outpbq = empty($objp->price_by_qty_rowid) ? '' : $objp->price_by_qty_rowid; $outtype = $objp->fk_product_type; $outdurationvalue = $outtype == Product::TYPE_SERVICE ?substr($objp->duration, 0, dol_strlen($objp->duration) - 1) : ''; @@ -2664,7 +2665,7 @@ class Form } $opt .= "\n"; - $optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>price2num($outprice_ht), 'price_ttc'=>price2num($outprice_ttc), 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit); + $optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>price2num($outprice_ht), 'price_ttc'=>price2num($outprice_ttc), 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit, 'pbq'=>$outpbq); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 431e0f0dadc..e938f1a00d8 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -559,11 +559,9 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null case 'alpha': if (!is_array($out)) { - $out = trim($out); // '"' is dangerous because param in url can close the href= or src= and add javascript functions. // '../' is dangerous because it allows dir transversals - if (preg_match('/"/', $out)) $out = ''; - elseif (preg_match('/\.\.\//', $out)) $out = ''; + $out = str_replace(array('"', '../'), '', trim($out)); } break; case 'san_alpha': @@ -593,17 +591,15 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null case 'array': if (!is_array($out) || empty($out)) $out = array(); break; - case 'nohtml': // Recommended for most scalar parameters + case 'nohtml': $out = dol_string_nohtmltag($out, 0); break; - case 'alphanohtml': // Recommended for search parameters + case 'alphanohtml': // Recommended for most scalar parameters and search parameters if (!is_array($out)) { - $out = trim($out); // '"' is dangerous because param in url can close the href= or src= and add javascript functions. // '../' is dangerous because it allows dir transversals - if (preg_match('/"/', $out)) $out = ''; - elseif (preg_match('/\.\.\//', $out)) $out = ''; + $out = str_replace(array('"', '../'), '', trim($out)); $out = dol_string_nohtmltag($out); } break; From 996ae2336d67674d256bb297aced5af68d5ce2c5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Feb 2020 11:59:27 +0100 Subject: [PATCH 724/784] Prepare PHP v8 - No more 'each' operator --- htdocs/core/class/ldap.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index b22473ec483..10d34afd867 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -1397,7 +1397,8 @@ class Ldap //Parse flags to text $retval = array(); - while (list($flag, $val) = each($flags)) { + //while (list($flag, $val) = each($flags)) { + foreach ($flags as $flag => $val) { if ($uacf >= $val) { $uacf -= $val; $retval[$val] = $flag; From 1dd5ba093d694daf35d37298d86abf5ba066373e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Feb 2020 11:59:27 +0100 Subject: [PATCH 725/784] Prepare PHP v8 - mktime() and gmmktime() are no more allowed --- dev/examples/code/create_invoice.php | 5 +++-- dev/examples/code/create_order.php | 5 +++-- htdocs/compta/stats/index.php | 2 +- htdocs/core/class/ldap.class.php | 3 ++- htdocs/core/lib/functions.lib.php | 4 +--- htdocs/expensereport/class/expensereport.class.php | 2 +- htdocs/fichinter/card.php | 2 +- 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/dev/examples/code/create_invoice.php b/dev/examples/code/create_invoice.php index dbbe9d84c1c..1b212e0a5d7 100755 --- a/dev/examples/code/create_invoice.php +++ b/dev/examples/code/create_invoice.php @@ -66,8 +66,9 @@ $obj = new Facture($db); $obj->ref = 'ABCDE'; $obj->socid = 4; // Put id of third party (rowid in llx_societe table) -$obj->date = mktime(); -$obj->note = 'A comment'; +$obj->date = dol_now(); +$obj->note_public = 'A public comment'; +$obj->note_private = 'A private comment'; $obj->cond_reglement_id = 1; $line1=new FactureLigne($db); diff --git a/dev/examples/code/create_order.php b/dev/examples/code/create_order.php index 30265d5462e..703254ad5e9 100755 --- a/dev/examples/code/create_order.php +++ b/dev/examples/code/create_order.php @@ -66,8 +66,9 @@ $com = new Commande($db); $com->ref = 'ABCDE'; $com->socid = 4; // Put id of third party (rowid in llx_societe table) -$com->date_commande = mktime(); -$com->note = 'A comment'; +$com->date = dol_now(); +$com->note_public = 'A public comment'; +$com->note_private = 'A private comment'; $com->source = 1; $com->remise_percent = 0; diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 684ef337fcd..9be5607b62d 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -407,7 +407,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) print "".dol_print_date(dol_mktime(12,0,0,$mois,1,2000),"%B").""; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { - $casenow = dol_print_date(mktime(),"%Y-%m"); + $casenow = dol_print_date(dol_now(),"%Y-%m"); $case = dol_print_date(dol_mktime(1,1,1,$mois,1,$annee),"%Y-%m"); $caseprev = dol_print_date(dol_mktime(1,1,1,$mois,1,$annee-1),"%Y-%m"); diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index b22473ec483..10d34afd867 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -1397,7 +1397,8 @@ class Ldap //Parse flags to text $retval = array(); - while (list($flag, $val) = each($flags)) { + //while (list($flag, $val) = each($flags)) { + foreach ($flags as $flag => $val) { if ($uacf >= $val) { $uacf -= $val; $retval[$val] = $flag; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e938f1a00d8..dff1d84dddc 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2102,8 +2102,6 @@ function dol_now($mode = 'gmt') { $ret = 0; - // Note that gmmktime and mktime return same value (GMT) when used without parameters - //if ($mode == 'gmt') $ret=gmmktime(); // Strict Standards: gmmktime(): You should be using the time() function instead if ($mode == 'gmt') $ret = time(); // Time for now at greenwich. elseif ($mode == 'tzserver') // Time for now with PHP server timezone added { @@ -2119,7 +2117,7 @@ function dol_now($mode = 'gmt') }*/ elseif ($mode == 'tzuser') // Time for now with user timezone added { - //print 'time: '.time().'-'.mktime().'-'.gmmktime(); + //print 'time: '.time(); $offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; $offsetdst = (empty($_SESSION['dol_dst']) ? 0 : $_SESSION['dol_dst']) * 60 * 60; $ret = (int) (dol_now('gmt') + ($offsettz + $offsetdst)); diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 05272aa2ff7..14ab2b88f22 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1486,7 +1486,7 @@ class ExpenseReport extends CommonObject { // phpcs:enable $error = 0; - $this->date_cancel = $this->db->idate(gmmktime()); + $this->date_cancel = $this->db->idate(dol_now()); if ($this->fk_statut != self::STATUS_CANCELED) { $this->db->begin(); diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 93d5e3339b1..3d1a23ee26d 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -353,7 +353,7 @@ if (empty($reshook)) $desc .= '
'; $desc .= ' ('.$langs->trans('Quantity').': '.$lines[$i]->qty.')'; - $timearray = dol_getdate(mktime()); + $timearray = dol_getdate(dol_now()); $date_intervention = dol_mktime(0, 0, 0, $timearray['mon'], $timearray['mday'], $timearray['year']); if ($product_type == Product::TYPE_PRODUCT) { From f10986467098705cd65fbe1295687d9389a0c7e8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Feb 2020 13:22:24 +0100 Subject: [PATCH 726/784] NEW Add a profil to import contact categories Load roles of contact only when required --- htdocs/contact/card.php | 26 +++++----- htdocs/contact/class/contact.class.php | 52 +++++++++++-------- .../modules/import/import_csv.modules.php | 5 +- htdocs/core/modules/modCategorie.class.php | 21 +++++++- htdocs/langs/en_US/categories.lang | 1 + 5 files changed, 69 insertions(+), 36 deletions(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index bc680c5250a..73862b65b2e 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -554,6 +554,8 @@ else setEventMessages($object->error, $object->errors, 'errors'); } + $object->fetchRoles(); + // Show tabs $head = contact_prepare_head($object); @@ -580,7 +582,7 @@ else $object->country = $tmparray['label']; } - $title = $addcontact = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); + $title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); $linkback = ''; print load_fiche_titre($title, $linkback, 'address'); @@ -654,7 +656,7 @@ else // Civility print ''; - print $formcompany->select_civility(GETPOSTISSET("civility_code") ?GETPOST("civility_code", 'alpha') : $object->civility_code, 'civility_code'); + print $formcompany->select_civility(GETPOSTISSET("civility_code") ? GETPOST("civility_code", 'alpha') : $object->civility_code, 'civility_code'); print ''; print ''; @@ -683,13 +685,13 @@ else if (($objsoc->typent_code == 'TE_PRIVATE' || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->zip)) == 0) $object->zip = $objsoc->zip; // Predefined with third party if (($objsoc->typent_code == 'TE_PRIVATE' || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->town)) == 0) $object->town = $objsoc->town; // Predefined with third party print ' / '; - print $formcompany->select_ziptown((GETPOST("zipcode", 'alpha') ?GETPOST("zipcode", 'alpha') : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6).' '; - print $formcompany->select_ziptown((GETPOST("town", 'alpha') ?GETPOST("town", 'alpha') : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id')); + print $formcompany->select_ziptown((GETPOST("zipcode", 'alpha') ? GETPOST("zipcode", 'alpha') : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6).' '; + print $formcompany->select_ziptown((GETPOST("town", 'alpha') ? GETPOST("town", 'alpha') : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id')); print ''; // Country print ''; - print $form->select_country((GETPOST("country_id", 'alpha') ?GETPOST("country_id", 'alpha') : $object->country_id), 'country_id'); + print $form->select_country((GETPOST("country_id", 'alpha') ? GETPOST("country_id", 'alpha') : $object->country_id), 'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''; @@ -707,7 +709,7 @@ else if ($object->country_id) { - print $formcompany->select_state(GETPOST("state_id", 'alpha') ?GETPOST("state_id", 'alpha') : $object->state_id, $object->country_code, 'state_id'); + print $formcompany->select_state(GETPOST("state_id", 'alpha') ? GETPOST("state_id", 'alpha') : $object->state_id, $object->country_code, 'state_id'); } else { @@ -721,23 +723,23 @@ else // Phone / Fax print ''.img_picto('', 'object_phoning').' '.$form->editfieldkey('PhonePro', 'phone_pro', '', $object, 0).''; - print ''; + print ''; if ($conf->browser->layout == 'phone') print ''; print ''.img_picto('', 'object_phoning').' '.$form->editfieldkey('PhonePerso', 'phone_perso', '', $object, 0).''; - print ''; + print ''; print ''.img_picto('', 'object_phoning_mobile').' '.$form->editfieldkey('PhoneMobile', 'phone_mobile', '', $object, 0).''; - print ''; + print ''; if ($conf->browser->layout == 'phone') print ''; print ''.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', '', $object, 0).''; - print ''; + print ''; print ''; if (($objsoc->typent_code == 'TE_PRIVATE' || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->email)) == 0) $object->email = $objsoc->email; // Predefined with third party // Email print ''.img_picto('', 'object_email').' '.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '').''; - print ''; + print ''; print ''; if (!empty($conf->mailing->enabled)) @@ -757,7 +759,7 @@ else print ''; print ''; - print ''.$form->selectyesno('no_email', (GETPOSTISSET("no_email") ?GETPOST("no_email", 'alpha') : $noemail), 1).''; + print ''.$form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'alpha') : $noemail), 1).''; print ''; } print ''; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 16279187b97..013830ca864 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -802,20 +802,19 @@ class Contact extends CommonObject /** - * Load object contact + * Load object contact. * - * @param int $id id du contact - * @param User $user Utilisateur (abonnes aux alertes) qui veut les alertes de ce contact - * @param string $ref_ext External reference, not given by Dolibarr - * @param string $email Email - * @return int -1 if KO, 0 if OK but not found, 1 if OK + * @param int $id Id of contact + * @param User $user Load also alerts of this user (subscribing to alerts) that want alerts about this contact + * @param string $ref_ext External reference, not given by Dolibarr + * @param string $email Email + * @param int $loadalsoroles Load also roles + * @return int >0 if OK, <0 if KO or if two records found for same ref or idprof, 0 if not found. */ - public function fetch($id, $user = null, $ref_ext = '', $email = '') + public function fetch($id, $user = null, $ref_ext = '', $email = '', $loadalsoroles = 0) { global $langs; - $langs->load("dict"); - dol_syslog(get_class($this)."::fetch id=".$id." ref_ext=".$ref_ext." email=".$email, LOG_DEBUG); if (empty($id) && empty($ref_ext) && empty($email)) @@ -824,7 +823,7 @@ class Contact extends CommonObject return -1; } - $langs->load("companies"); + $langs->loadLangs(array("dict", "companies")); $sql = "SELECT c.rowid, c.entity, c.fk_soc, c.ref_ext, c.civility as civility_code, c.lastname, c.firstname,"; $sql .= " c.address, c.statut, c.zip, c.town,"; @@ -861,7 +860,15 @@ class Contact extends CommonObject $resql = $this->db->query($sql); if ($resql) { - if ($this->db->num_rows($resql)) + $num = $this->db->num_rows($resql); + if ($num > 1) + { + $this->error = 'Fetch found several records. Rename one of contact to avoid duplicate.'; + dol_syslog($this->error, LOG_ERR); + + return 2; + } + elseif ($num) // $num = 1 { $obj = $this->db->fetch_object($resql); @@ -942,7 +949,11 @@ class Contact extends CommonObject return -1; } - // Charge alertes du user + // Retreive all extrafield + // fetch optionals attributes and labels + $this->fetch_optionals(); + + // Load also alerts of this user if ($user) { $sql = "SELECT fk_user"; @@ -967,13 +978,12 @@ class Contact extends CommonObject } } - // Retreive all extrafield - // fetch optionals attributes and labels - $this->fetch_optionals(); - - $resultRole = $this->fetchRoles(); - if ($resultRole < 0) { - return $resultRole; + // Load also roles of this address + if ($loadalsoroles) { + $resultRole = $this->fetchRoles(); + if ($resultRole < 0) { + return $resultRole; + } } return 1; @@ -1587,7 +1597,7 @@ class Contact extends CommonObject } /** - * Fetch Role for a contact + * Fetch Roles for a contact * * @return float|int * @throws Exception @@ -1599,7 +1609,7 @@ class Contact extends CommonObject $num = 0; $sql = "SELECT tc.rowid, tc.element, tc.source, tc.code, tc.libelle, sc.rowid as contactroleid"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe_contacts as sc "; + $sql .= " FROM ".MAIN_DB_PREFIX."societe_contacts as sc"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_type_contact as tc"; $sql .= " ON tc.rowid = sc.fk_c_type_contact"; $sql .= " AND sc.fk_socpeople = ".$this->id; diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 93d68691a11..6c9dd9062a8 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -425,6 +425,7 @@ class ImportCsv extends ModeleImports // New val can be an id or ref. If it start with id: it is forced to id, if it start with ref: it is forced to ref. It not, we try to guess. $isidorref = 'id'; if (!is_numeric($newval) && $newval != '' && !preg_match('/^id:/i', $newval)) $isidorref = 'ref'; + $newval = preg_replace('/^(id|ref):/i', '', $newval); // Remove id: or ref: that was used to force if field is id or ref //print 'Val is now '.$newval.' and is type '.$isidorref."
\n"; @@ -448,8 +449,7 @@ class ImportCsv extends ModeleImports $classinstance = new $class($this->db); // Try the fetch from code or ref $param_array = array('', $newval); - if ($class == 'AccountingAccount') - { + if ($class == 'AccountingAccount') { //var_dump($arrayrecord[0]['val']); /*include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancysystem.class.php'; $tmpchartofaccount = new AccountancySystem($this->db); @@ -464,6 +464,7 @@ class ImportCsv extends ModeleImports }*/ $param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart. } + call_user_func_array(array($classinstance, $method), $param_array); // If not found, try the fetch from label if (! ($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel') diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index b53a9630598..7f92dcef6d6 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -452,7 +452,7 @@ class modCategorie extends DolibarrModules if (! empty($conf->societe->enabled)) { - //Customers + // Customers $r++; $this->import_code[$r]=$this->rights_class.'_'.$r; $this->import_label[$r]="CatCusLinks"; // Translation key @@ -470,6 +470,25 @@ class modCategorie extends DolibarrModules 'cs.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty') ); $this->import_examplevalues_array[$r]=array('cs.fk_categorie'=>"Imported category",'cs.fk_soc'=>"MyBigCompany"); + + // Contacts/Addresses + $r++; + $this->import_code[$r]=$this->rights_class.'_'.$r; + $this->import_label[$r]="CatContactsLinks"; // Translation key + $this->import_icon[$r]=$this->picto; + $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_contact'); + $this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_socpeople'=>"Contact ID*"); + $this->import_regex_array[$r]=array( + 'cs.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=4' + //'cs.fk_socpeople'=>'rowid@'.MAIN_DB_PREFIX.'socpeople' + ); + + $this->import_convertvalue_array[$r]=array( + 'cs.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category') + //'cs.fk_socpeople'=>array('rule'=>'fetchidfromref','classfile'=>'/contact/class/contact.class.php','class'=>'Contact','method'=>'fetch','element'=>'Contact') + ); + $this->import_examplevalues_array[$r]=array('cs.fk_categorie'=>"Imported category",'cs.fk_socpeople'=>"123"); } if (! empty($conf->fournisseur->enabled)) diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index 7207bbacc38..1ec9b5bd409 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -78,6 +78,7 @@ CatMemberList=List of members tags/categories CatContactList=List of contact tags/categories CatSupLinks=Links between suppliers and tags/categories CatCusLinks=Links between customers/prospects and tags/categories +CatContactsLinks=Links between contacts/addresses and tags/categories CatProdLinks=Links between products/services and tags/categories CatProJectLinks=Links between projects and tags/categories DeleteFromCat=Remove from tags/category From db1e324ba537923888d131840c540c9db3715355 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Feb 2020 13:58:04 +0100 Subject: [PATCH 727/784] Fix trans --- htdocs/langs/en_US/products.lang | 2 +- htdocs/langs/en_US/projects.lang | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index b9293b6187c..6f3994572c6 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -363,7 +363,7 @@ UsePercentageVariations=Use percentage variations PercentageVariation=Percentage variation ErrorDeletingGeneratedProducts=There was an error while trying to delete existing product variants NbOfDifferentValues=No. of different values -NbProducts=No. of products +NbProducts=Number of products ParentProduct=Parent product HideChildProducts=Hide variant products ShowChildProducts=Show variant products diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 55f70e68b21..9c1f5029604 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -39,8 +39,8 @@ ShowProject=Show project ShowTask=Show task SetProject=Set project NoProject=No project defined or owned -NbOfProjects=No. of projects -NbOfTasks=No. of tasks +NbOfProjects=Number of projects +NbOfTasks=Number of tasks TimeSpent=Time spent TimeSpentByYou=Time spent by you TimeSpentByUser=Time spent by user From 0c571c037668a29b1a8ce7eacc25fce36f58c882 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Feb 2020 13:59:01 +0100 Subject: [PATCH 728/784] Restore common behaviour: Draft object are on left under graph. Open and live objects are on right --- htdocs/core/lib/project.lib.php | 65 ++++++++++++++++++++++----------- htdocs/projet/index.php | 29 ++++++++++++--- 2 files changed, 68 insertions(+), 26 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 7609d7b759b..8e78e4e45be 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -2147,16 +2147,17 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (!in_array('prospectionstatus', $hiddenfields)) print_liste_field_titre("OpportunityStatus", "", "", "", "", '', $sortfield, $sortorder, 'right '); print_liste_field_titre("OpportunityAmount", "", "", "", "", 'align="right"', $sortfield, $sortorder); print_liste_field_titre('OpportunityWeightedAmount', '', '', '', '', 'align="right"', $sortfield, $sortorder); } if (empty($conf->global->PROJECT_HIDE_TASKS)) { print_liste_field_titre("Tasks", "", "", "", "", 'align="right"', $sortfield, $sortorder); - if (!in_array('plannedworkload', $hiddenfields)) print_liste_field_titre("PlannedWorkload", "", "", "", "", 'align="right"', $sortfield, $sortorder); - if (!in_array('declaredprogress', $hiddenfields)) print_liste_field_titre("ProgressDeclared", "", "", "", "", 'align="right"', $sortfield, $sortorder); + if (!in_array('plannedworkload', $hiddenfields)) print_liste_field_titre("PlannedWorkload", "", "", "", "", '', $sortfield, $sortorder, 'right '); + if (!in_array('declaredprogress', $hiddenfields)) print_liste_field_titre("ProgressDeclared", "", "", "", "", '', $sortfield, $sortorder, 'right '); } - print_liste_field_titre("Status", "", "", "", "", 'align="right"', $sortfield, $sortorder); + if (!in_array('projectstatus', $hiddenfields)) print_liste_field_titre("Status", "", "", "", "", '', $sortfield, $sortorder, 'right '); print "\n"; $total_plannedworkload = 0; @@ -2179,8 +2180,8 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks $projectstatic->datee = $db->jdate($objp->datee); $projectstatic->dateo = $db->jdate($objp->dateo); - print ''; + print ''; print $projectstatic->getNomUrl(1); if (!in_array('projectlabel', $hiddenfields)) print '
'.dol_trunc($objp->title, 24); @@ -2194,8 +2195,35 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks print $thirdpartystatic->getNomUrl(1); } print ''; + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (!in_array('prospectionstatus', $hiddenfields)) { + print ''; + // Because color of prospection status has no meaning yet, it is used if hidden constant is set + if (empty($conf->global->USE_COLOR_FOR_PROSPECTION_STATUS)) { + if ($langs->trans("OppStatus" . $oppStatusCode) != "OppStatus" . $oppStatusCode) { + print $langs->trans("OppStatus" . $oppStatusCode); + } + } else { + if (isset($statusOppList[$objp->opp_status])) { + $oppStatusCode = $statusOppList[$objp->opp_status]['code']; + $oppStatusColor = $statusOppList[$objp->opp_status]['color']; + } else { + $oppStatusCode = dol_getIdFromCode($db, $objp->opp_status, 'c_lead_status', 'rowid', 'code'); + $oppStatusColor = ''; + } + if ($oppStatusCode) { + if (!empty($oppStatusColor)) { + print ''; + } else { + print '' . $oppStatusCode . ''; + } + } + } + print ''; + } + print ''; if ($objp->opp_amount) print price($objp->opp_amount, 0, '', 1, -1, -1, $conf->currency); print ''; @@ -2207,6 +2235,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks } print ''; } + if (empty($conf->global->PROJECT_HIDE_TASKS)) { print ''.$objp->nb.''; @@ -2228,23 +2257,12 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks } } - print ''; - //print $projectstatic->getLibStatut(3); - if (isset($statusOppList[$objp->opp_status])) { - $oppStatusCode = $statusOppList[$objp->opp_status]['code']; - $oppStatusColor = $statusOppList[$objp->opp_status]['color']; - } else { - $oppStatusCode = dol_getIdFromCode($db, $objp->opp_status, 'c_lead_status', 'rowid', 'code'); - $oppStatusColor = ''; + if (!in_array('projectstatus', $hiddenfields)) { + print ''; + print $projectstatic->getLibStatut(3); + print ''; } - if ($oppStatusCode) { - if (!empty($oppStatusColor)) { - print ''; - } else { - print '' . $oppStatusCode . ''; - } - } - print ''; + print "\n"; $total_task = $total_task + $objp->nb; @@ -2258,6 +2276,9 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks print ''.$langs->trans("Total").""; if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (!in_array('prospectionstatus', $hiddenfields)) { + print ''; + } print ''.price($total_opp_amount, 0, '', 1, -1, -1, $conf->currency).''; print ''.$form->textwithpicto(price($ponderated_opp_amount, 0, '', 1, -1, -1, $conf->currency), $langs->trans("OpportunityPonderatedAmountDesc"), 1).''; } @@ -2267,7 +2288,9 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks if (!in_array('plannedworkload', $hiddenfields)) print ''.($total_plannedworkload ?convertSecondToTime($total_plannedworkload) : '').''; if (!in_array('declaredprogress', $hiddenfields)) print ''.($total_plannedworkload ?round(100 * $total_declaredprogressworkload / $total_plannedworkload, 0).'%' : '').''; } - print ''; + if (!in_array('projectstatus', $hiddenfields)) { + print ''; + } print ''; $db->free($resql); diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 9ab79a3b677..0613fd75e8f 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -166,7 +166,7 @@ include DOL_DOCUMENT_ROOT.'/projet/graph_opportunities.inc.php'; // List of draft projects -print_projecttasks_array($db, $form, $socid, $projectsListId, 0, 0, $listofoppstatus, array('projectlabel', 'plannedworkload', 'declaredprogress')); +print_projecttasks_array($db, $form, $socid, $projectsListId, 0, 0, $listofoppstatus, array('projectlabel', 'plannedworkload', 'declaredprogress', 'prospectionstatus', 'projectstatus')); print '
'; @@ -274,17 +274,25 @@ if ($mine || empty($user->rights->projet->all->lire)) $sql .= " AND p.rowid IN ( if ($socid) $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; $sql .= " GROUP BY s.nom, s.rowid"; $sql .= $db->order($sortfield, $sortorder); +//$sql .= $db->plimit($max + 1, 0); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; + $othernb = 0; while ($i < $num) { $obj = $db->fetch_object($resql); + if ($i >= $max) { + $othernb += $obj->nb; + $i++; + continue; + } + print ''; print ''; if ($obj->socid) @@ -296,6 +304,7 @@ if ($resql) else { print $langs->trans("OthersNotLinkedToThirdParty"); + $i--; } print ''; print ''; @@ -306,6 +315,16 @@ if ($resql) $i++; } + if ($othernb) { + print ''; + print ''; + print '...'; + print ''; + print ''; + print $othernb; + print ''; + print "\n"; + } $db->free($resql); } @@ -316,10 +335,10 @@ else print ""; print '
'; -if (!empty($conf->global->PROJECT_SHOW_PROJECT_LIST_ON_PROJECT_AREA)) +if (empty($conf->global->PROJECT_HIDE_PROJECT_LIST_ON_PROJECT_AREA)) { - // This list can be very long, so we don't show it by default on task area. We prefer to use the list page. - // Add constant PROJECT_SHOW_PROJECT_LIST_ON_PROJECT_AREA to show this list + // This list can be very long, so we allow to hide it to prefer to use the list page. + // Add constant PROJECT_HIDE_PROJECT_LIST_ON_PROJECT_AREA to show this list print '
'; @@ -329,7 +348,7 @@ if (!empty($conf->global->PROJECT_SHOW_PROJECT_LIST_ON_PROJECT_AREA)) print '
'; $parameters = array('user' => $user); -$reshook = $hookmanager->executeHooks('dashboardProjects', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('dashboardProjects', $parameters, $projectstatic); // Note that $action and $object may have been modified by hook // End of page llxFooter(); From ace0c7f89dc9cd072de163ca39bb61056ad62bf0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Feb 2020 14:31:32 +0100 Subject: [PATCH 729/784] Fix list of opportunity with filter on search_usage_opportunity --- htdocs/core/menus/standard/eldy.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 109de3a99c4..f66768b7ffb 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1683,11 +1683,11 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM elseif ($conf->global->PROJECT_USE_OPPORTUNITIES == 1) { $newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $showmode, '', 'project', 'list'); - $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_opp_status=openedopp&search_status=99&contextpage=lead', $langs->trans("ListOpenLeads"), 2, $showmode); + $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_usage_opportunity=1&search_status=99&contextpage=lead', $langs->trans("ListOpenLeads"), 2, $showmode); $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_opp_status=notopenedopp&search_status=99&contextpage=project', $langs->trans("ListOpenProjects"), 2, $showmode); } elseif ($conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only - $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_opp_status=openedopp&search_status=99', $langs->trans("List"), 2, $showmode); + $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_usage_opportunity=1&search_status=99', $langs->trans("List"), 2, $showmode); } $newmenu->add("/projet/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire); From 91899d2f56c18761a28bfe2dc11207d91d3ed2cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Feb 2020 14:31:32 +0100 Subject: [PATCH 730/784] Fix list of opportunity with filter on search_usage_opportunity --- htdocs/core/menus/standard/eldy.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 109de3a99c4..f66768b7ffb 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1683,11 +1683,11 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM elseif ($conf->global->PROJECT_USE_OPPORTUNITIES == 1) { $newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $showmode, '', 'project', 'list'); - $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_opp_status=openedopp&search_status=99&contextpage=lead', $langs->trans("ListOpenLeads"), 2, $showmode); + $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_usage_opportunity=1&search_status=99&contextpage=lead', $langs->trans("ListOpenLeads"), 2, $showmode); $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_opp_status=notopenedopp&search_status=99&contextpage=project', $langs->trans("ListOpenProjects"), 2, $showmode); } elseif ($conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only - $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_opp_status=openedopp&search_status=99', $langs->trans("List"), 2, $showmode); + $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_usage_opportunity=1&search_status=99', $langs->trans("List"), 2, $showmode); } $newmenu->add("/projet/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire); From 3fafbb372b39900adc7bb9a6bb9746f1f49199c2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Feb 2020 15:51:27 +0100 Subject: [PATCH 731/784] Remove call of $mc->dao than hangs. Replaced with $mc use. --- htdocs/compta/accounting-files.php | 21 ++++++++++++++++----- htdocs/compta/bank/treso.php | 7 +++++-- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index ac019de8088..b7d1cdd633e 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -77,7 +77,13 @@ if ($user->socid > 0) { accessforbidden(); } -$entity = GETPOST('entity', 'int') ?GETPOST('entity', 'int') : $conf->entity; +$entity = (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : (GETPOSTISSET('search_entity') ? GETPOST('search_entity', 'int') : $conf->entity)); +if (empty($entity) && ! empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES)) { + $tmparray = $mc->getEntitiesList(); + $entity = '0,'.join(',', array_keys($tmparray)); +} +if (empty($entity)) $entity = $conf->entity; + /* @@ -400,13 +406,18 @@ print ''; print $langs->trans("ReportPeriod").': '.$form->selectDate($date_start, 'date_start', 0, 0, 0, "", 1, 1, 0); print ' - '.$form->selectDate($date_stop, 'date_stop', 0, 0, 0, "", 1, 1, 0)."\n"; -// Export is for current company only ! +// Export is for current company only if (!empty($conf->multicompany->enabled) && is_object($mc)) { + $mc->getInfo($conf->entity); print '('.$langs->trans("Entity").' : '; - $mc->dao->getEntities(); - $mc->dao->fetch($conf->entity); - print $mc->dao->label; + print ""; + if (! empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES)) { + print $mc->select_entities(GETPOSTISSET('search_entity') ? GETPOST('search_entity', 'int') : $mc->id, 'search_entity', '', false, false, false, false, true); + } else { + print $mc->label; + } + print ""; print ")\n"; } diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 7ca62b67ab8..906ef09ac6b 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -286,11 +286,14 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) else print $langs->trans("NotDefined"); print ""; print "".$ref.""; - if($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED ){ + if ($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED) { if($obj->family == 'invoice'){ $mc->getInfo($obj->entity); print "".$mc->label.""; - }else print ""; + } + else { + print ""; + } } print "".$refcomp.""; if ($obj->total_ttc < 0) { print ''.price(abs($total_ttc))." "; }; From 44c2909696c8197561f11d71f5cd25995e60a0c2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Feb 2020 16:08:33 +0100 Subject: [PATCH 732/784] FIX Multicompany compatibility --- htdocs/compta/accounting-files.php | 41 ++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index b7d1cdd633e..af18b834edf 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -77,13 +77,22 @@ if ($user->socid > 0) { accessforbidden(); } +// Define $arrayofentities if multientity is set. +$arrayofentities = array(); +if (!empty($conf->multicompany->enabled) && is_object($mc)) { + $arrayofentities = $mc->getEntitiesList(); +} + $entity = (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : (GETPOSTISSET('search_entity') ? GETPOST('search_entity', 'int') : $conf->entity)); -if (empty($entity) && ! empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES)) { - $tmparray = $mc->getEntitiesList(); - $entity = '0,'.join(',', array_keys($tmparray)); +if (!empty($conf->multicompany->enabled) && is_object($mc)) { + if (empty($entity) && ! empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES)) { + $entity = '0,'.join(',', array_keys($arrayofentities)); + } } if (empty($entity)) $entity = $conf->entity; +$error = 0; + /* @@ -114,42 +123,42 @@ if (($action == "searchfiles" || $action == "dl")) { $wheretail = " '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'"; // Customer invoices - $sql = "SELECT t.rowid as id, t.ref, t.paye as paid, total as total_ht, total_ttc, tva as total_vat, fk_soc, t.datef as date, 'Invoice' as item, s.nom as thirdparty_name, s.code_client as thirdparty_code, c.code as country_code, s.tva_intra as vatnum"; + $sql = "SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, total as total_ht, total_ttc, tva as total_vat, fk_soc, t.datef as date, 'Invoice' as item, s.nom as thirdparty_name, s.code_client as thirdparty_code, c.code as country_code, s.tva_intra as vatnum"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays"; $sql .= " WHERE datef between ".$wheretail; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; $sql .= " AND t.fk_statut <> ".Facture::STATUS_DRAFT; $sql .= " UNION ALL"; // Vendor invoices - $sql .= " SELECT t.rowid as id, t.ref, paye as paid, total_ht, total_ttc, total_tva as total_vat, fk_soc, datef as date, 'SupplierInvoice' as item, s.nom as thirdparty_name, s.code_fournisseur as thirdparty_code, c.code as country_code, s.tva_intra as vatnum"; + $sql .= " SELECT t.rowid as id, t.entity, t.ref, paye as paid, total_ht, total_ttc, total_tva as total_vat, fk_soc, datef as date, 'SupplierInvoice' as item, s.nom as thirdparty_name, s.code_fournisseur as thirdparty_code, c.code as country_code, s.tva_intra as vatnum"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays"; $sql .= " WHERE datef between ".$wheretail; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; $sql .= " AND t.fk_statut <> ".FactureFournisseur::STATUS_DRAFT; $sql .= " UNION ALL"; // Expense reports - $sql .= " SELECT t.rowid as id, t.ref, paid, total_ht, total_ttc, total_tva as total_vat, fk_user_author as fk_soc, date_fin as date, 'ExpenseReport' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; + $sql .= " SELECT t.rowid as id, t.entity, t.ref, paid, total_ht, total_ttc, total_tva as total_vat, fk_user_author as fk_soc, date_fin as date, 'ExpenseReport' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user_author LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country"; $sql .= " WHERE date_fin between ".$wheretail; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; $sql .= " AND t.fk_statut <> ".ExpenseReport::STATUS_DRAFT; $sql .= " UNION ALL"; // Donations - $sql .= " SELECT t.rowid as id, t.ref, paid, amount as total_ht, amount as total_ttc, 0 as total_vat, 0 as fk_soc, datedon as date, 'Donation' as item, t.societe as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; + $sql .= " SELECT t.rowid as id, t.entity, t.ref, paid, amount as total_ht, amount as total_ttc, 0 as total_vat, 0 as fk_soc, datedon as date, 'Donation' as item, t.societe as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; $sql .= " FROM ".MAIN_DB_PREFIX."don as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = t.fk_country"; $sql .= " WHERE datedon between ".$wheretail; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; $sql .= " AND t.fk_statut <> ".Don::STATUS_DRAFT; $sql .= " UNION ALL"; // Paiements of salaries - $sql .= " SELECT t.rowid as id, t.ref as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, t.fk_user as fk_soc, datep as date, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; + $sql .= " SELECT t.rowid as id, t.entity, t.ref as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, t.fk_user as fk_soc, datep as date, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country"; $sql .= " WHERE datep between ".$wheretail; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; //$sql.=" AND fk_statut <> ".PaymentSalary::STATUS_DRAFT; $sql .= " UNION ALL"; // Social contributions - $sql .= " SELECT t.rowid as id, t.libelle as ref, paye as paid, amount as total_ht, amount as total_ttc, 0 as total_tva, 0 as fk_soc, date_creation as date, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum"; + $sql .= " SELECT t.rowid as id, t.entity, t.libelle as ref, paye as paid, amount as total_ht, amount as total_ttc, 0 as total_tva, 0 as fk_soc, date_creation as date, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum"; $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as t"; $sql .= " WHERE date_creation between ".$wheretail; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; @@ -234,6 +243,7 @@ if (($action == "searchfiles" || $action == "dl")) { { $nofile = array(); $nofile['id'] = $objd->id; + $nofile['entity'] = $objd->entity; $nofile['date'] = $db->idate($objd->date); $nofile['paid'] = $objd->paid; $nofile['amount_ht'] = $objd->total_ht; @@ -254,6 +264,7 @@ if (($action == "searchfiles" || $action == "dl")) { foreach ($files as $key => $file) { $file['id'] = $objd->id; + $file['entity'] = $objd->entity; $file['date'] = $db->idate($objd->date); $file['paid'] = $objd->paid; $file['amount_ht'] = $objd->total_ht; @@ -320,6 +331,10 @@ if ($result && $action == "dl" && !$error) dol_mkdir($dirfortmpfile); $log = $langs->transnoentitiesnoconv("Type"); + if (!empty($conf->multicompany->enabled) && is_object($mc)) + { + $log .= ','.$langs->transnoentitiesnoconv("Entity"); + } $log .= ','.$langs->transnoentitiesnoconv("Date"); $log .= ','.$langs->transnoentitiesnoconv("Ref"); $log .= ','.$langs->transnoentitiesnoconv("TotalHT"); @@ -348,6 +363,10 @@ if ($result && $action == "dl" && !$error) } $log .= $file['item']; + if (!empty($conf->multicompany->enabled) && is_object($mc)) + { + $log .= ','.(empty($arrayofentities[$file['entity']]) ? $file['entity'] : $arrayofentities[$file['entity']]); + } $log .= ','.dol_print_date($file['date'], 'dayrfc'); $log .= ','.$file['ref']; $log .= ','.$file['amount_ht']; @@ -389,11 +408,13 @@ $form = new Form($db); $userstatic = new User($db); $title = $langs->trans("ComptaFiles").' - '.$langs->trans("List"); +$help_url = ''; llxHeader('', $title, $help_url); $h = 0; -$head[$h][0] = $_SERVER["PHP_SELF"].$varlink; +$head = array(); +$head[$h][0] = $_SERVER["PHP_SELF"]; $head[$h][1] = $langs->trans("AccountantFiles"); $head[$h][2] = 'AccountancyFiles'; From c14daa2790f9f383b650e244a96dfef699b141ae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Feb 2020 18:32:04 +0100 Subject: [PATCH 733/784] Can set main language and sublanguages of a website --- .../install/mysql/migration/11.0.0-12.0.0.sql | 3 + htdocs/install/mysql/tables/llx_website.sql | 2 + htdocs/langs/en_US/website.lang | 3 + htdocs/website/class/website.class.php | 55 ++++++++++++++++++- htdocs/website/index.php | 51 +++++++++++++++-- 5 files changed, 107 insertions(+), 7 deletions(-) diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 447630e7eb2..9e718148794 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -44,6 +44,9 @@ ALTER TABLE llx_commande_fournisseur_dispatch_extrafields ADD INDEX idx_commande -- For v12 +ALTER TABLE llx_website ADD COLUMN lang varchar(8); +ALTER TABLE llx_website ADD COLUMN otherlang varchar(255); + ALTER TABLE llx_holiday_users DROP INDEX uk_holiday_users; ALTER TABLE llx_holiday_users ADD UNIQUE INDEX uk_holiday_users(fk_user, fk_type); diff --git a/htdocs/install/mysql/tables/llx_website.sql b/htdocs/install/mysql/tables/llx_website.sql index 645343544a4..743d4ec9ca8 100644 --- a/htdocs/install/mysql/tables/llx_website.sql +++ b/htdocs/install/mysql/tables/llx_website.sql @@ -26,6 +26,8 @@ CREATE TABLE llx_website description varchar(255), maincolor varchar(16), maincolorbis varchar(16), + lang varchar(8), + otherlang varchar(255), status integer DEFAULT 1, fk_default_home integer, use_manifest integer, diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index 1d31a763523..ee46c9f4954 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -121,3 +121,6 @@ BackToHomePage=Back to home page... TranslationLinks=Translation links YouTryToAccessToAFileThatIsNotAWebsitePage=You try to access to a page that is not a website page UseTextBetween5And70Chars=For good SEO practices, use a text between 5 and 70 characters +MainLanguage=Main language +OtherLanguages=Other languages +UseManifest=Provide a manifest.json file \ No newline at end of file diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index c722b7adc36..927d54f5b29 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -70,6 +70,16 @@ class Website extends CommonObject */ public $description; + /** + * @var string Main language of web site + */ + public $lang; + + /** + * @var string List of languages of web site ('fr', 'es_MX', ...) + */ + public $otherlang; + /** * @var int Status */ @@ -171,6 +181,8 @@ class Website extends CommonObject $sql .= 'entity,'; $sql .= 'ref,'; $sql .= 'description,'; + $sql .= 'lang,'; + $sql .= 'otherlang,'; $sql .= 'status,'; $sql .= 'fk_default_home,'; $sql .= 'virtualhost,'; @@ -181,6 +193,8 @@ class Website extends CommonObject $sql .= ' '.((empty($this->entity) && $this->entity != '0') ? 'NULL' : $this->entity).','; $sql .= ' '.(!isset($this->ref) ? 'NULL' : "'".$this->db->escape($this->ref)."'").','; $sql .= ' '.(!isset($this->description) ? 'NULL' : "'".$this->db->escape($this->description)."'").','; + $sql .= ' '.(!isset($this->lang) ? 'NULL' : "'".$this->db->escape($this->lang)."'").','; + $sql .= ' '.(!isset($this->otherlang) ? 'NULL' : "'".$this->db->escape($this->otherlang)."'").','; $sql .= ' '.(!isset($this->status) ? '1' : $this->status).','; $sql .= ' '.(!isset($this->fk_default_home) ? 'NULL' : $this->fk_default_home).','; $sql .= ' '.(!isset($this->virtualhost) ? 'NULL' : "'".$this->db->escape($this->virtualhost)."'").","; @@ -201,6 +215,16 @@ class Website extends CommonObject if (!$error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); + // Create subdirectory per language + $tmplangarray = explode(',', $this->otherlang); + if (is_array($tmplangarray)) { + dol_mkdir($conf->website->dir_output.'/'.$this->ref); + foreach($tmplangarray as $val) { + if (trim($val) == $this->lang) continue; + dol_mkdir($conf->website->dir_output.'/'.$this->ref.'/'.trim($val)); + } + } + // Uncomment this and change MYOBJECT to your own tag if you // want this action to call a trigger. // if (!$notrigger) { @@ -240,6 +264,8 @@ class Website extends CommonObject $sql .= " t.entity,"; $sql .= " t.ref,"; $sql .= " t.description,"; + $sql .= " t.lang,"; + $sql .= " t.otherlang,"; $sql .= " t.status,"; $sql .= " t.fk_default_home,"; $sql .= " t.use_manifest,"; @@ -267,6 +293,8 @@ class Website extends CommonObject $this->entity = $obj->entity; $this->ref = $obj->ref; $this->description = $obj->description; + $this->lang = $obj->lang; + $this->otherlang = $obj->otherlang; $this->status = $obj->status; $this->fk_default_home = $obj->fk_default_home; $this->virtualhost = $obj->virtualhost; @@ -332,6 +360,8 @@ class Website extends CommonObject $sql .= " t.entity,"; $sql .= " t.ref,"; $sql .= " t.description,"; + $sql .= " t.lang,"; + $sql .= " t.otherlang,"; $sql .= " t.status,"; $sql .= " t.fk_default_home,"; $sql .= " t.virtualhost,"; @@ -372,6 +402,8 @@ class Website extends CommonObject $line->entity = $obj->entity; $line->ref = $obj->ref; $line->description = $obj->description; + $line->lang = $obj->lang; + $line->otherlang = $obj->otherlang; $line->status = $obj->status; $line->fk_default_home = $obj->fk_default_home; $line->virtualhost = $obj->virtualhost; @@ -403,6 +435,8 @@ class Website extends CommonObject */ public function update(User $user, $notrigger = false) { + global $conf; + $error = 0; dol_syslog(__METHOD__, LOG_DEBUG); @@ -430,6 +464,8 @@ class Website extends CommonObject $sql .= ' entity = '.(isset($this->entity) ? $this->entity : "null").','; $sql .= ' ref = '.(isset($this->ref) ? "'".$this->db->escape($this->ref)."'" : "null").','; $sql .= ' description = '.(isset($this->description) ? "'".$this->db->escape($this->description)."'" : "null").','; + $sql .= ' lang = '.(isset($this->lang) ? "'".$this->db->escape($this->lang)."'" : "null").','; + $sql .= ' otherlang = '.(isset($this->otherlang) ? "'".$this->db->escape($this->otherlang)."'" : "null").','; $sql .= ' status = '.(isset($this->status) ? $this->status : "null").','; $sql .= ' fk_default_home = '.(($this->fk_default_home > 0) ? $this->fk_default_home : "null").','; $sql .= ' use_manifest = '.((int) $this->use_manifest).','; @@ -452,6 +488,16 @@ class Website extends CommonObject // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. + // Create subdirectory per language + $tmplangarray = explode(',', $this->otherlang); + if (is_array($tmplangarray)) { + dol_mkdir($conf->website->dir_output.'/'.$this->ref); + foreach($tmplangarray as $val) { + if (trim($val) == $this->lang) continue; + dol_mkdir($conf->website->dir_output.'/'.$this->ref.'/'.trim($val)); + } + } + //// Call triggers //$result=$this->call_trigger('MYOBJECT_MODIFY',$user); //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} @@ -715,7 +761,8 @@ class Website extends CommonObject $label = ''.$langs->trans("WebSite").''; $label .= '
'; - $label .= ''.$langs->trans('Ref').': '.$this->ref; + $label .= ''.$langs->trans('Ref').': '.$this->ref.'
'; + $label .= ''.$langs->trans('MainLanguage').': '.$this->lang; $linkstart = 'entity = 1; $this->ref = 'myspecimenwebsite'; $this->description = 'A specimen website'; + $this->lang = 'en'; + $this->otherlang = 'fr,es_MX'; $this->status = ''; $this->fk_default_home = null; $this->virtualhost = 'http://myvirtualhost'; @@ -926,7 +975,7 @@ class Website extends CommonObject fputs($fp, $line); // Warning: We must keep llx_ here. It is a generic SQL. - $line = 'INSERT INTO llx_website_page(rowid, fk_page, fk_website, pageurl, aliasalt, title, description, image, keywords, status, date_creation, tms, lang, import_key, grabbed_from, type_container, htmlheader, content)'; + $line = 'INSERT INTO llx_website_page(rowid, fk_page, fk_website, pageurl, aliasalt, title, description, lang, otherlang, image, keywords, status, date_creation, tms, lang, import_key, grabbed_from, type_container, htmlheader, content)'; $line .= " VALUES("; $line .= $objectpageold->newid."__+MAX_llx_website_page__, "; @@ -936,6 +985,8 @@ class Website extends CommonObject $line .= "'".$this->db->escape($objectpageold->aliasalt)."', "; $line .= "'".$this->db->escape($objectpageold->title)."', "; $line .= "'".$this->db->escape($objectpageold->description)."', "; + $line .= "'".$this->db->escape($objectpageold->lang)."', "; + $line .= "'".$this->db->escape($objectpageold->otherlang)."', "; $line .= "'".$this->db->escape($objectpageold->image)."', "; $line .= "'".$this->db->escape($objectpageold->keywords)."', "; $line .= "'".$this->db->escape($objectpageold->status)."', "; diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 85b50b3d13b..c44341e0361 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -398,7 +398,9 @@ if ($action == 'addsite') { $tmpobject = new Website($db); $tmpobject->ref = GETPOST('WEBSITE_REF', 'alpha'); - $tmpobject->description = GETPOST('WEBSITE_DESCRIPTION', 'alpha'); + $tmpobject->description = GETPOST('WEBSITE_DESCRIPTION', 'alphanohtml'); + $tmpobject->lang = GETPOST('WEBSITE_LANG', 'aZ09'); + $tmpobject->otherlang = GETPOST('WEBSITE_OTHERLANG', 'aZ09comma'); $tmpobject->virtualhost = GETPOST('virtualhost', 'alpha'); $result = $tmpobject->create($user); @@ -782,6 +784,8 @@ if ($action == 'addcontainer') $objectpage->pageurl = GETPOST('WEBSITE_PAGENAME', 'alpha'); $objectpage->aliasalt = GETPOST('WEBSITE_ALIASALT', 'alpha'); $objectpage->description = GETPOST('WEBSITE_DESCRIPTION', 'alpha'); + $objectpage->lang = GETPOST('WEBSITE_LANG', 'alpha'); + $objectpage->otherlang = GETPOST('WEBSITE_OTHERLANG', 'alpha'); $objectpage->image = GETPOST('WEBSITE_IMAGE', 'alpha'); $objectpage->keywords = GETPOST('WEBSITE_KEYWORDS', 'alpha'); $objectpage->lang = GETPOST('WEBSITE_LANG', 'aZ09'); @@ -1060,6 +1064,8 @@ if ($action == 'updatecss') if (!$error) { $object->virtualhost = GETPOST('virtualhost', 'alpha'); + $object->lang = GETPOST('WEBSITE_LANG', 'aZ09'); + $object->otherlang = GETPOST('WEBSITE_OTHERLANG', 'aZ09comma'); $object->use_manifest = GETPOST('use_manifest', 'alpha'); $result = $object->update($user); @@ -1403,11 +1409,13 @@ if ($action == 'updatemeta') { $objectpage->old_object = clone $objectpage; - $objectpage->title = GETPOST('WEBSITE_TITLE', 'alpha'); - $objectpage->type_container = GETPOST('WEBSITE_TYPE_CONTAINER', 'alpha'); + $objectpage->title = GETPOST('WEBSITE_TITLE', 'alphanohtml'); + $objectpage->type_container = GETPOST('WEBSITE_TYPE_CONTAINER', 'alphanohtml'); $objectpage->pageurl = GETPOST('WEBSITE_PAGENAME', 'alpha'); $objectpage->aliasalt = GETPOST('WEBSITE_ALIASALT', 'alpha'); - $objectpage->description = GETPOST('WEBSITE_DESCRIPTION', 'alpha'); + $objectpage->lang = GETPOST('WEBSITE_LANG', 'aZ09'); + $objectpage->otherlang = GETPOST('WEBSITE_OTHERLANG', 'aZ09comma'); + $objectpage->description = GETPOST('WEBSITE_DESCRIPTION', 'alphanohtml'); $objectpage->image = GETPOST('WEBSITE_IMAGE', 'alpha'); $objectpage->keywords = GETPOST('WEBSITE_KEYWORDS', 'alpha'); $objectpage->lang = GETPOST('WEBSITE_LANG', 'aZ09'); @@ -2691,6 +2699,24 @@ if ($action == 'editcss') print $websitekey; print ''; + // Main language + print ''; + $htmltext=''; + print $form->textwithpicto($langs->trans('MainLanguage'), $htmltext, 1, 'help', '', 0, 2, 'WEBSITE_LANG'); + print ''; + print $formadmin->select_language((GETPOSTISSET('WEBSITE_LANG') ? GETPOST('WEBSITE_LANG', 'alpha') : ($object->lang ? $object->lang : $langs->defaultlang)), 'WEBSITE_LANG', 0, 0, 0, 0, 0, 'minwidth300', 2); + print ''; + print ''; + + // Other languages + print ''; + $htmltext= ''; + print $form->textwithpicto($langs->trans('OtherLanguages'), $htmltext, 1, 'help', '', 0, 2, 'WEBSITE_OTHERLANG'); + print ''; + print ''; + print ''; + print ''; + // VirtualHost print ''; @@ -2816,8 +2842,11 @@ if ($action == 'createsite') print ''; + $siteref = $sitedesc = $sitelang = $siteotherlang = ''; if (GETPOST('WEBSITE_REF')) $siteref = GETPOST('WEBSITE_REF', 'alpha'); if (GETPOST('WEBSITE_DESCRIPTION')) $sitedesc = GETPOST('WEBSITE_DESCRIPTION', 'alpha'); + if (GETPOST('WEBSITE_LANG')) $sitelang = GETPOST('WEBSITE_LANG', 'aZ09'); + if (GETPOST('WEBSITE_OTHERLANG')) $siteotherlang = GETPOST('WEBSITE_OTHERLANG', 'aZ09comma'); print ''; + + print ''; + + print ''; print ''; print ''; @@ -2863,7 +2861,7 @@ if ($action == 'createsite') print ''; print ''; // Translation of From 39c19ea3f60401b40b745c69f2304edb85d81241 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Feb 2020 01:14:30 +0100 Subject: [PATCH 736/784] Disable action greeting --- .github/workflows/greetings-pr.yml | 2 +- .github/workflows/stale-issues.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/greetings-pr.yml b/.github/workflows/greetings-pr.yml index e8bbb023b38..7e96b4ae6e1 100644 --- a/.github/workflows/greetings-pr.yml +++ b/.github/workflows/greetings-pr.yml @@ -1,6 +1,6 @@ name: Greetings PR -on: [pull_request] +#on: [pull_request] jobs: greeting: diff --git a/.github/workflows/stale-issues.yml b/.github/workflows/stale-issues.yml index 4d15f84b3f8..81a8c48a367 100644 --- a/.github/workflows/stale-issues.yml +++ b/.github/workflows/stale-issues.yml @@ -1,4 +1,5 @@ name: "Close stale issues (bugs and feature requests)" + on: schedule: - cron: "0 0 * * *" From 04c71bc79b0a2a4e7ab83a8fb912f4744c621312 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Feb 2020 01:22:40 +0100 Subject: [PATCH 737/784] Comment --- .../workflows/{greetings-pr.yml => greetings-pr.yml.disabled} | 3 ++- .github/workflows/stale-issues.yml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) rename .github/workflows/{greetings-pr.yml => greetings-pr.yml.disabled} (73%) diff --git a/.github/workflows/greetings-pr.yml b/.github/workflows/greetings-pr.yml.disabled similarity index 73% rename from .github/workflows/greetings-pr.yml rename to .github/workflows/greetings-pr.yml.disabled index 7e96b4ae6e1..2a930929a6d 100644 --- a/.github/workflows/greetings-pr.yml +++ b/.github/workflows/greetings-pr.yml.disabled @@ -1,6 +1,7 @@ +# See syntax file on https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions name: Greetings PR -#on: [pull_request] +on: [pull_request] jobs: greeting: diff --git a/.github/workflows/stale-issues.yml b/.github/workflows/stale-issues.yml index 81a8c48a367..66eb3f0cd40 100644 --- a/.github/workflows/stale-issues.yml +++ b/.github/workflows/stale-issues.yml @@ -1,3 +1,4 @@ +# See syntax file on https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions name: "Close stale issues (bugs and feature requests)" on: From 76f0df138b1deaeb279d0bfb0713489c386d4246 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Feb 2020 01:26:40 +0100 Subject: [PATCH 738/784] Try to fix doc --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index dff1d84dddc..f5c05fdf969 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -297,7 +297,7 @@ function GETPOSTISSET($paramname) * @param int $filter Filter to apply when $check is set to 'custom'. (See http://php.net/manual/en/filter.filters.php for détails) * @param mixed $options Options to pass to filter_var when $check is set to 'custom' * @param string $noreplace Force disable of replacement of __xxx__ strings. - * @return string|string[] Value found (string or array), or '' if check fails + * @return string|array Value found (string or array), or '' if check fails */ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null, $options = null, $noreplace = 0) { From 1be6c43ed2b6bee2b8c5a66cb2af29e63ee24750 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Feb 2020 01:29:34 +0100 Subject: [PATCH 739/784] Try to fix scrutinizer warnings --- htdocs/blockedlog/admin/blockedlog.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/blockedlog/admin/blockedlog.php b/htdocs/blockedlog/admin/blockedlog.php index 065dd4cda9e..d5ee9aa0c58 100644 --- a/htdocs/blockedlog/admin/blockedlog.php +++ b/htdocs/blockedlog/admin/blockedlog.php @@ -40,11 +40,12 @@ $backtopage = GETPOST('backtopage', 'alpha'); * Actions */ +$reg = array(); if (preg_match('/set_(.*)/', $action, $reg)) { - $code=$reg[1]; + $code = $reg[1]; $values = GETPOST($code); - if(is_array($values))$values = implode(',', $values); + if (is_array($values)) $values = implode(',', $values); if (dolibarr_set_const($db, $code, $values, 'chaine', 0, '', $conf->entity) > 0) { @@ -59,7 +60,7 @@ if (preg_match('/set_(.*)/', $action, $reg)) if (preg_match('/del_(.*)/', $action, $reg)) { - $code=$reg[1]; + $code = $reg[1]; if (dolibarr_del_const($db, $code, 0) > 0) { Header("Location: ".$_SERVER["PHP_SELF"]); From ac5e9ce5b31e282fc722dff84d1803f10bb20d0e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Feb 2020 01:34:33 +0100 Subject: [PATCH 740/784] Fix doc --- htdocs/core/class/html.formmail.class.php | 9 +-------- htdocs/core/class/html.formsms.class.php | 5 +++++ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index b7e9c53a845..238c3cad60a 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -112,14 +112,7 @@ class FormMail extends Form public $withfrom; /** - * @var int - * @deprecated Fill withto with array before calling method. - * @see $withto - */ - public $withtosocid; - - /** - * @var int|int[] + * @var int|string|array */ public $withto; // Show recipient emails diff --git a/htdocs/core/class/html.formsms.class.php b/htdocs/core/class/html.formsms.class.php index fc30f0798b3..d16ec9efc94 100644 --- a/htdocs/core/class/html.formsms.class.php +++ b/htdocs/core/class/html.formsms.class.php @@ -53,6 +53,11 @@ class FormSms public $withtopic; public $withbody; + /** + * @var int Id of company + */ + public $withtosocid; + public $withfromreadonly; public $withreplytoreadonly; public $withtoreadonly; From 523e161f33f3947ba82a95a09e6c29171cb6897c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 20 Feb 2020 09:45:17 +0100 Subject: [PATCH 741/784] fix CATEGORY_ADD_DESC_INTO_DOC $cate->add_category doesn't exists --- htdocs/core/lib/pdf.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index e7538725bc2..b75cb1e4bd6 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1401,7 +1401,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, foreach ($tblcateg as $cate) { // Adding the descriptions if they are filled - $desccateg = $cate->add_description; + $desccateg = $cate->description; if ($desccateg) $libelleproduitservice .= '__N__'.$desccateg; } From 298853138a714144a59d0f786af1b78f14e31e62 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Thu, 20 Feb 2020 12:17:55 +0100 Subject: [PATCH 742/784] Update contact.class.php --- htdocs/contact/class/contact.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 013830ca864..ad68d88d643 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -314,9 +314,9 @@ class Contact extends CommonObject // Clean parameters $this->lastname = $this->lastname ?trim($this->lastname) : trim($this->name); $this->firstname = trim($this->firstname); - if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname = ucwords($this->lastname); + if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname = ucwords(strtolower($this->lastname)); if (!empty($conf->global->MAIN_ALL_TO_UPPER)) $this->lastname = strtoupper($this->lastname); - if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname = ucwords($this->firstname); + if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname = ucwords(strtolower($this->firstname)); if (empty($this->socid)) $this->socid = 0; if (empty($this->priv)) $this->priv = 0; if (empty($this->statut)) $this->statut = 0; // This is to convert '' into '0' to avoid bad sql request @@ -427,9 +427,9 @@ class Contact extends CommonObject $this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity); // Clean parameters - if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname = ucwords($this->lastname); + if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname = ucwords(strtolower($this->lastname)); if (!empty($conf->global->MAIN_ALL_TO_UPPER)) $this->lastname = strtoupper($this->lastname); - if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname = ucwords($this->firstname); + if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname = ucwords(strtolower($this->firstname)); $this->lastname = trim($this->lastname) ?trim($this->lastname) : trim($this->lastname); $this->firstname = trim($this->firstname); From e73d83767c45257a39e39fae7a45b36a3ed566ca Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Feb 2020 12:34:51 +0100 Subject: [PATCH 743/784] Fix phpcs --- htdocs/compta/sociales/list.php | 8 ++++---- htdocs/contact/class/contact.class.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 4b8500f5206..7f5d6b5ba3f 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -173,7 +173,7 @@ if ($resql) if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($search_ref) $param .= '&search_ref='.urlencode($search_ref); if ($search_label) $param .= '&search_label='.urlencode($search_label); - if ($search_project_ref >= 0) $param.="&search_project_ref=".urlencode($search_project_ref); + if ($search_project_ref >= 0) $param.="&search_project_ref=".urlencode($search_project_ref); if ($search_amount) $param .= '&search_amount='.urlencode($search_amount); if ($search_typeid) $param .= '&search_typeid='.urlencode($search_typeid); if ($search_status != '' && $search_status != '-1') $param .= '&search_status='.urlencode($search_status); @@ -282,7 +282,7 @@ if ($resql) $projectstatic->title=$obj->project_label; } - print ''; + print ''; // Ref print "\n"; @@ -304,9 +304,9 @@ if ($resql) print $projectstatic->getNomUrl(1); } print ''; - if (!$i) $totalarray['nbfield']++; + if (!$i) $totalarray['nbfield']++; } - + // Date print ''; if (!$i) $totalarray['nbfield']++; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 013830ca864..28e9b0d0ae3 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -865,7 +865,7 @@ class Contact extends CommonObject { $this->error = 'Fetch found several records. Rename one of contact to avoid duplicate.'; dol_syslog($this->error, LOG_ERR); - + return 2; } elseif ($num) // $num = 1 @@ -952,7 +952,7 @@ class Contact extends CommonObject // Retreive all extrafield // fetch optionals attributes and labels $this->fetch_optionals(); - + // Load also alerts of this user if ($user) { From 7234d841e11784e9f3ec8385864957dd34078aa0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Feb 2020 12:59:53 +0100 Subject: [PATCH 744/784] Fix doxygen --- htdocs/don/class/api_donations.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php index 4adef57e816..95ea92f1ff3 100644 --- a/htdocs/don/class/api_donations.class.php +++ b/htdocs/don/class/api_donations.class.php @@ -284,10 +284,10 @@ class Donations extends DolibarrApi * * @url POST {id}/validate * - * @throws 304 - * @throws 401 - * @throws 404 - * @throws 500 + * @throws RestException 304 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 500 * * @return array */ From b41c1c10a0b8fbd40394707f1a86a99f2ef8ed5e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Feb 2020 13:00:27 +0100 Subject: [PATCH 745/784] Fix doxygen --- htdocs/contrat/class/api_contracts.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/contrat/class/api_contracts.class.php b/htdocs/contrat/class/api_contracts.class.php index 9d201d6fef1..71458e76050 100644 --- a/htdocs/contrat/class/api_contracts.class.php +++ b/htdocs/contrat/class/api_contracts.class.php @@ -439,8 +439,9 @@ class Contracts extends DolibarrApi * @url DELETE {id}/lines/{lineid} * * @return int - * @throws 401 - * @throws 404 + * + * @throws RestException 401 + * @throws RestException 404 */ public function deleteLine($id, $lineid) { From 44eda2d4ad07b987f832223026e0a9a2dddeec64 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Feb 2020 13:42:43 +0100 Subject: [PATCH 746/784] Fix doxygen --- .../comm/propal/class/api_proposals.class.php | 25 ++-- htdocs/commande/class/api_orders.class.php | 51 +++---- .../bank/class/api_bankaccounts.class.php | 8 +- .../facture/class/api_invoices.class.php | 126 ++++++++-------- .../expedition/class/api_shipments.class.php | 21 +-- .../class/api_supplier_invoices.class.php | 38 ++--- htdocs/product/class/api_products.class.php | 136 +++++++++--------- .../societe/class/api_thirdparties.class.php | 85 +++++------ 8 files changed, 245 insertions(+), 245 deletions(-) diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 1337c62da94..d0ce31b5369 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -377,8 +377,9 @@ class Proposals extends DolibarrApi * @url DELETE {id}/lines/{lineid} * * @return int - * @throws 401 - * @throws 404 + * + * @throws RestException 401 + * @throws RestException 404 */ public function deleteLine($id, $lineid) { @@ -417,8 +418,9 @@ class Proposals extends DolibarrApi * @url POST {id}/contact/{contactid}/{type} * * @return int - * @throws 401 - * @throws 404 + * + * @throws RestException 401 + * @throws RestException 404 */ public function postContact($id, $contactid, $type) { @@ -458,9 +460,10 @@ class Proposals extends DolibarrApi * @url DELETE {id}/contact/{rowid} * * @return int - * @throws 401 - * @throws 404 - * @throws 500 + * + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 500 */ public function deleteContact($id, $rowid) { @@ -629,10 +632,10 @@ class Proposals extends DolibarrApi * * @url POST {id}/validate * - * @throws 304 - * @throws 401 - * @throws 404 - * @throws 500 + * @throws RestException 304 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 500 * * @return array */ diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 5069135dd88..60c9e23710b 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -425,8 +425,9 @@ class Orders extends DolibarrApi * @url DELETE {id}/lines/{lineid} * * @return int - * @throws 401 - * @throws 404 + * + * @throws RestException 401 + * @throws RestException 404 */ public function deleteLine($id, $lineid) { @@ -463,8 +464,9 @@ class Orders extends DolibarrApi * @url POST {id}/contact/{contactid}/{type} * * @return int - * @throws 401 - * @throws 404 + * + * @throws RestException 401 + * @throws RestException 404 */ public function postContact($id, $contactid, $type) { @@ -499,9 +501,10 @@ class Orders extends DolibarrApi * @url DELETE {id}/contact/{rowid} * * @return int - * @throws 401 - * @throws 404 - * @throws 500 + * + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 500 */ public function deleteContact($id, $rowid) { @@ -617,10 +620,10 @@ class Orders extends DolibarrApi * * @url POST {id}/validate * - * @throws 304 - * @throws 401 - * @throws 404 - * @throws 500 + * @throws RestException 304 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 500 * * @return array */ @@ -670,11 +673,11 @@ class Orders extends DolibarrApi * * @return int * - * @throws 304 - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 405 + * @throws RestException 304 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 405 */ public function reopen($id) { @@ -709,10 +712,10 @@ class Orders extends DolibarrApi * * @return int * - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 405 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 405 */ public function setinvoiced($id) { @@ -849,10 +852,10 @@ class Orders extends DolibarrApi * @url POST /createfromproposal/{proposalid} * * @return int - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 405 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 405 */ public function createOrderFromProposal($proposalid) { diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 2ecb59861d9..1272cfcad85 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -183,10 +183,10 @@ class BankAccounts extends DolibarrApi * * @status 201 * - * @throws 401 Unauthorized: User does not have permission to configure bank accounts - * @throws 404 Not Found: Either the source or the destination bankaccount for the provided id does not exist - * @throws 422 Unprocessable Entity: Refer to detailed exception message for the cause - * @throws 500 Internal Server Error: Error(s) returned by the RDBMS + * @throws RestException 401 Unauthorized: User does not have permission to configure bank accounts + * @throws RestException 404 Not Found: Either the source or the destination bankaccount for the provided id does not exist + * @throws RestException 422 Unprocessable Entity: Refer to detailed exception message for the cause + * @throws RestException 500 Internal Server Error: Error(s) returned by the RDBMS */ public function transfer($bankaccount_from_id = 0, $bankaccount_to_id = 0, $date = null, $description = "", $amount = 0.0, $amount_to = 0.0) { diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 7c7437bfb8e..e68966f4663 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -242,10 +242,10 @@ class Invoices extends DolibarrApi * @url POST /createfromorder/{orderid} * * @return int - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 405 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 405 */ public function createInvoiceFromOrder($orderid) { @@ -318,10 +318,9 @@ class Invoices extends DolibarrApi * * @return array * - * @throws 200 - * @throws 304 - * @throws 401 - * @throws 404 + * @throws RestException 304 + * @throws RestException 401 + * @throws RestException 404 Invoice not found */ public function putLine($id, $lineid, $request_data = null) { @@ -383,8 +382,9 @@ class Invoices extends DolibarrApi * @url POST {id}/contact/{contactid}/{type} * * @return int - * @throws 401 - * @throws 404 + * + * @throws RestException 401 + * @throws RestException 404 */ public function postContact($id, $contactid, $type) { @@ -424,9 +424,10 @@ class Invoices extends DolibarrApi * @url DELETE {id}/contact/{rowid} * * @return array - * @throws 401 - * @throws 404 - * @throws 500 + * + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 500 */ public function deleteContact($id, $rowid) { @@ -463,10 +464,10 @@ class Invoices extends DolibarrApi * * @return array * - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 405 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 405 */ public function deleteLine($id, $lineid) { @@ -591,10 +592,9 @@ class Invoices extends DolibarrApi * * @return int * - * @throws 200 - * @throws 401 - * @throws 404 - * @throws 400 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 400 */ public function postLine($id, $request_data = null) { @@ -673,11 +673,10 @@ class Invoices extends DolibarrApi * * @return array * - * @throws 200 - * @throws 304 - * @throws 401 - * @throws 404 - * @throws 500 + * @throws RestException 304 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 500 * */ public function addContact($id, $fk_socpeople, $type_contact, $source, $notrigger = 0) @@ -723,11 +722,10 @@ class Invoices extends DolibarrApi * * @return array * - * @throws 200 - * @throws 304 - * @throws 401 - * @throws 404 - * @throws 500 + * @throws RestException 304 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 500 * */ public function settodraft($id, $idwarehouse = -1) @@ -827,11 +825,10 @@ class Invoices extends DolibarrApi * * @return array An invoice object * - * @throws 200 - * @throws 304 - * @throws 401 - * @throws 404 - * @throws 500 + * @throws RestException 304 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 500 */ public function settopaid($id, $close_code = '', $close_note = '') { @@ -878,11 +875,10 @@ class Invoices extends DolibarrApi * * @return array An invoice object * - * @throws 200 - * @throws 304 - * @throws 401 - * @throws 404 - * @throws 500 + * @throws RestException 304 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 500 */ public function settounpaid($id) { @@ -927,11 +923,10 @@ class Invoices extends DolibarrApi * * @return array An invoice object * - * @throws 200 - * @throws 304 - * @throws 401 - * @throws 404 - * @throws 500 + * @throws RestException 304 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 500 */ public function markAsCreditAvailable($id) { @@ -1103,10 +1098,10 @@ class Invoices extends DolibarrApi * @url POST {id}/usediscount/{discountid} * * @return int - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 405 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 405 */ public function useDiscount($id, $discountid) { @@ -1149,10 +1144,10 @@ class Invoices extends DolibarrApi * @url POST {id}/usecreditnote/{discountid} * * @return int - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 405 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 405 */ public function useCreditNote($id, $discountid) { @@ -1194,10 +1189,11 @@ class Invoices extends DolibarrApi * @url GET {id}/payments * * @return array - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 405 + * + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 405 */ public function getPayments($id) { @@ -1243,9 +1239,9 @@ class Invoices extends DolibarrApi * @url POST {id}/payments * * @return int Payment ID - * @throws 400 - * @throws 401 - * @throws 404 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 */ public function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement = '', $comment = '', $chqemetteur = '', $chqbank = '') { @@ -1362,10 +1358,10 @@ class Invoices extends DolibarrApi * @url POST /paymentsdistributed * * @return int Payment ID - * @throws 400 - * @throws 401 - * @throws 403 - * @throws 404 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 403 + * @throws RestException 404 */ public function addPaymentDistributed($arrayofamounts, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement = '', $comment = '', $chqemetteur = '', $chqbank = '') { diff --git a/htdocs/expedition/class/api_shipments.class.php b/htdocs/expedition/class/api_shipments.class.php index 5aca14fb28d..8526f0c9610 100644 --- a/htdocs/expedition/class/api_shipments.class.php +++ b/htdocs/expedition/class/api_shipments.class.php @@ -373,8 +373,9 @@ class Shipments extends DolibarrApi * @url DELETE {id}/lines/{lineid} * * @return int - * @throws 401 - * @throws 404 + * + * @throws RestException 401 + * @throws RestException 404 */ public function deleteLine($id, $lineid) { @@ -537,10 +538,10 @@ class Shipments extends DolibarrApi // * // * @return int // * - // * @throws 400 - // * @throws 401 - // * @throws 404 - // * @throws 405 + // * @throws RestException 400 + // * @throws RestException 401 + // * @throws RestException 404 + // * @throws RestException 405 // */ /* public function setinvoiced($id) @@ -574,10 +575,10 @@ class Shipments extends DolibarrApi // * @url POST /createfromorder/{orderid} // * // * @return int - // * @throws 400 - // * @throws 401 - // * @throws 404 - // * @throws 405 + // * @throws RestException 400 + // * @throws RestException 401 + // * @throws RestException 404 + // * @throws RestException 405 // */ /* public function createShipmentFromOrder($orderid) diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 21e5e82c13b..204471bc9e7 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -194,8 +194,8 @@ class SupplierInvoices extends DolibarrApi * * @return int ID of supplier invoice * - * @throws 401 - * @throws 500 + * @throws RestException 401 + * @throws RestException 500 */ public function post($request_data = null) { @@ -226,8 +226,8 @@ class SupplierInvoices extends DolibarrApi * * @return int * - * @throws 401 - * @throws 404 + * @throws RestException 401 + * @throws RestException 404 */ public function put($id, $request_data = null) { @@ -262,9 +262,9 @@ class SupplierInvoices extends DolibarrApi * * @return array * - * @throws 401 - * @throws 404 - * @throws 500 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 500 */ public function delete($id) { @@ -304,11 +304,11 @@ class SupplierInvoices extends DolibarrApi * * @return array * - * @throws 304 - * @throws 401 - * @throws 404 - * @throws 405 - * @throws 500 + * @throws RestException 304 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 405 + * @throws RestException 500 */ public function validate($id, $idwarehouse = 0, $notrigger = 0) { @@ -348,10 +348,10 @@ class SupplierInvoices extends DolibarrApi * @url GET {id}/payments * * @return array - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 405 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 405 */ public function getPayments($id) { @@ -396,9 +396,9 @@ class SupplierInvoices extends DolibarrApi * @url POST {id}/payments * * @return int Payment ID - * @throws 400 - * @throws 401 - * @throws 404 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 */ public function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement = '', $comment = '', $chqemetteur = '', $chqbank = '') { diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 1e189026366..dc4d2e79481 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -73,9 +73,9 @@ class Products extends DolibarrApi * @param bool $includesubproducts Load information about subproducts * @return array|mixed Data without useless information * - * @throws 401 - * @throws 403 - * @throws 404 + * @throws RestException 401 + * @throws RestException 403 + * @throws RestException 404 */ public function get($id, $includestockdata = 0, $includesubproducts = false) { @@ -95,9 +95,9 @@ class Products extends DolibarrApi * * @url GET ref/{ref} * - * @throws 401 - * @throws 403 - * @throws 404 + * @throws RestException 401 + * @throws RestException 403 + * @throws RestException 404 */ public function getByRef($ref, $includestockdata = 0, $includesubproducts = false) { @@ -117,9 +117,9 @@ class Products extends DolibarrApi * * @url GET ref_ext/{ref_ext} * - * @throws 401 - * @throws 403 - * @throws 404 + * @throws RestException 401 + * @throws RestException 403 + * @throws RestException 404 */ public function getByRefExt($ref_ext, $includestockdata = 0, $includesubproducts = false) { @@ -139,9 +139,9 @@ class Products extends DolibarrApi * * @url GET barcode/{barcode} * - * @throws 401 - * @throws 403 - * @throws 404 + * @throws RestException 401 + * @throws RestException 403 + * @throws RestException 404 */ public function getByBarcode($barcode, $includestockdata = 0, $includesubproducts = false) { @@ -263,9 +263,8 @@ class Products extends DolibarrApi * @param array $request_data Datas * @return int * - * @throws RestException - * @throws 401 - * @throws 404 + * @throws RestException 401 + * @throws RestException 404 */ public function put($id, $request_data = null) { @@ -385,8 +384,8 @@ class Products extends DolibarrApi * @return array * * @throws RestException - * @throws 401 - * @throws 404 + * @throws RestException 401 + * @throws RestException 404 * * @url GET {id}/subproducts */ @@ -423,8 +422,8 @@ class Products extends DolibarrApi * @return int * * @throws RestException - * @throws 401 - * @throws 404 + * @throws RestException 401 + * @throws RestException 404 * * @url POST {id}/subproducts/add */ @@ -454,9 +453,8 @@ class Products extends DolibarrApi * @param int $subproduct_id Id of child product/service * @return int * - * @throws RestException - * @throws 401 - * @throws 404 + * @throws RestException 401 + * @throws RestException 404 * * @url DELETE {id}/subproducts/remove */ @@ -642,8 +640,8 @@ class Products extends DolibarrApi * * @return int * - * @throws 401 - * @throws 404 + * @throws RestException 401 + * @throws RestException 404 * */ public function deletePurchasePrice($id, $priceid) @@ -769,9 +767,9 @@ class Products extends DolibarrApi * * @url GET {id}/purchase_prices * - * @throws 401 - * @throws 403 - * @throws 404 + * @throws RestException 401 + * @throws RestException 403 + * @throws RestException 404 * */ public function getPurchasePrices($id, $ref = '', $ref_ext = '', $barcode = '') @@ -829,8 +827,8 @@ class Products extends DolibarrApi * @return array * * @throws RestException - * @throws 401 - * @throws 404 + * @throws RestException 401 + * @throws RestException 404 * * @url GET attributes/{id} */ @@ -856,8 +854,8 @@ class Products extends DolibarrApi * @param string $ref Reference of Attribute * @return array * - * @throws RestException - * @throws 401 + * @throws RestException 500 + * @throws RestException 401 * * @url GET attributes/ref/{ref} */ @@ -893,8 +891,8 @@ class Products extends DolibarrApi * @param string $label Label of Attribute * @return int * - * @throws RestException - * @throws 401 + * @throws RestException 500 + * @throws RestException 401 * * @url POST attributes */ @@ -923,8 +921,8 @@ class Products extends DolibarrApi * @return array * * @throws RestException - * @throws 401 - * @throws 404 + * @throws RestException 401 + * @throws RestException 404 * * @url PUT attributes/{id} */ @@ -968,8 +966,8 @@ class Products extends DolibarrApi * @param int $id ID of Attribute * @return int Result of deletion * - * @throws RestException - * @throws 401 + * @throws RestException 500 + * @throws RestException 401 * * @url DELETE attributes/{id} */ @@ -996,8 +994,8 @@ class Products extends DolibarrApi * @param int $id ID of Attribute value * @return array * - * @throws RestException - * @throws 401 + * @throws RestException 500 + * @throws RestException 401 * * @url GET attributes/values/{id} */ @@ -1037,8 +1035,8 @@ class Products extends DolibarrApi * @param string $ref Ref of Attribute value * @return array * - * @throws RestException - * @throws 401 + * @throws RestException 500 + * @throws RestException 401 * * @url GET attributes/{id}/values/ref/{ref} */ @@ -1078,8 +1076,7 @@ class Products extends DolibarrApi * @param string $ref Ref of Attribute value * @return int * - * @throws RestException - * @throws 401 + * @throws RestException 401 * * @url DELETE attributes/{id}/values/ref/{ref} */ @@ -1104,8 +1101,8 @@ class Products extends DolibarrApi * @param int $id ID of an Attribute * @return array * - * @throws RestException - * @throws 401 + * @throws RestException 401 + * @throws RestException 500 * * @url GET attributes/{id}/values */ @@ -1125,8 +1122,7 @@ class Products extends DolibarrApi * @param string $ref Ref of an Attribute * @return array * - * @throws RestException - * @throws 401 + * @throws RestException 401 * * @url GET attributes/ref/{ref}/values */ @@ -1165,8 +1161,8 @@ class Products extends DolibarrApi * @param string $value Value of Attribute value * @return int * - * @throws RestException - * @throws 401 + * @throws RestException 500 + * @throws RestException 401 * * @url POST attributes/{id}/values */ @@ -1198,8 +1194,8 @@ class Products extends DolibarrApi * @param array $request_data Datas * @return array * - * @throws RestException - * @throws 401 + * @throws RestException 401 + * @throws RestException 500 * * @url PUT attributes/values/{id} */ @@ -1243,8 +1239,8 @@ class Products extends DolibarrApi * @param int $id ID of Attribute value * @return int * - * @throws RestException - * @throws 401 + * @throws RestException 500 + * @throws RestException 401 * * @url DELETE attributes/values/{id} */ @@ -1269,8 +1265,8 @@ class Products extends DolibarrApi * @param int $id ID of Product * @return array * - * @throws RestException - * @throws 401 + * @throws RestException 500 + * @throws RestException 401 * * @url GET {id}/variants */ @@ -1297,8 +1293,8 @@ class Products extends DolibarrApi * @param string $ref Ref of Product * @return array * - * @throws RestException - * @throws 401 + * @throws RestException 500 + * @throws RestException 401 * * @url GET ref/{ref}/variants */ @@ -1336,9 +1332,9 @@ class Products extends DolibarrApi * @param array $features List of attributes pairs id_attribute->id_value. Example: array(id_color=>id_Blue, id_size=>id_small, id_option=>id_val_a, ...) * @return int * - * @throws RestException - * @throws 401 - * @throws 404 + * @throws RestException 500 + * @throws RestException 401 + * @throws RestException 404 * * @url POST {id}/variants */ @@ -1398,9 +1394,9 @@ class Products extends DolibarrApi * @param array $features List of attributes pairs id_attribute->id_value. Example: array(id_color=>id_Blue, id_size=>id_small, id_option=>id_val_a, ...) * @return int * - * @throws RestException - * @throws 401 - * @throws 404 + * @throws RestException 500 + * @throws RestException 401 + * @throws RestException 404 * * @url POST ref/{ref}/variants */ @@ -1455,8 +1451,8 @@ class Products extends DolibarrApi * @param array $request_data Datas * @return int * - * @throws RestException - * @throws 401 + * @throws RestException 500 + * @throws RestException 401 * * @url PUT variants/{id} */ @@ -1489,8 +1485,8 @@ class Products extends DolibarrApi * @param int $id ID of Variant * @return int Result of deletion * - * @throws RestException - * @throws 401 + * @throws RestException 500 + * @throws RestException 401 * * @url DELETE variants/{id} */ @@ -1570,9 +1566,9 @@ class Products extends DolibarrApi * @param bool $includesubproducts Load information about subproducts * @return array|mixed Data without useless information * - * @throws 401 - * @throws 403 - * @throws 404 + * @throws RestException 401 + * @throws RestException 403 + * @throws RestException 404 */ private function _fetch($id, $ref = '', $ref_ext = '', $barcode = '', $includestockdata = 0, $includesubproducts = false) { diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 07dd2ba6031..e055026910d 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -731,9 +731,9 @@ class Thirdparties extends DolibarrApi * * @return array List of outstandings proposals of thirdparty * - * @throws 400 - * @throws 401 - * @throws 404 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 */ public function getOutStandingProposals($id, $mode = 'customer') { @@ -775,9 +775,9 @@ class Thirdparties extends DolibarrApi * * @return array List of outstandings orders of thirdparty * - * @throws 400 - * @throws 401 - * @throws 404 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 */ public function getOutStandingOrder($id, $mode = 'customer') { @@ -818,9 +818,9 @@ class Thirdparties extends DolibarrApi * * @return array List of outstandings invoices of thirdparty * - * @throws 400 - * @throws 401 - * @throws 404 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 */ public function getOutStandingInvoices($id, $mode = 'customer') { @@ -861,9 +861,9 @@ class Thirdparties extends DolibarrApi * * @return array List of representatives of thirdparty * - * @throws 400 - * @throws 401 - * @throws 404 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 */ public function getSalesRepresentatives($id, $mode = 0) { @@ -903,10 +903,10 @@ class Thirdparties extends DolibarrApi * * @return array List of fixed discount of thirdparty * - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 503 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 503 */ public function getFixedAmountDiscounts($id, $filter = "none", $sortfield = "f.type", $sortorder = 'ASC') { @@ -961,10 +961,10 @@ class Thirdparties extends DolibarrApi * @url GET {id}/getinvoicesqualifiedforreplacement * * @return array - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 405 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 405 */ public function getInvoicesQualifiedForReplacement($id) { @@ -1003,10 +1003,11 @@ class Thirdparties extends DolibarrApi * @url GET {id}/getinvoicesqualifiedforcreditnote * * @return array - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 405 + * + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 405 */ public function getInvoicesQualifiedForCreditNote($id) { @@ -1313,8 +1314,8 @@ class Thirdparties extends DolibarrApi * @param string $site Site key * * @return SocieteAccount[] - * @throws 401 Unauthorized: User does not have permission to read thirdparties - * @throws 404 Not Found: Specified thirdparty ID does not belongs to an existing thirdparty + * @throws RestException 401 Unauthorized: User does not have permission to read thirdparties + * @throws RestException 404 Not Found: Specified thirdparty ID does not belongs to an existing thirdparty * * @url GET {id}/gateways/ */ @@ -1387,11 +1388,11 @@ class Thirdparties extends DolibarrApi * @param array $request_data Request data * * @return SocieteAccount - * @throws 401 Unauthorized: User does not have permission to read thirdparties - * @throws 409 Conflict: A SocieteAccount entity (gateway) already exists for this company and site. - * @throws 422 Unprocessable Entity: You must pass the site attribute in your request data ! - * @throws 500 Internal Server Error: Error creating SocieteAccount account - * @status 201 + * @throws RestException 401 Unauthorized: User does not have permission to read thirdparties + * @throws RestException 409 Conflict: A SocieteAccount entity (gateway) already exists for this company and site. + * @throws RestException 422 Unprocessable Entity: You must pass the site attribute in your request data ! + * @throws RestException 500 Internal Server Error: Error creating SocieteAccount account + * @status RestException 201 * * @url POST {id}/gateways */ @@ -1447,11 +1448,11 @@ class Thirdparties extends DolibarrApi * @param array $request_data Request data * * @return SocieteAccount - * @throws 401 Unauthorized: User does not have permission to read thirdparties - * @throws 422 Unprocessable Entity: You must pass the site attribute in your request data ! - * @throws 500 Internal Server Error: Error updating SocieteAccount entity * - * @throws RestException + * @throws RestException 401 Unauthorized: User does not have permission to read thirdparties + * @throws RestException 422 Unprocessable Entity: You must pass the site attribute in your request data ! + * @throws RestException 500 Internal Server Error: Error updating SocieteAccount entity + * * @url PUT {id}/gateways/{site} */ public function putSocieteAccount($id, $site, $request_data = null) @@ -1529,10 +1530,10 @@ class Thirdparties extends DolibarrApi * @param array $request_data Request data * * @return SocieteAccount - * @throws 401 Unauthorized: User does not have permission to read thirdparties - * @throws 404 Not Found: Specified thirdparty ID does not belongs to an existing thirdparty - * @throws 409 Conflict: Another SocieteAccount entity already exists for this thirdparty with this site key. - * @throws 500 Internal Server Error: Error updating SocieteAccount entity + * @throws RestException 401 Unauthorized: User does not have permission to read thirdparties + * @throws RestException 404 Not Found: Specified thirdparty ID does not belongs to an existing thirdparty + * @throws RestException 409 Conflict: Another SocieteAccount entity already exists for this thirdparty with this site key. + * @throws RestException 500 Internal Server Error: Error updating SocieteAccount entity * * @url PATCH {id}/gateways/{site} */ @@ -1583,9 +1584,9 @@ class Thirdparties extends DolibarrApi * @param int $site Site key * * @return void - * @throws 401 Unauthorized: User does not have permission to delete thirdparties gateways - * @throws 404 Not Found: Specified thirdparty ID does not belongs to an existing thirdparty - * @throws 500 Internal Server Error: Error deleting SocieteAccount entity + * @throws RestException 401 Unauthorized: User does not have permission to delete thirdparties gateways + * @throws RestException 404 Not Found: Specified thirdparty ID does not belongs to an existing thirdparty + * @throws RestException 500 Internal Server Error: Error deleting SocieteAccount entity * * @url DELETE {id}/gateways/{site} */ From 2c477c71692f4a9c4c4984dfb4ad1031dc41ab60 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Feb 2020 13:54:41 +0100 Subject: [PATCH 747/784] Fix doxygen --- .../template/class/api_mymodule.class.php | 7 +++++++ htdocs/societe/class/api_contacts.class.php | 12 ++++-------- .../societe/class/api_thirdparties.class.php | 3 ++- htdocs/ticket/class/api_tickets.class.php | 18 +++++++++--------- htdocs/user/class/api_users.class.php | 7 +++---- 5 files changed, 25 insertions(+), 22 deletions(-) diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index d7a810ac2cd..6dd93aceacd 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -63,6 +63,7 @@ class MyModuleApi extends DolibarrApi * @return array|mixed data without useless information * * @url GET myobjects/{id} + * * @throws RestException */ public function get($id) @@ -186,6 +187,8 @@ class MyModuleApi extends DolibarrApi * @param array $request_data Request datas * @return int ID of myobject * + * @throws RestException + * * @url POST myobjects/ */ public function post($request_data = null) @@ -212,6 +215,8 @@ class MyModuleApi extends DolibarrApi * @param array $request_data Datas * @return int * + * @throws RestException + * * @url PUT myobjects/{id} */ public function put($id, $request_data = null) @@ -250,6 +255,8 @@ class MyModuleApi extends DolibarrApi * @param int $id MyObject ID * @return array * + * @throws RestException + * * @url DELETE myobjects/{id} */ public function delete($id) diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index 6b6c5a439a6..2ae9fd34869 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -391,10 +391,8 @@ class Contacts extends DolibarrApi * * @return mixed * - * @throws 401 RestException Insufficient rights - * @throws 401 RestException Access not allowed for login - * @throws 404 RestException Category not found - * @throws 404 RestException Contact not found + * @throws RestException 401 Insufficient rights + * @throws RestException 404 Category or contact not found */ public function addCategory($id, $category_id) { @@ -433,10 +431,8 @@ class Contacts extends DolibarrApi * @param int $category_id Id of category * @return mixed * - * @throws 401 RestException Insufficient rights - * @throws 401 RestException Access not allowed for login - * @throws 404 RestException Category not found - * @throws 404 RestException Contact not found + * @throws RestException 401 Insufficient rights + * @throws RestException 404 Category or contact not found */ public function deleteCategory($id, $category_id) { diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index e055026910d..5f031137c1f 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -1388,11 +1388,11 @@ class Thirdparties extends DolibarrApi * @param array $request_data Request data * * @return SocieteAccount + * * @throws RestException 401 Unauthorized: User does not have permission to read thirdparties * @throws RestException 409 Conflict: A SocieteAccount entity (gateway) already exists for this company and site. * @throws RestException 422 Unprocessable Entity: You must pass the site attribute in your request data ! * @throws RestException 500 Internal Server Error: Error creating SocieteAccount account - * @status RestException 201 * * @url POST {id}/gateways */ @@ -1530,6 +1530,7 @@ class Thirdparties extends DolibarrApi * @param array $request_data Request data * * @return SocieteAccount + * * @throws RestException 401 Unauthorized: User does not have permission to read thirdparties * @throws RestException 404 Not Found: Specified thirdparty ID does not belongs to an existing thirdparty * @throws RestException 409 Conflict: Another SocieteAccount entity already exists for this thirdparty with this site key. diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index 707fe403c6c..ba82f0ba1f0 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -68,9 +68,9 @@ class Tickets extends DolibarrApi * @param int $id ID of ticket * @return array|mixed Data without useless information * - * @throws 401 - * @throws 403 - * @throws 404 + * @throws RestException 401 + * @throws RestException 403 + * @throws RestException 404 */ public function get($id) { @@ -87,9 +87,9 @@ class Tickets extends DolibarrApi * * @url GET track_id/{track_id} * - * @throws 401 - * @throws 403 - * @throws 404 + * @throws RestException 401 + * @throws RestException 403 + * @throws RestException 404 */ public function getByTrackId($track_id) { @@ -106,9 +106,9 @@ class Tickets extends DolibarrApi * * @url GET ref/{ref} * - * @throws 401 - * @throws 403 - * @throws 404 + * @throws RestException 401 + * @throws RestException 403 + * @throws RestException 404 */ public function getByRef($ref) { diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index fa139e2c69f..373a8b55f0e 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -171,9 +171,8 @@ class Users extends DolibarrApi * * @return array|mixed Data without useless information * - * @throws 401 RestException Insufficient rights - * @throws 404 RestException User not found - * @throws 404 RestException User group not found + * @throws RestException 401 Insufficient rights + * @throws RestException 404 User or group not found */ public function getInfo() { @@ -508,7 +507,7 @@ class Users extends DolibarrApi * Clean sensible object datas * * @param object $object Object to clean - * @return array Array of cleaned object properties + * @return array Array of cleaned object properties */ protected function _cleanObjectDatas($object) { From 52c7f908a056e1328b21b6666922c7a10c8c147f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Feb 2020 14:02:27 +0100 Subject: [PATCH 748/784] Doxygen --- .../compta/sociales/class/paymentsocialcontribution.class.php | 2 +- htdocs/contrat/tpl/linkedobjectblock.tpl.php | 2 +- .../template/core/tpl/linkedobjectblock_myobject.tpl.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index a5279ecbeae..629a73578b2 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -57,7 +57,7 @@ class PaymentSocialContribution extends CommonObject /** * @deprecated - * @see amount + * @see $amount */ public $total; diff --git a/htdocs/contrat/tpl/linkedobjectblock.tpl.php b/htdocs/contrat/tpl/linkedobjectblock.tpl.php index b7ec9574ccb..b200baef726 100644 --- a/htdocs/contrat/tpl/linkedobjectblock.tpl.php +++ b/htdocs/contrat/tpl/linkedobjectblock.tpl.php @@ -63,7 +63,7 @@ foreach($linkedObjectBlock as $key => $objectlink) echo price($totalcontrat); } ?> - + $objectlink) - + Date: Thu, 20 Feb 2020 14:07:25 +0100 Subject: [PATCH 749/784] Fix phpcs --- test/phpunit/SecurityTest.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index 36f29685e29..4130426d806 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -187,28 +187,28 @@ class SecurityTest extends PHPUnit\Framework\TestCase print __METHOD__." result=".$result."\n"; $this->assertEquals($result, $_GET["param2"]); - $result=GETPOST("param3", 'alpha'); // Must return '' as there is a forbidden char " + $result=GETPOST("param3", 'alpha'); // Must return string sanitized from char " print __METHOD__." result=".$result."\n"; - $this->assertEquals($result, ''); + $this->assertEquals($result, 'a/b#e(pr)qq-rr\cc'); - $result=GETPOST("param4", 'alpha'); // Must return '' as there is a forbidden char ../ + $result=GETPOST("param4", 'alpha'); // Must return string sanitized from ../ print __METHOD__." result=".$result."\n"; - $this->assertEquals($result, ''); + $this->assertEquals($result, 'dir'); // Test aZ09 - $result=GETPOST("param1", 'aZ09'); // Must return '' as there is a forbidden char ../ + $result=GETPOST("param1", 'aZ09'); print __METHOD__." result=".$result."\n"; $this->assertEquals($result, $_GET["param1"]); - $result=GETPOST("param2", 'aZ09'); // Must return '' as there is a forbidden char ../ + $result=GETPOST("param2", 'aZ09'); // Must return '' as string contains car not in aZ09 definition print __METHOD__." result=".$result."\n"; $this->assertEquals($result, ''); - $result=GETPOST("param3", 'aZ09'); // Must return '' as there is a forbidden char ../ + $result=GETPOST("param3", 'aZ09'); // Must return '' as string contains car not in aZ09 definition print __METHOD__." result=".$result."\n"; $this->assertEquals($result, ''); - $result=GETPOST("param4", 'aZ09'); // Must return '' as there is a forbidden char ../ + $result=GETPOST("param4", 'aZ09'); // Must return '' as string contains car not in aZ09 definition print __METHOD__." result=".$result."\n"; $this->assertEquals($result, ''); From 3df3a2560c0b1ddf2d1d665d1ae7481e1266bedd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 20 Feb 2020 15:11:31 +0100 Subject: [PATCH 750/784] fix workflow with multicurrency --- htdocs/compta/facture/class/facture.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index cb2bf087652..93f4f500473 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1253,6 +1253,14 @@ class Facture extends CommonInvoice $line->date_start = $object->lines[$i]->date_start; $line->date_end = $object->lines[$i]->date_end; + // Multicurrency + $line->fk_multicurrency = $object->lines[$i]->fk_multicurrency; + $line->multicurrency_code = $object->lines[$i]->multicurrency_code; + $line->multicurrency_subprice = $object->lines[$i]->multicurrency_subprice; + $line->multicurrency_total_ht = $object->lines[$i]->multicurrency_total_ht; + $line->multicurrency_total_tva = $object->lines[$i]->multicurrency_total_tva; + $line->multicurrency_total_ttc = $object->lines[$i]->multicurrency_total_ttc; + $line->fk_fournprice = $object->lines[$i]->fk_fournprice; $marginInfos = getMarginInfos($object->lines[$i]->subprice, $object->lines[$i]->remise_percent, $object->lines[$i]->tva_tx, $object->lines[$i]->localtax1_tx, $object->lines[$i]->localtax2_tx, $object->lines[$i]->fk_fournprice, $object->lines[$i]->pa_ht); $line->pa_ht = $marginInfos[0]; @@ -1267,6 +1275,7 @@ class Facture extends CommonInvoice $this->socid = $object->socid; $this->fk_project = $object->fk_project; + $this->fk_account = $object->fk_account; $this->cond_reglement_id = $object->cond_reglement_id; $this->mode_reglement_id = $object->mode_reglement_id; $this->availability_id = $object->availability_id; From 2942e85e47b5e67e256f34e0e087e6d600c8183e Mon Sep 17 00:00:00 2001 From: javierybar Date: Thu, 20 Feb 2020 15:16:17 +0100 Subject: [PATCH 751/784] More elegant and easy to understand printer setup --- htdocs/core/lib/takepos.lib.php | 11 +- htdocs/core/modules/modTakePos.class.php | 4 + htdocs/langs/en_US/cashdesk.lang | 5 + htdocs/takepos/admin/receipt.php | 174 +++++++++++++++++------ htdocs/takepos/admin/setup.php | 47 +----- htdocs/takepos/admin/terminal.php | 2 +- htdocs/takepos/invoice.php | 4 +- htdocs/takepos/takepos.php | 8 +- 8 files changed, 150 insertions(+), 105 deletions(-) diff --git a/htdocs/core/lib/takepos.lib.php b/htdocs/core/lib/takepos.lib.php index dc86853859e..65ad4c091a0 100644 --- a/htdocs/core/lib/takepos.lib.php +++ b/htdocs/core/lib/takepos.lib.php @@ -38,13 +38,10 @@ function takepos_prepare_head() $head[$h][2] = 'setup'; $h++; - if ($conf->global->TAKEPOS_CUSTOM_RECEIPT) - { - $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/receipt.php'; - $head[$h][1] = $langs->trans("Receipt"); - $head[$h][2] = 'receipt'; - $h++; - } + $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/receipt.php'; + $head[$h][1] = $langs->trans("Receipt"); + $head[$h][2] = 'receipt'; + $h++; $numterminals = max(1, $conf->global->TAKEPOS_NUM_TERMINALS); for ($i = 1; $i <= $numterminals; $i++) diff --git a/htdocs/core/modules/modTakePos.class.php b/htdocs/core/modules/modTakePos.class.php index 804ce8152ab..2243437d20f 100644 --- a/htdocs/core/modules/modTakePos.class.php +++ b/htdocs/core/modules/modTakePos.class.php @@ -265,6 +265,10 @@ class modTakePos extends DolibarrModules */ public function init($options = '') { + global $conf,$db; + + dolibarr_set_const($db, "TAKEPOS_PRINT_METHOD", "browser", 'chaine', 0, '', $conf->entity); + $this->_load_tables('/takepos/sql/'); $sql = array(); diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index a468b7d6ab1..28e87394089 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -85,3 +85,8 @@ ColorTheme=Color theme Colorful=Colorful HeadBar=Head Bar SortProductField=Field for sorting products +Browser=Browser +BrowserMethodDescription=Simple and easy receipt printing. Only a few parameters to configure the receipt. Print via browser. +TakeposConnectorMethodDescription=External module with extra features. Posibility to print from de cloud. +PrintMethod=Print method +ReceiptPrinterMethodDescription=Powerful method with a lot of parameters. Full customizable with templates. Cannot print from the cloud. \ No newline at end of file diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index 967881e33d7..ef31bc2392c 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -46,6 +46,9 @@ if (GETPOST('action', 'alpha') == 'set') $res = dolibarr_set_const($db, "TAKEPOS_FOOTER", GETPOST('TAKEPOS_FOOTER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_RECEIPT_NAME", GETPOST('TAKEPOS_RECEIPT_NAME', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_SHOW_CUSTOMER", GETPOST('TAKEPOS_SHOW_CUSTOMER', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_AUTO_PRINT_TICKETS", GETPOST('TAKEPOS_AUTO_PRINT_TICKETS', 'int'), 'int', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_PRINT_SERVER", GETPOST('TAKEPOS_PRINT_SERVER', 'alpha'), 'chaine', 0, '', $conf->entity); + dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha')); @@ -62,6 +65,10 @@ if (GETPOST('action', 'alpha') == 'set') setEventMessages($langs->trans("Error"), null, 'errors'); } } +elseif (GETPOST('action', 'alpha') == 'setmethod') +{ + dolibarr_set_const($db, "TAKEPOS_PRINT_METHOD", GETPOST('value', 'alpha'), 'chaine', 0, '', $conf->entity); +} /* @@ -79,64 +86,139 @@ $head = takepos_prepare_head(); dol_fiche_head($head, 'receipt', 'TakePOS', -1); print '
'; - -// Mode print ''; print ''; print ''; +print load_fiche_titre($langs->trans("PrintMethod"), '', ''); + +print '
'; print $langs->trans('Ref'); @@ -2828,7 +2857,19 @@ if ($action == 'createsite') print '
'; print $langs->trans('Description'); print ''; - print ''; + print ''; + print '
'; + print $langs->trans('MainLanguage'); + print ''; + print $formadmin->select_language((GETPOSTISSET('WEBSITE_LANG') ? GETPOST('WEBSITE_LANG', 'alpha') : $langs->defaultlang), 'WEBSITE_LANG', 0, 0, 0, 0, 0, 'minwidth300', 2); + print '
'; + print $langs->trans('OtherLanguages'); + print ''; + print ''; print '
'; From 7796724d6372b865ad386989cdc46eaadac022ff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Feb 2020 01:07:41 +0100 Subject: [PATCH 734/784] Update list.php --- htdocs/compta/sociales/list.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 94a7eadf0fb..4b8500f5206 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -54,11 +54,8 @@ $search_status = GETPOST('search_status', 'int'); $search_day_lim = GETPOST('search_day_lim', 'int'); $search_month_lim = GETPOST('search_month_lim', 'int'); $search_year_lim = GETPOST('search_year_lim', 'int'); - -if (! empty($conf->projet->enabled)) { - $search_project_ref=GETPOST('search_project_ref', 'alpha'); - $search_project=GETPOST('search_project', 'alpha'); -} +$search_project_ref = GETPOST('search_project_ref', 'alpha'); +$search_project = GETPOST('search_project', 'alpha'); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); From 5c48f6f405d4ad1b6fa879a8e230bd56bc2ab167 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Feb 2020 01:08:53 +0100 Subject: [PATCH 735/784] Lang of web site is optional --- htdocs/core/class/html.formadmin.class.php | 13 ++++--- htdocs/website/index.php | 44 +++++++++++++++------- 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index 7012b813f7d..ff99431b221 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -50,7 +50,7 @@ class FormAdmin * @param string $selected Language pre-selected * @param string $htmlname Name of HTML select * @param int $showauto Show 'auto' choice - * @param array $filter Array of keys to exclude in list + * @param array $filter Array of keys to exclude in list (opposite of $onlykeys) * @param string $showempty '1'=Add empty value or string to show * @param int $showwarning Show a warning if language is not complete * @param int $disabled Disable edit of select @@ -58,9 +58,10 @@ class FormAdmin * @param int $showcode 1=Add language code into label at begining, 2=Add language code into label at end * @param int $forcecombo Force to use combo box (so no ajax beautify effect) * @param int $multiselect Make the combo a multiselect + * @param array $onlykeys Show only the following keys (opposite of $filter) * @return string Return HTML select string with list of languages */ - public function select_language($selected = '', $htmlname = 'lang_id', $showauto = 0, $filter = null, $showempty = '', $showwarning = 0, $disabled = 0, $morecss = '', $showcode = 0, $forcecombo = 0, $multiselect = 0) + public function select_language($selected = '', $htmlname = 'lang_id', $showauto = 0, $filter = null, $showempty = '', $showwarning = 0, $disabled = 0, $morecss = '', $showcode = 0, $forcecombo = 0, $multiselect = 0, $onlykeys = array()) { // phpcs:enable global $conf, $langs; @@ -96,11 +97,13 @@ class FormAdmin if ($showcode == 1) $valuetoshow=$key.' - '.$value; if ($showcode == 2) $valuetoshow=$value.' ('.$key.')'; - if ($filter && is_array($filter) && array_key_exists($key, $filter)) - { + if ($filter && is_array($filter) && array_key_exists($key, $filter)) { continue; } - elseif ($selected == $key) + if ($onlykeys && is_array($onlykeys) && ! array_key_exists($key, $onlykeys)) { + continue; + } + if ($selected == $key) { $out.= ''; } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index c44341e0361..cd00989b339 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2016-2020 Laurent Destailleur * * 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 @@ -779,16 +779,15 @@ if ($action == 'addcontainer') } else { - $objectpage->title = GETPOST('WEBSITE_TITLE', 'alpha'); - $objectpage->type_container = GETPOST('WEBSITE_TYPE_CONTAINER', 'alpha'); + $objectpage->title = GETPOST('WEBSITE_TITLE', 'alphanohtml'); + $objectpage->type_container = GETPOST('WEBSITE_TYPE_CONTAINER', 'aZ09'); $objectpage->pageurl = GETPOST('WEBSITE_PAGENAME', 'alpha'); - $objectpage->aliasalt = GETPOST('WEBSITE_ALIASALT', 'alpha'); - $objectpage->description = GETPOST('WEBSITE_DESCRIPTION', 'alpha'); - $objectpage->lang = GETPOST('WEBSITE_LANG', 'alpha'); - $objectpage->otherlang = GETPOST('WEBSITE_OTHERLANG', 'alpha'); - $objectpage->image = GETPOST('WEBSITE_IMAGE', 'alpha'); - $objectpage->keywords = GETPOST('WEBSITE_KEYWORDS', 'alpha'); + $objectpage->aliasalt = GETPOST('WEBSITE_ALIASALT', 'alphanohtml'); + $objectpage->description = GETPOST('WEBSITE_DESCRIPTION', 'alphanohtml'); $objectpage->lang = GETPOST('WEBSITE_LANG', 'aZ09'); + $objectpage->otherlang = GETPOST('WEBSITE_OTHERLANG', 'aZ09comma'); + $objectpage->image = GETPOST('WEBSITE_IMAGE', 'alpha'); + $objectpage->keywords = GETPOST('WEBSITE_KEYWORDS', 'alphanohtml'); $objectpage->htmlheader = GETPOST('htmlheader', 'none'); $substitutionarray = array(); @@ -1417,8 +1416,7 @@ if ($action == 'updatemeta') $objectpage->otherlang = GETPOST('WEBSITE_OTHERLANG', 'aZ09comma'); $objectpage->description = GETPOST('WEBSITE_DESCRIPTION', 'alphanohtml'); $objectpage->image = GETPOST('WEBSITE_IMAGE', 'alpha'); - $objectpage->keywords = GETPOST('WEBSITE_KEYWORDS', 'alpha'); - $objectpage->lang = GETPOST('WEBSITE_LANG', 'aZ09'); + $objectpage->keywords = GETPOST('WEBSITE_KEYWORDS', 'alphanohtml'); $objectpage->htmlheader = trim(GETPOST('htmlheader', 'none')); $objectpage->fk_page = (GETPOST('pageidfortranslation', 'int') > 0 ? GETPOST('pageidfortranslation', 'int') : 0); @@ -2704,7 +2702,7 @@ if ($action == 'editcss') $htmltext=''; print $form->textwithpicto($langs->trans('MainLanguage'), $htmltext, 1, 'help', '', 0, 2, 'WEBSITE_LANG'); print ''; - print $formadmin->select_language((GETPOSTISSET('WEBSITE_LANG') ? GETPOST('WEBSITE_LANG', 'alpha') : ($object->lang ? $object->lang : $langs->defaultlang)), 'WEBSITE_LANG', 0, 0, 0, 0, 0, 'minwidth300', 2); + print $formadmin->select_language((GETPOSTISSET('WEBSITE_LANG') ? GETPOST('WEBSITE_LANG', 'aZ09comma') : ($object->lang ? $object->lang : '0')), 'WEBSITE_LANG', 0, null, 1, 0, 0, 'minwidth300', 2); print '
'; print $langs->trans('MainLanguage'); print ''; - print $formadmin->select_language((GETPOSTISSET('WEBSITE_LANG') ? GETPOST('WEBSITE_LANG', 'alpha') : $langs->defaultlang), 'WEBSITE_LANG', 0, 0, 0, 0, 0, 'minwidth300', 2); + print $formadmin->select_language((GETPOSTISSET('WEBSITE_LANG') ? GETPOST('WEBSITE_LANG', 'aZ09comma') : '0'), 'WEBSITE_LANG', 0, null, 1, 0, 0, 'minwidth300', 2); print '
'; @@ -3098,7 +3096,25 @@ if ($action == 'editmeta' || $action == 'createcontainer') print '
'; print $langs->trans('Language'); print ''; - print $formadmin->select_language($pagelang ? $pagelang : $langs->defaultlang, 'WEBSITE_LANG', 0, null, '1', 0, 0, 'minwidth200'); + $onlykeys = array(); + if ($object->lang) $onlykeys[$object->lang] = $object->lang; + else $onlykeys[$langs->defaultlang] = $langs->defaultlang; + if ($object->otherlang) { + $tmparray = explode(',', $object->otherlang); + foreach($tmparray as $key) { + $tmpkey = trim($key); + if (strlen($key) == 2) { + $tmpkey = strtolower($key).'_'.strtoupper($tmpkey); + } + $onlykeys[$tmpkey] = $tmpkey; + } + } + if (empty($object->lang) && empty($object->otherlang)) { + $onlykeys = null; // We keep full list of languages + } + print $formadmin->select_language($pagelang ? $pagelang : '', 'WEBSITE_LANG', 0, null, '1', 0, 0, 'minwidth200', 0, 0, 0, $onlykeys); + $htmltext = $langs->trans("AvailableLanguagesAreDefinedIntoWebsiteProperties"); + print $form->textwithpicto('', $htmltext); print '
".$chargesociale_static->getNomUrl(1, '20')."'.dol_print_date($db->jdate($obj->date_ech), 'day').'getLibStatut(7); ?>'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>
date, 'day'); ?> getLibStatut(7); ?>'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>
'; +print ''; +print ''; +print "\n"; + +// Browser method +print '\n"; + +// Receipt printer module +if ($conf->receiptprinter->enabled) { + print '\n"; +} + +// TakePOS Connector +print '\n"; +print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status").'
'; +print $langs->trans('Browser'); +print ''; +print $langs->trans('BrowserMethodDescription'); +print ''; +if ($conf->global->TAKEPOS_PRINT_METHOD == "browser") +{ + print img_picto($langs->trans("Activated"), 'switch_on'); +} +else +{ + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; +} +print "
'; + print $langs->trans('DolibarrReceiptPrinter'); + print ''; + print $langs->trans('ReceiptPrinterMethodDescription'); + print ''; + if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") + { + print img_picto($langs->trans("Activated"), 'switch_on'); + } + else + { + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + } + print "
'; +print "TakePOS Connector"; +print ''; +print $langs->trans('TakeposConnectorMethodDescription'); +print ''; +if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") +{ + print img_picto($langs->trans("Activated"), 'switch_on'); +} +else +{ + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; +} +print "
'; + +print load_fiche_titre($langs->trans("Setup"), '', ''); + print ''; print ''; print ''; print "\n"; -$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2); -$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation"); -$htmltext = ''.$langs->trans("AvailableVariables").':
'; -foreach ($substitutionarray as $key => $val) $htmltext .= $key.'
'; -$htmltext .= '
'; +if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector"){ + print ''; +} +if ($conf->global->TAKEPOS_PRINT_METHOD == "browser" || $conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector"){ + $substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2); + $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation"); + $htmltext = ''.$langs->trans("AvailableVariables").':
'; + foreach ($substitutionarray as $key => $val) $htmltext .= $key.'
'; + $htmltext .= '
'; + + print '\n"; + + print '\n"; + + print ''; + + // Customer information + print '\n"; +} + +// Auto print tickets print '\n"; - -print '\n"; - -print ''; - -// Customer information -print '\n"; print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'; + print $langs->trans("IPAddress").' ('.$langs->trans("TakeposConnectorNecesary").')'; + print ''; + print ''; + print '
'; + print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices")." - ".$langs->trans("Header"), $htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; + print '
'; + $variablename = 'TAKEPOS_HEADER'; + if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) + { + print ''; + } + else + { + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); + print $doleditor->Create(); + } + print "
'; + print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices")." - ".$langs->trans("Footer"), $htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; + print '
'; + $variablename = 'TAKEPOS_FOOTER'; + if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) + { + print ''; + } + else + { + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); + print $doleditor->Create(); + } + print "
'; + print ''; + print '
'; + print $langs->trans('ShowCustomer'); + print ''; + print $form->selectyesno("TAKEPOS_SHOW_CUSTOMER", $conf->global->TAKEPOS_SHOW_CUSTOMER, 1); + print "
'; -print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices")." - ".$langs->trans("Header"), $htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; -print '
'; -$variablename = 'TAKEPOS_HEADER'; -if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) -{ - print ''; -} -else -{ - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); - print $doleditor->Create(); -} -print "
'; -print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices")." - ".$langs->trans("Footer"), $htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; -print '
'; -$variablename = 'TAKEPOS_FOOTER'; -if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) -{ - print ''; -} -else -{ - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); - print $doleditor->Create(); -} -print "
'; -print ''; -print '
'; -print $langs->trans('ShowCustomer'); +print $langs->trans("AutoPrintTickets"); print ''; -print $form->selectyesno("TAKEPOS_SHOW_CUSTOMER", $conf->global->TAKEPOS_SHOW_CUSTOMER, 1); +print $form->selectyesno("TAKEPOS_AUTO_PRINT_TICKETS", $conf->global->TAKEPOS_AUTO_PRINT_TICKETS, 1); print "
'; diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index c1fa8b10b42..69cb042f064 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -66,18 +66,13 @@ if (GETPOST('action', 'alpha') == 'set') $res = dolibarr_set_const($db, "CASHDESK_SERVICES", GETPOST('CASHDESK_SERVICES', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_ROOT_CATEGORY_ID", GETPOST('TAKEPOS_ROOT_CATEGORY_ID', 'alpha'), 'chaine', 0, '', $conf->entity); - - $res = dolibarr_set_const($db, "TAKEPOSCONNECTOR", GETPOST('TAKEPOSCONNECTOR', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_DOLIBARR_PRINTER", GETPOST('TAKEPOS_DOLIBARR_PRINTER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_BAR_RESTAURANT", GETPOST('TAKEPOS_BAR_RESTAURANT', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_TICKET_VAT_GROUPPED", GETPOST('TAKEPOS_TICKET_VAT_GROUPPED', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_PRINT_SERVER", GETPOST('TAKEPOS_PRINT_SERVER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTERS", GETPOST('TAKEPOS_ORDER_PRINTERS', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_ORDER_NOTES", GETPOST('TAKEPOS_ORDER_NOTES', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_PHONE_BASIC_LAYOUT", GETPOST('TAKEPOS_PHONE_BASIC_LAYOUT', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS", GETPOST('TAKEPOS_SUPPLEMENTS', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS_CATEGORY", GETPOST('TAKEPOS_SUPPLEMENTS_CATEGORY', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_AUTO_PRINT_TICKETS", GETPOST('TAKEPOS_AUTO_PRINT_TICKETS', 'int'), 'int', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_NUMPAD", GETPOST('TAKEPOS_NUMPAD', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_SORTPRODUCTFIELD", GETPOST('TAKEPOS_SORTPRODUCTFIELD', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_COLOR_THEME", GETPOST('TAKEPOS_COLOR_THEME', 'alpha'), 'chaine', 0, '', $conf->entity); @@ -158,13 +153,6 @@ if (!empty($conf->service->enabled)) print "\n"; } -// Auto print tickets -print ''; -print $langs->trans("AutoPrintTickets"); -print ''; -print $form->selectyesno("TAKEPOS_AUTO_PRINT_TICKETS", $conf->global->TAKEPOS_AUTO_PRINT_TICKETS, 1); -print "\n"; - // Root category for products print ''; print $form->textwithpicto($langs->trans("RootCategoryForProductsToSell"), $langs->trans("RootCategoryForProductsToSellDesc")); @@ -173,31 +161,6 @@ print $form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEP print ajax_combobox('TAKEPOS_ROOT_CATEGORY_ID'); print "\n"; -if ($conf->receiptprinter->enabled) { - // Use Dolibarr printing - print ''; - print $langs->trans("DolibarrReceiptPrinterModule"); - print ''; - print $form->selectyesno("TAKEPOS_DOLIBARR_PRINTER", $conf->global->TAKEPOS_DOLIBARR_PRINTER, 1); - print "\n"; -} - -// Use Takepos printing -print ''; -print $langs->trans("DolibarrReceiptPrinter").' (
'.$langs->trans("TakeposConnectorNecesary").')'; -print ''; -print $form->selectyesno("TAKEPOSCONNECTOR", $conf->global->TAKEPOSCONNECTOR, 1); -print "\n"; - -if ($conf->global->TAKEPOSCONNECTOR) { - print ''; - print $langs->trans("IPAddress").' ('.$langs->trans("TakeposConnectorNecesary").')'; - print ''; - print ''; - print ''; -} - - // Bar Restaurant mode print ''; print $langs->trans("EnableBarOrRestaurantFeatures"); @@ -206,7 +169,7 @@ print ''; print $form->selectyesno("TAKEPOS_BAR_RESTAURANT", $conf->global->TAKEPOS_BAR_RESTAURANT, 1); print "\n"; -if ($conf->global->TAKEPOS_BAR_RESTAURANT && $conf->global->TAKEPOSCONNECTOR) { +if ($conf->global->TAKEPOS_BAR_RESTAURANT && $conf->global->TAKEPOS_PRINT_METHOD != "browser") { print ''; print $langs->trans("OrderPrinters").' ('.$langs->trans("Setup").')'; print ''; @@ -276,6 +239,7 @@ $substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); $htmltext = ''.$langs->trans("AvailableVariables").':
'; foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; $htmltext.='
'; + // Color theme print ''; print $langs->trans("ColorTheme"); @@ -291,13 +255,6 @@ print ''; print $form->selectyesno("TAKEPOS_DIRECT_PAYMENT", $conf->global->TAKEPOS_DIRECT_PAYMENT, 1); print "\n"; -// Custom Receipt -print ''; -print $langs->trans('CustomReceipt'); -print ''; -print $form->selectyesno("TAKEPOS_CUSTOM RECEIPT", $conf->global->TAKEPOS_CUSTOM_RECEIPT, 1); -print "\n"; - // Head Bar /*print ''; print $langs->trans('HeadBar'); diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index b30cb4e7032..0894ab734f8 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -209,7 +209,7 @@ if (!empty($conf->stock->enabled)) print ''; } -if ($conf->receiptprinter->enabled) { +if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") { // Select printer to use with terminal require_once DOL_DOCUMENT_ROOT.'/core/class/dolreceiptprinter.class.php'; $printer = new dolReceiptPrinter($db); diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 77c59b090ca..a01cc04d416 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -504,9 +504,9 @@ if ($action == "valid" || $action == "history") else $sectionwithinvoicelink .= $langs->trans('BillShortStatusValidated'); } $sectionwithinvoicelink .= ''; - if ($conf->global->TAKEPOSCONNECTOR) { + if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector"){ $sectionwithinvoicelink .= ' '; - } elseif ($conf->global->TAKEPOS_DOLIBARR_PRINTER) { + } elseif ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter"){ $sectionwithinvoicelink .= ' '; } else { $sectionwithinvoicelink .= ' '; diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index 75145154c22..bd559c043b4 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -768,13 +768,13 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) //add temp ticket button if ($conf->global->TAKEPOS_BAR_RESTAURANT) { - if ($conf->global->TAKEPOSCONNECTOR) { + if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector"){ $menus[$r++] = array('title'=>'
'.$langs->trans("Receipt").'
', 'action'=>'TakeposPrinting(placeid);'); } else { $menus[$r++] = array('title'=>'
'.$langs->trans("Receipt").'
', 'action'=>'Print(placeid);'); } } - if ($conf->global->TAKEPOSCONNECTOR && $conf->global->TAKEPOS_ORDER_NOTES == 1) + if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector" && $conf->global->TAKEPOS_ORDER_NOTES == 1) { $menus[$r++] = array('title'=>'
'.$langs->trans("OrderNotes").'
', 'action'=>'TakeposOrderNotes();'); } @@ -784,10 +784,10 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) } } -if ($conf->global->TAKEPOSCONNECTOR) { +if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector"){ $menus[$r++] = array('title'=>'
'.$langs->trans("DOL_OPEN_DRAWER").'
', 'action'=>'OpenDrawer();'); } -if ($conf->global->TAKEPOS_DOLIBARR_PRINTER) { +if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") { $menus[$r++] = array( 'title' => '
'.$langs->trans("DOL_OPEN_DRAWER").'
', 'action' => 'DolibarrOpenDrawer();', From a3fce650d9bd613d2a0529505fc35b227d6af8ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Feb 2020 15:25:32 +0100 Subject: [PATCH 752/784] FIX etrafield with visibilty=5 were not in read only FIX CSS FIX option for topbar search and bookmarks --- htdocs/core/tpl/extrafields_view.tpl.php | 4 +- htdocs/main.inc.php | 6 ++- htdocs/theme/eldy/dropdown.inc.php | 56 ++++++++++++++++++++++-- htdocs/theme/eldy/global.inc.php | 6 +++ 4 files changed, 65 insertions(+), 7 deletions(-) diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index f8767a82163..1ef3ef07255 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -73,7 +73,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] //print $key.'-'.$enabled.'-'.$perms.'-'.$label.$_POST["options_" . $key].'
'."\n"; if (empty($enabled)) continue; // 0 = Never visible field - if (abs($enabled) != 1 && abs($enabled) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list + if (abs($enabled) != 1 && abs($enabled) != 3 && abs($enabled) != 5) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list if (empty($perms)) continue; // 0 = Not visible // Load language if required @@ -135,7 +135,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] if ($object->element == 'productlot') $permok = $user->rights->stock->creer; if ($object->element == 'facturerec') $permok = $user->rights->facture->creer; if (($object->statut == 0 || !empty($extrafields->attributes[$object->table_element]['alwayseditable'][$key])) - && $permok && ($action != 'edit_extras' || GETPOST('attribute') != $key) + && $permok && $enabled != 5 && ($action != 'edit_extras' || GETPOST('attribute') != $key) && empty($extrafields->attributes[$object->table_element]['computed'][$key])) { $fieldid = 'id'; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 738b8b6ec18..42cb6587eee 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2046,7 +2046,7 @@ function top_menu_search() - '; @@ -2077,7 +2077,8 @@ function top_menu_search() // close drop down $(document).on("click", function(event) { - if (!$(event.target).closest("#topmenu-global-search-dropdown").length) { + if (!$(event.target).closest("#topmenu-global-search-dropdown").length) { + console.log("click close"); // Hide the menus. $("#topmenu-global-search-dropdown").removeClass("open"); } @@ -2085,6 +2086,7 @@ function top_menu_search() // Open drop down $("#topmenu-global-search-dropdown .dropdown-toggle").on("click", function(event) { + console.log("click open"); openGlobalSearchDropDown(); }); diff --git a/htdocs/theme/eldy/dropdown.inc.php b/htdocs/theme/eldy/dropdown.inc.php index fb8856d4687..63b7a268440 100644 --- a/htdocs/theme/eldy/dropdown.inc.php +++ b/htdocs/theme/eldy/dropdown.inc.php @@ -5,10 +5,60 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> * Dropdown of user popup */ -.open>.dropdown-menu{ +button.dropdown-item.global-search-item { + outline: none; +} + +.open>.dropdown-search, .open>.dropdown-bookmark, .open>.dropdown-menu{ display: block; } +.dropdown-search { + border-color: #eee; + + position: absolute; + top: 100%; + left: 0; + z-index: 1000; + display: none; + float: left; + min-width: 160px; + margin: 2px 0 0; + font-size: 14px; + text-align: left; + list-style: none; + background-color: #fff; + -webkit-background-clip: padding-box; + background-clip: padding-box; + border: 1px solid #ccc; + border: 1px solid rgba(0,0,0,.15); + border-radius: 4px; + -webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175); + box-shadow: 0 6px 12px rgba(0,0,0,.175); +} +.dropdown-bookmark { + border-color: #eee; + + position: absolute; + top: 100%; + left: 0; + z-index: 1000; + display: none; + float: left; + min-width: 160px; + margin: 2px 0 0; + font-size: 14px; + text-align: left; + list-style: none; + background-color: #fff; + -webkit-background-clip: padding-box; + background-clip: padding-box; + border: 1px solid #ccc; + border: 1px solid rgba(0,0,0,.15); + border-radius: 4px; + -webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175); + box-shadow: 0 6px 12px rgba(0,0,0,.175); +} .dropdown-menu { border-color: #eee; @@ -34,7 +84,6 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> } - .dropdown-toggle{ text-decoration: none !important; } @@ -177,7 +226,8 @@ a.top-menu-dropdown-link { .dropdown-body::-webkit-scrollbar-thumb { -webkit-border-radius: 0; border-radius: 0; - background: rgb(); + /* background: rgb(); */ + background: #aaa; } .dropdown-body::-webkit-scrollbar-track { -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 191247c9ca6..ce7e707e53d 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1592,6 +1592,7 @@ div#id-top { background: rgb(); background-image: linear-gradient(-45deg, , rgb()); + /* box-shadow: 0px 0px 5px #eee; */ } @@ -4853,6 +4854,11 @@ div.dataTables_length select { /* Select2 */ /* ============================================================================== */ +.select2-container--default .select2-results__option--highlighted[aria-selected] { + background-color: rgb(); + color: #; +} + span.select2.select2-container.select2-container--default { border-left: none; border-top: none; From 593091f39964dd15e0e6429653b0ba547a70f508 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Feb 2020 15:25:32 +0100 Subject: [PATCH 753/784] FIX etrafield with visibilty=5 were not in read only FIX CSS FIX option for topbar search and bookmarks Conflicts: htdocs/theme/eldy/global.inc.php --- htdocs/core/tpl/extrafields_view.tpl.php | 4 +- htdocs/main.inc.php | 6 ++- htdocs/theme/eldy/dropdown.inc.php | 56 ++++++++++++++++++++++-- htdocs/theme/eldy/global.inc.php | 6 +++ 4 files changed, 65 insertions(+), 7 deletions(-) diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index f8767a82163..1ef3ef07255 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -73,7 +73,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] //print $key.'-'.$enabled.'-'.$perms.'-'.$label.$_POST["options_" . $key].'
'."\n"; if (empty($enabled)) continue; // 0 = Never visible field - if (abs($enabled) != 1 && abs($enabled) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list + if (abs($enabled) != 1 && abs($enabled) != 3 && abs($enabled) != 5) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list if (empty($perms)) continue; // 0 = Not visible // Load language if required @@ -135,7 +135,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] if ($object->element == 'productlot') $permok = $user->rights->stock->creer; if ($object->element == 'facturerec') $permok = $user->rights->facture->creer; if (($object->statut == 0 || !empty($extrafields->attributes[$object->table_element]['alwayseditable'][$key])) - && $permok && ($action != 'edit_extras' || GETPOST('attribute') != $key) + && $permok && $enabled != 5 && ($action != 'edit_extras' || GETPOST('attribute') != $key) && empty($extrafields->attributes[$object->table_element]['computed'][$key])) { $fieldid = 'id'; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 01a999c6a8b..438dbcda4ec 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2031,7 +2031,7 @@ function top_menu_search() - '; @@ -2062,7 +2062,8 @@ function top_menu_search() // close drop down $(document).on("click", function(event) { - if (!$(event.target).closest("#topmenu-global-search-dropdown").length) { + if (!$(event.target).closest("#topmenu-global-search-dropdown").length) { + console.log("click close"); // Hide the menus. $("#topmenu-global-search-dropdown").removeClass("open"); } @@ -2070,6 +2071,7 @@ function top_menu_search() // Open drop down $("#topmenu-global-search-dropdown .dropdown-toggle").on("click", function(event) { + console.log("click open"); openGlobalSearchDropDown(); }); diff --git a/htdocs/theme/eldy/dropdown.inc.php b/htdocs/theme/eldy/dropdown.inc.php index fb8856d4687..63b7a268440 100644 --- a/htdocs/theme/eldy/dropdown.inc.php +++ b/htdocs/theme/eldy/dropdown.inc.php @@ -5,10 +5,60 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> * Dropdown of user popup */ -.open>.dropdown-menu{ +button.dropdown-item.global-search-item { + outline: none; +} + +.open>.dropdown-search, .open>.dropdown-bookmark, .open>.dropdown-menu{ display: block; } +.dropdown-search { + border-color: #eee; + + position: absolute; + top: 100%; + left: 0; + z-index: 1000; + display: none; + float: left; + min-width: 160px; + margin: 2px 0 0; + font-size: 14px; + text-align: left; + list-style: none; + background-color: #fff; + -webkit-background-clip: padding-box; + background-clip: padding-box; + border: 1px solid #ccc; + border: 1px solid rgba(0,0,0,.15); + border-radius: 4px; + -webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175); + box-shadow: 0 6px 12px rgba(0,0,0,.175); +} +.dropdown-bookmark { + border-color: #eee; + + position: absolute; + top: 100%; + left: 0; + z-index: 1000; + display: none; + float: left; + min-width: 160px; + margin: 2px 0 0; + font-size: 14px; + text-align: left; + list-style: none; + background-color: #fff; + -webkit-background-clip: padding-box; + background-clip: padding-box; + border: 1px solid #ccc; + border: 1px solid rgba(0,0,0,.15); + border-radius: 4px; + -webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175); + box-shadow: 0 6px 12px rgba(0,0,0,.175); +} .dropdown-menu { border-color: #eee; @@ -34,7 +84,6 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> } - .dropdown-toggle{ text-decoration: none !important; } @@ -177,7 +226,8 @@ a.top-menu-dropdown-link { .dropdown-body::-webkit-scrollbar-thumb { -webkit-border-radius: 0; border-radius: 0; - background: rgb(); + /* background: rgb(); */ + background: #aaa; } .dropdown-body::-webkit-scrollbar-track { -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 670734e6706..fa4f751d6a6 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1539,6 +1539,7 @@ div#id-top { background: rgb(); background-image: linear-gradient(-45deg, , rgb()); + /* box-shadow: 0px 0px 5px #eee; */ } @@ -4764,6 +4765,11 @@ div.dataTables_length select { /* Select2 */ /* ============================================================================== */ +.select2-container--default .select2-results__option--highlighted[aria-selected] { + background-color: rgb(); + color: #; +} + .select2-container--focus span.select2-selection.select2-selection--single { border-bottom: 1px solid #666 !important; } From c29e1e78f3048e2f677697d3f3e665ff7e8ba75d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Feb 2020 15:43:31 +0100 Subject: [PATCH 754/784] NEW Bookmarks are now in top menu bar --- htdocs/core/class/conf.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 4f5602fc5ef..cec04a3ac5e 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -688,6 +688,8 @@ class Conf if (empty($this->global->MAIN_MODULE_DOLISTORE_API_SRV)) $this->global->MAIN_MODULE_DOLISTORE_API_SRV = 'https://www.dolistore.com'; if (empty($this->global->MAIN_MODULE_DOLISTORE_API_KEY)) $this->global->MAIN_MODULE_DOLISTORE_API_KEY = 'dolistorecatalogpublickey1234567'; + if (! isset($this->global->MAIN_USE_TOP_MENU_BOOKMARK_DROPDOWN)) $this->global->MAIN_USE_TOP_MENU_BOOKMARK_DROPDOWN = 1; + // If we are in develop mode, we activate the option MAIN_SECURITY_CSRF_WITH_TOKEN to 1 if not already defined. if (!isset($this->global->MAIN_SECURITY_CSRF_WITH_TOKEN) && $this->global->MAIN_FEATURES_LEVEL >= 2) $this->global->MAIN_SECURITY_CSRF_WITH_TOKEN = 1; From 7200472427f461a0f176ddb57276ddda3cbd0b5d Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Thu, 20 Feb 2020 15:45:42 +0100 Subject: [PATCH 755/784] Travis fix --- htdocs/takepos/admin/receipt.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index ef31bc2392c..7a87e13ff97 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -48,7 +48,6 @@ if (GETPOST('action', 'alpha') == 'set') $res = dolibarr_set_const($db, "TAKEPOS_SHOW_CUSTOMER", GETPOST('TAKEPOS_SHOW_CUSTOMER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_AUTO_PRINT_TICKETS", GETPOST('TAKEPOS_AUTO_PRINT_TICKETS', 'int'), 'int', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_PRINT_SERVER", GETPOST('TAKEPOS_PRINT_SERVER', 'alpha'), 'chaine', 0, '', $conf->entity); - dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha')); @@ -185,7 +184,7 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "browser" || $conf->global->TAKEPOS_P print $doleditor->Create(); } print "\n"; - + print ''; print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices")." - ".$langs->trans("Footer"), $htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; print ''; From 7a241ba0421a833f1933e605da5228b494b55ea2 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Thu, 20 Feb 2020 15:47:40 +0100 Subject: [PATCH 756/784] Fix travis --- htdocs/core/modules/modTakePos.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modTakePos.class.php b/htdocs/core/modules/modTakePos.class.php index 2243437d20f..f3af7016d05 100644 --- a/htdocs/core/modules/modTakePos.class.php +++ b/htdocs/core/modules/modTakePos.class.php @@ -266,9 +266,9 @@ class modTakePos extends DolibarrModules public function init($options = '') { global $conf,$db; - + dolibarr_set_const($db, "TAKEPOS_PRINT_METHOD", "browser", 'chaine', 0, '', $conf->entity); - + $this->_load_tables('/takepos/sql/'); $sql = array(); From 4630525973d1c1fff57dc1d3254b27a3aa66e20c Mon Sep 17 00:00:00 2001 From: DEMAREST Maxime Date: Thu, 20 Feb 2020 16:19:28 +0100 Subject: [PATCH 757/784] Fix: Mouvementstock::get_origin modulenme whith origintype --- htdocs/product/stock/class/mouvementstock.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index aab0d428191..6bfe890cd64 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -984,7 +984,7 @@ class MouvementStock extends CommonObject // Separate originetype with "@" : left part is class name, right part is module name $origintype_array = explode('@', $origintype); $classname = ucfirst($origintype_array[0]); - $modulename = empty($origintype_array[1]) ? $classname : empty($origintype_array[1]); + $modulename = empty($origintype_array[1]) ? $classname : $origintype_array[1]; $result=dol_include_once('/'.$modulename.'/class/'.strtolower($classname).'.class.php'); if ($result) { From e316061a9aaa02e313b46d76083906880308e496 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Thu, 20 Feb 2020 16:26:30 +0100 Subject: [PATCH 758/784] Fix travis --- htdocs/core/modules/modTakePos.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modTakePos.class.php b/htdocs/core/modules/modTakePos.class.php index f3af7016d05..4671f40dd40 100644 --- a/htdocs/core/modules/modTakePos.class.php +++ b/htdocs/core/modules/modTakePos.class.php @@ -266,9 +266,9 @@ class modTakePos extends DolibarrModules public function init($options = '') { global $conf,$db; - + dolibarr_set_const($db, "TAKEPOS_PRINT_METHOD", "browser", 'chaine', 0, '', $conf->entity); - + $this->_load_tables('/takepos/sql/'); $sql = array(); From 6cd4d15245ba34b94b1268b06800acb867486caf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Feb 2020 17:05:28 +0100 Subject: [PATCH 759/784] Debug the new bookmark in top menu + support for MD theme --- htdocs/bookmarks/bookmarks.lib.php | 176 ++----------- htdocs/main.inc.php | 17 +- htdocs/theme/eldy/dropdown.inc.php | 5 + htdocs/theme/md/dropdown.inc.php | 395 ++++++++++++++++++++++++++++- htdocs/theme/md/style.css.php | 38 +-- 5 files changed, 437 insertions(+), 194 deletions(-) diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 8d772bf5b33..6bb4b243aff 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -21,132 +21,6 @@ * \brief File with library for bookmark module */ -/** - * Add area with bookmarks in menu - * - * @return string - */ -function printBookmarksList() -{ - global $conf, $user, $db, $langs; - - $ret = ''."\n"; - - if (! empty($conf->use_javascript_ajax)) { // Bookmark autosubmit can't work when javascript is off. - require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php'; - if (! isset($conf->global->BOOKMARKS_SHOW_IN_MENU)) $conf->global->BOOKMARKS_SHOW_IN_MENU=5; - - $langs->load("bookmarks"); - - $url= $_SERVER["PHP_SELF"]; - - if (! empty($_SERVER["QUERY_STRING"])) - { - $url.=(dol_escape_htmltag($_SERVER["QUERY_STRING"])?'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]):''); - } - else - { - global $sortfield,$sortorder; - $tmpurl=''; - // No urlencode, all param $url will be urlencoded later - if ($sortfield) $tmpurl.=($tmpurl?'&':'').'sortfield='.$sortfield; - if ($sortorder) $tmpurl.=($tmpurl?'&':'').'sortorder='.$sortorder; - if (is_array($_POST)) - { - foreach($_POST as $key => $val) - { - if (preg_match('/^search_/', $key) && $val != '') $tmpurl.=($tmpurl?'&':'').$key.'='.$val; - } - } - $url.=($tmpurl?'?'.$tmpurl:''); - } - - // Menu bookmark - $ret = ''."\n"; - - $ret.= ''."\n"; - $ret.= ''; - $ret.= ''; - $ret.= ''; - $ret.= ''; - - $ret.=ajax_combobox('boxbookmark'); - - $ret.=''; - } - - $ret.= ''."\n"; - - return $ret; -} - - /** * Add area with bookmarks in top menu @@ -158,7 +32,6 @@ function printDropdownBookmarksList() global $conf, $user, $db, $langs; require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php'; - if (! isset($conf->global->BOOKMARKS_SHOW_IN_MENU)) $conf->global->BOOKMARKS_SHOW_IN_MENU=5; $langs->load("bookmarks"); @@ -204,42 +77,35 @@ function printDropdownBookmarksList() $newbtn.= img_picto('', 'bookmark').' '.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).''; } - $bookmarkList=''; - $html= ''; - if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU)) { - $html.= ' + $html = ' '; - } $html.= ' @@ -256,8 +122,7 @@ function printDropdownBookmarksList()
'; - if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU)) { - $html .= ''; - } return $html; } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 42cb6587eee..cb95d143b97 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1940,7 +1940,7 @@ function top_menu_bookmark() $langs->load("bookmarks"); $html .= ' - '; - - $html .= ' '; + $script .= ''; return $script; } @@ -225,8 +225,8 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen function ajax_multiautocompleter($htmlname, $fields, $url, $option = '', $minLength = 2, $autoselect = 0) { $script = ''."\n"; - $script.= ''; + $script .= ''; return $script; } @@ -333,11 +333,11 @@ function ajax_dialog($title, $message, $w = 350, $h = 150) { global $langs; - $newtitle=dol_textishtml($title)?dol_string_nohtmltag($title, 1):$title; - $msg= '
'; - $msg.= $message; - $msg.= '
'."\n"; - $msg.= ''; - $msg.= "\n"; + $msg .= "\n"; return $msg; } @@ -377,20 +377,20 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete = global $conf; // select2 can be disabled for smartphones - if (! empty($conf->browser->layout) && $conf->browser->layout == 'phone' && ! empty($conf->global->MAIN_DISALLOW_SELECT2_WITH_SMARTPHONE)) return ''; + if (!empty($conf->browser->layout) && $conf->browser->layout == 'phone' && !empty($conf->global->MAIN_DISALLOW_SELECT2_WITH_SMARTPHONE)) return ''; - if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return ''; + if (!empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return ''; if (empty($conf->use_javascript_ajax)) return ''; - if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && ! defined('REQUIRE_JQUERY_MULTISELECT')) return ''; - if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) return ''; + if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && !defined('REQUIRE_JQUERY_MULTISELECT')) return ''; + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) return ''; - if (empty($minLengthToAutocomplete)) $minLengthToAutocomplete=0; + if (empty($minLengthToAutocomplete)) $minLengthToAutocomplete = 0; - $tmpplugin='select2'; - $msg="\n".' + $tmpplugin = 'select2'; + $msg = "\n".' \n"; + $msg .= '});'."\n"; + $msg .= "\n"; return $msg; } @@ -495,7 +495,7 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof } else { - $out= "\n".' + $out = "\n".' '."\n"; - $out.= ''; - $out.= ''.($revertonoff?img_picto($langs->trans("Enabled"), 'switch_on'):img_picto($langs->trans("Disabled"), 'switch_off')).''; - $out.= ''.($revertonoff?img_picto($langs->trans("Disabled"), 'switch_off'):img_picto($langs->trans("Enabled"), 'switch_on')).''; - $out.="\n"; + $out .= ''; + $out .= ''.($revertonoff ?img_picto($langs->trans("Enabled"), 'switch_on') : img_picto($langs->trans("Disabled"), 'switch_off')).''; + $out .= ''.($revertonoff ?img_picto($langs->trans("Disabled"), 'switch_off') : img_picto($langs->trans("Enabled"), 'switch_on')).''; + $out .= "\n"; } return $out; @@ -555,7 +555,7 @@ function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input = { global $langs; - $out= ''; - $out.= ''.img_picto($langs->trans($text_off), 'switch_off').''; - $out.= ''.img_picto($langs->trans($text_on), 'switch_on').''; + $out .= ''.img_picto($langs->trans($text_off), 'switch_off').''; + $out .= ''.img_picto($langs->trans($text_on), 'switch_on').''; return $out; } diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index da480048ede..79d77e0268f 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -76,13 +76,13 @@ function product_prepare_head($object) } // Sub products - if (! empty($conf->global->PRODUIT_SOUSPRODUITS)) + if (!empty($conf->global->PRODUIT_SOUSPRODUITS)) { $head[$h][0] = DOL_URL_ROOT."/product/composition/card.php?id=".$object->id; $head[$h][1] = $langs->trans('AssociatedProducts'); $nbFatherAndChild = $object->hasFatherOrChild(); - if ($nbFatherAndChild > 0) $head[$h][1].= ''.$nbFatherAndChild.''; + if ($nbFatherAndChild > 0) $head[$h][1] .= ''.$nbFatherAndChild.''; $head[$h][2] = 'subproduct'; $h++; } @@ -110,15 +110,15 @@ function product_prepare_head($object) $head[$h][1] = $langs->trans('ProductCombinations'); $head[$h][2] = 'combinations'; $nbVariant = $prodcomb->countNbOfCombinationForFkProductParent($object->id); - if ($nbVariant > 0) $head[$h][1].= ''.$nbVariant.''; + if ($nbVariant > 0) $head[$h][1] .= ''.$nbVariant.''; } $h++; } - if ($object->isProduct() || ($object->isService() && ! empty($conf->global->STOCK_SUPPORTS_SERVICES))) // If physical product we can stock (or service with option) + if ($object->isProduct() || ($object->isService() && !empty($conf->global->STOCK_SUPPORTS_SERVICES))) // If physical product we can stock (or service with option) { - if (! empty($conf->stock->enabled) && $user->rights->stock->lire) + if (!empty($conf->stock->enabled) && $user->rights->stock->lire) { $head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$object->id; $head[$h][1] = $langs->trans("Stock"); @@ -156,11 +156,11 @@ function product_prepare_head($object) if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) { $nbNote = 0; - if(!empty($object->note_private)) $nbNote++; - if(!empty($object->note_public)) $nbNote++; + if (!empty($object->note_private)) $nbNote++; + if (!empty($object->note_public)) $nbNote++; $head[$h][0] = DOL_URL_ROOT.'/product/note.php?id='.$object->id; $head[$h][1] = $langs->trans('Notes'); - if ($nbNote > 0) $head[$h][1].= ''.$nbNote.''; + if ($nbNote > 0) $head[$h][1] .= ''.$nbNote.''; $head[$h][2] = 'note'; $h++; } @@ -168,18 +168,18 @@ function product_prepare_head($object) // Attachments require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - if (! empty($conf->product->enabled) && ($object->type==Product::TYPE_PRODUCT)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); - if (! empty($conf->service->enabled) && ($object->type==Product::TYPE_SERVICE)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); + if (!empty($conf->product->enabled) && ($object->type == Product::TYPE_PRODUCT)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); + if (!empty($conf->service->enabled) && ($object->type == Product::TYPE_SERVICE)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); - if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { - if (! empty($conf->product->enabled) && ($object->type==Product::TYPE_PRODUCT)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir($object->id, 2, 0, 0, $object, 'product').$object->id.'/photos'; - if (! empty($conf->service->enabled) && ($object->type==Product::TYPE_SERVICE)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.get_exdir($object->id, 2, 0, 0, $object, 'product').$object->id.'/photos'; + if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { + if (!empty($conf->product->enabled) && ($object->type == Product::TYPE_PRODUCT)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir($object->id, 2, 0, 0, $object, 'product').$object->id.'/photos'; + if (!empty($conf->service->enabled) && ($object->type == Product::TYPE_SERVICE)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.get_exdir($object->id, 2, 0, 0, $object, 'product').$object->id.'/photos'; $nbFiles += count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); } - $nbLinks=Link::count($db, $object->element, $object->id); + $nbLinks = Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ''.($nbFiles+$nbLinks).''; + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ''.($nbFiles + $nbLinks).''; $head[$h][2] = 'documents'; $h++; @@ -225,10 +225,10 @@ function productlot_prepare_head($object) require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $upload_dir = $conf->productbatch->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); - $nbLinks=Link::count($db, $object->element, $object->id); + $nbLinks = Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT."/product/stock/productlot_document.php?id=".$object->id; $head[$h][1] = $langs->trans("Documents"); - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ''.($nbFiles+$nbLinks).''; + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ''.($nbFiles + $nbLinks).''; $head[$h][2] = 'documents'; $h++; @@ -536,7 +536,7 @@ function measuringUnitString($unit, $measuring_style = '', $scale = '', $use_sho if (empty($measuring_unit_cache[$unit.'_'.$measuring_style.'_'.$scale.'_'.$use_short_label])) { require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php'; - $measuringUnits= new CUnits($db); + $measuringUnits = new CUnits($db); if ($measuring_style == '' && $scale == '') { diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 8e78e4e45be..ddca8ef1153 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -265,7 +265,7 @@ function project_timesheet_prepare_head($mode, $fuser = null) if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERMONTH)) { - $head[$h][0] = DOL_URL_ROOT."/projet/activity/permonth.php".($param?'?'.$param:''); + $head[$h][0] = DOL_URL_ROOT."/projet/activity/permonth.php".($param ? '?'.$param : ''); $head[$h][1] = $langs->trans("InputPerMonth"); $head[$h][2] = 'inputpermonth'; $h++; @@ -1735,19 +1735,19 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & global $conf, $db, $user, $bc, $langs; global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic; - $numlines=count($lines); + $numlines = count($lines); - $lastprojectid=0; - $workloadforid=array(); - $totalforeachweek=array(); - $lineswithoutlevel0=array(); + $lastprojectid = 0; + $workloadforid = array(); + $totalforeachweek = array(); + $lineswithoutlevel0 = array(); // Create a smaller array with sublevels only to be used later. This increase dramatically performances. if ($parent == 0) // Always and only if at first level { - for ($i = 0 ; $i < $numlines ; $i++) + for ($i = 0; $i < $numlines; $i++) { - if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i]; + if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[] = $lines[$i]; } } @@ -1755,24 +1755,24 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & if (empty($oldprojectforbreak)) { - $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:-1); // 0 = start break, -1 = never break + $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1); // 0 = start break, -1 = never break } - for ($i = 0 ; $i < $numlines ; $i++) + for ($i = 0; $i < $numlines; $i++) { if ($parent == 0) $level = 0; if ($lines[$i]->fk_task_parent == $parent) { // If we want all or we have a role on task, we show it - if (empty($mine) || ! empty($tasksrole[$lines[$i]->id])) + if (empty($mine) || !empty($tasksrole[$lines[$i]->id])) { //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); // Break on a new project if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) { - $lastprojectid=$lines[$i]->fk_project; + $lastprojectid = $lines[$i]->fk_project; $projectstatic->id = $lines[$i]->fk_project; } @@ -1780,32 +1780,32 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & //var_dump($projectstatic->weekWorkLoadPerTask); if (empty($workloadforid[$projectstatic->id])) { - $projectstatic->loadTimeSpentMonth($firstdaytoshow, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week - $workloadforid[$projectstatic->id]=1; + $projectstatic->loadTimeSpentMonth($firstdaytoshow, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week + $workloadforid[$projectstatic->id] = 1; } //var_dump($projectstatic->weekWorkLoadPerTask); //var_dump('--- '.$projectstatic->id.' '.$workloadforid[$projectstatic->id]); - $projectstatic->id=$lines[$i]->fk_project; - $projectstatic->ref=$lines[$i]->projectref; - $projectstatic->title=$lines[$i]->projectlabel; - $projectstatic->public=$lines[$i]->public; - $projectstatic->thirdparty_name=$lines[$i]->thirdparty_name; + $projectstatic->id = $lines[$i]->fk_project; + $projectstatic->ref = $lines[$i]->projectref; + $projectstatic->title = $lines[$i]->projectlabel; + $projectstatic->public = $lines[$i]->public; + $projectstatic->thirdparty_name = $lines[$i]->thirdparty_name; - $taskstatic->id=$lines[$i]->id; - $taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id); - $taskstatic->label=$lines[$i]->label; - $taskstatic->date_start=$lines[$i]->date_start; - $taskstatic->date_end=$lines[$i]->date_end; + $taskstatic->id = $lines[$i]->id; + $taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id); + $taskstatic->label = $lines[$i]->label; + $taskstatic->date_start = $lines[$i]->date_start; + $taskstatic->date_end = $lines[$i]->date_end; - $thirdpartystatic->id=$lines[$i]->thirdparty_id; - $thirdpartystatic->name=$lines[$i]->thirdparty_name; - $thirdpartystatic->email=$lines[$i]->thirdparty_email; + $thirdpartystatic->id = $lines[$i]->thirdparty_id; + $thirdpartystatic->name = $lines[$i]->thirdparty_name; + $thirdpartystatic->email = $lines[$i]->thirdparty_email; if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) { print ''."\n"; - print ''; + print ''; print $projectstatic->getNomUrl(1, '', 0, ''.$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); if ($thirdpartystatic->id > 0) print ' - '.$thirdpartystatic->getNomUrl(1); if ($projectstatic->title) @@ -1840,11 +1840,11 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & // Ref print ''; print ''; - for ($k = 0 ; $k < $level ; $k++) print "   "; + for ($k = 0; $k < $level; $k++) print "   "; print $taskstatic->getNomUrl(1, 'withproject', 'time'); // Label task print '
'; - for ($k = 0 ; $k < $level ; $k++) print "   "; + for ($k = 0; $k < $level; $k++) print "   "; //print $taskstatic->getNomUrl(0, 'withproject', 'time'); print $taskstatic->label; //print "
"; @@ -1860,7 +1860,7 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & // Progress declared % print ''; - print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress'); + print $formother->select_percent($lines[$i]->progress, $lines[$i]->id.'progress'); print ''; // Time spent by everybody @@ -1877,66 +1877,66 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & // Time spent by user print ''; - $tmptimespent=$taskstatic->getSummaryOfTimeSpent($fuser->id); + $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id); if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'], 'allhourmin'); else print '--:--'; print "\n"; - $disabledproject=1;$disabledtask=1; + $disabledproject = 1; $disabledtask = 1; //print "x".$lines[$i]->fk_project; //var_dump($lines[$i]); //var_dump($projectsrole[$lines[$i]->fk_project]); // If at least one role for project - if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) + if ($lines[$i]->public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) { - $disabledproject=0; - $disabledtask=0; + $disabledproject = 0; + $disabledtask = 0; } // If $restricteditformytask is on and I have no role on task, i disable edit if ($restricteditformytask && empty($tasksrole[$lines[$i]->id])) { - $disabledtask=1; + $disabledtask = 1; } //var_dump($projectstatic->weekWorkLoadPerTask); //TODO // Fields to show current time - $tableCell=''; $modeinput='hours'; + $tableCell = ''; $modeinput = 'hours'; $TFirstDay = getFirstDayOfEachWeek($TWeek, date('Y', $firstdaytoshow)); $TFirstDay[reset($TWeek)] = 1; - foreach($TFirstDay as &$fday) { + foreach ($TFirstDay as &$fday) { $fday--; } foreach ($TWeek as $weekNb) { $weekWorkLoad = $projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id]; - $totalforeachweek[$weekNb]+=$weekWorkLoad; + $totalforeachweek[$weekNb] += $weekWorkLoad; - $alreadyspent=''; - if ($weekWorkLoad > 0) $alreadyspent=convertSecondToTime($weekWorkLoad, 'allhourmin'); - $alttitle=$langs->trans("AddHereTimeSpentForWeek", $weekNb); + $alreadyspent = ''; + if ($weekWorkLoad > 0) $alreadyspent = convertSecondToTime($weekWorkLoad, 'allhourmin'); + $alttitle = $langs->trans("AddHereTimeSpentForWeek", $weekNb); - $tableCell =''; - $placeholder=''; + $tableCell = ''; + $placeholder = ''; if ($alreadyspent) { - $tableCell.=''; + $tableCell .= ''; //$placeholder=' placeholder="00:00"'; //$tableCell.='+'; } - $tableCell.=''; - $tableCell.=''; + $tableCell .= ''; + $tableCell .= ''; print $tableCell; } // Warning print ''; - if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('', $langs->trans("UserIsNotContactOfProject")); + if ((!$lines[$i]->public) && $disabledproject) print $form->textwithpicto('', $langs->trans("UserIsNotContactOfProject")); elseif ($disabledtask) { $titleassigntask = $langs->trans("AssignTaskToMe"); @@ -1959,9 +1959,9 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & $ret = projectLinesPerMonth($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak, $TWeek); //var_dump('ret with parent='.$lines[$i]->id.' level='.$level); //var_dump($ret); - foreach($ret as $key => $val) + foreach ($ret as $key => $val) { - $totalforeachweek[$key]+=$val; + $totalforeachweek[$key] += $val; } //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks'); //var_dump($totalforeachday); @@ -2202,8 +2202,8 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks print ''; // Because color of prospection status has no meaning yet, it is used if hidden constant is set if (empty($conf->global->USE_COLOR_FOR_PROSPECTION_STATUS)) { - if ($langs->trans("OppStatus" . $oppStatusCode) != "OppStatus" . $oppStatusCode) { - print $langs->trans("OppStatus" . $oppStatusCode); + if ($langs->trans("OppStatus".$oppStatusCode) != "OppStatus".$oppStatusCode) { + print $langs->trans("OppStatus".$oppStatusCode); } } else { if (isset($statusOppList[$objp->opp_status])) { @@ -2215,9 +2215,9 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks } if ($oppStatusCode) { if (!empty($oppStatusColor)) { - print ''; + print ''; } else { - print '' . $oppStatusCode . ''; + print ''.$oppStatusCode.''; } } } diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 6e3d887cbce..b8740fa60de 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -1315,27 +1315,27 @@ class pdf_einstein extends ModelePDFCommandes $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); } - if (! empty($conf->global->PDF_SHOW_PROJECT_TITLE)) + if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) { $object->fetch_projet(); - if (! empty($object->project->ref)) + if (!empty($object->project->ref)) { - $posy+=3; + $posy += 3; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->title)?'':$object->projet->title), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->projet->title), '', 'R'); } } - if (! empty($conf->global->PDF_SHOW_PROJECT)) + if (!empty($conf->global->PDF_SHOW_PROJECT)) { $object->fetch_projet(); - if (! empty($object->project->ref)) + if (!empty($object->project->ref)) { - $posy+=3; + $posy += 3; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R'); } } diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index f4fc2b3cb2f..5bdc591c2fb 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -621,7 +621,7 @@ class pdf_eratosthene extends ModelePDFCommandes { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages - if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; else $showpricebeforepagebreak = 0; @@ -1475,27 +1475,27 @@ class pdf_eratosthene extends ModelePDFCommandes $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); } - if (! empty($conf->global->PDF_SHOW_PROJECT_TITLE)) + if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) { $object->fetch_projet(); - if (! empty($object->project->ref)) + if (!empty($object->project->ref)) { - $posy+=3; + $posy += 3; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->title)?'':$object->projet->title), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->projet->title), '', 'R'); } } - if (! empty($conf->global->PDF_SHOW_PROJECT)) + if (!empty($conf->global->PDF_SHOW_PROJECT)) { $object->fetch_projet(); - if (! empty($object->project->ref)) + if (!empty($object->project->ref)) { - $posy+=3; + $posy += 3; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R'); } } diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php index 01ebd673041..4c025750f04 100644 --- a/htdocs/core/modules/dons/html_cerfafr.modules.php +++ b/htdocs/core/modules/dons/html_cerfafr.modules.php @@ -42,7 +42,7 @@ class html_cerfafr extends ModeleDon */ public function __construct($db) { - global $conf,$langs; + global $conf, $langs; $this->db = $db; $this->name = "cerfafr"; @@ -76,46 +76,46 @@ class html_cerfafr extends ModeleDon public function write_file($don, $outputlangs, $currency = '') { // phpcs:enable - global $user,$conf,$langs,$mysoc; + global $user, $conf, $langs, $mysoc; - $now=dol_now(); - $id = (! is_object($don)?$don:''); + $now = dol_now(); + $id = (!is_object($don) ? $don : ''); - if (! is_object($outputlangs)) $outputlangs=$langs; + if (!is_object($outputlangs)) $outputlangs = $langs; // Load traductions files required by page $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "donations")); $currency = !empty($currency) ? $currency : $conf->currency; - if (! empty($conf->don->dir_output)) + if (!empty($conf->don->dir_output)) { // Definition of the object don (for upward compatibility) - if (! is_object($don)) + if (!is_object($don)) { $don = new Don($this->db); - $ret=$don->fetch($id); - $id=$don->id; + $ret = $don->fetch($id); + $id = $don->id; } // Definition of $dir and $file - if (! empty($don->specimen)) + if (!empty($don->specimen)) { $dir = $conf->don->dir_output; - $file = $dir . "/SPECIMEN.html"; + $file = $dir."/SPECIMEN.html"; } else { $donref = dol_sanitizeFileName($don->ref); - $dir = $conf->don->dir_output . "/" . $donref; - $file = $dir . "/" . $donref . ".html"; + $dir = $conf->don->dir_output."/".$donref; + $file = $dir."/".$donref.".html"; } - if (! file_exists($dir)) + if (!file_exists($dir)) { if (dol_mkdir($dir) < 0) { - $this->error=$langs->trans("ErrorCanNotCreateDir", $dir); + $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); return -1; } } @@ -133,13 +133,13 @@ class html_cerfafr extends ModeleDon } else $paymentmode = ''; - if ($don->modepaymentcode=='CHQ'){ + if ($don->modepaymentcode == 'CHQ') { $ModePaiement = ' Remise d\'espèces Chèque Virement, prélèvement, carte bancaire'; } - elseif ($don->modepaymentcode=='LIQ'){ + elseif ($don->modepaymentcode == 'LIQ') { $ModePaiement = ' Remise d\'espèces Chèque Virement, prélèvement, carte bancaire'; } - elseif ($don->modepaymentcode=='VIR' || $don->modepaymentcode=='PRE' || $don->modepaymentcode=='CB'){ + elseif ($don->modepaymentcode == 'VIR' || $don->modepaymentcode == 'PRE' || $don->modepaymentcode == 'CB') { $ModePaiement = ' Remise d\'espèces Chèque Virement, prélèvement, carte bancaire'; } else @@ -159,7 +159,7 @@ class html_cerfafr extends ModeleDon */ // Define contents - $donmodel=DOL_DOCUMENT_ROOT ."/core/modules/dons/html_cerfafr.html"; + $donmodel = DOL_DOCUMENT_ROOT."/core/modules/dons/html_cerfafr.html"; $form = implode('', file($donmodel)); $form = str_replace('__REF__', $don->id, $form); $form = str_replace('__DATE__', dol_print_date($don->date, 'day', false, $outputlangs), $form); @@ -203,59 +203,59 @@ class html_cerfafr extends ModeleDon $form = str_replace('__ModePaiement__', $ModePaiement, $form); - $frencharticle=''; - if (preg_match('/fr/i', $outputlangs->defaultlang)) $frencharticle='Article 200, 238 bis et 978 du code général des impôts (CGI)'; + $frencharticle = ''; + if (preg_match('/fr/i', $outputlangs->defaultlang)) $frencharticle = 'Article 200, 238 bis et 978 du code général des impôts (CGI)'; $form = str_replace('__FrenchArticle__', $frencharticle, $form); - $frencheligibility=''; - if (preg_match('/fr/i', $outputlangs->defaultlang)) $frencheligibility='Le bénéficiaire certifie sur l\'honneur que les dons et versements qu\'il reçoit ouvrent droit à la réduction d\'impôt prévue à l\'article :'; + $frencheligibility = ''; + if (preg_match('/fr/i', $outputlangs->defaultlang)) $frencheligibility = 'Le bénéficiaire certifie sur l\'honneur que les dons et versements qu\'il reçoit ouvrent droit à la réduction d\'impôt prévue à l\'article :'; $form = str_replace('__FrenchEligibility__', $frencheligibility, $form); - $art200=''; + $art200 = ''; if (preg_match('/fr/i', $outputlangs->defaultlang)) { if ($conf->global->DONATION_ART200 >= 1) { - $art200='200 du CGI'; + $art200 = '200 du CGI'; } else { - $art200='200 du CGI'; + $art200 = '200 du CGI'; } } $form = str_replace('__ARTICLE200__', $art200, $form); - $art238=''; + $art238 = ''; if (preg_match('/fr/i', $outputlangs->defaultlang)) { if ($conf->global->DONATION_ART238 >= 1) { - $art238='238 bis du CGI'; + $art238 = '238 bis du CGI'; } else { - $art238='238 bis du CGI'; + $art238 = '238 bis du CGI'; } } $form = str_replace('__ARTICLE238__', $art238, $form); - $art978=''; + $art978 = ''; if (preg_match('/fr/i', $outputlangs->defaultlang)) { if ($conf->global->DONATION_ART978 >= 1) { - $art978='978 du CGI'; + $art978 = '978 du CGI'; } else { - $art978='978 du CGI'; + $art978 = '978 du CGI'; } } $form = str_replace('__ARTICLE978__', $art978, $form); // Save file on disk dol_syslog("html_cerfafr::write_file $file"); - $handle=fopen($file, "w"); + $handle = fopen($file, "w"); fwrite($handle, $form); fclose($handle); - if (! empty($conf->global->MAIN_UMASK)) + if (!empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); $this->result = array('fullpath'=>$file); @@ -264,13 +264,13 @@ class html_cerfafr extends ModeleDon } else { - $this->error=$langs->trans("ErrorCanNotCreateDir", $dir); + $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); return 0; } } else { - $this->error=$langs->trans("ErrorConstantNotDefined", "DON_OUTPUTDIR"); + $this->error = $langs->trans("ErrorConstantNotDefined", "DON_OUTPUTDIR"); return 0; } } @@ -288,147 +288,147 @@ class html_cerfafr extends ModeleDon $unite = array(); $dix = array(); $cent = array(); - if(empty($devise1)) $dev1='euros'; - else $dev1=$devise1; - if(empty($devise2)) $dev2='centimes'; - else $dev2=$devise2; - $valeur_entiere=intval($montant); - $valeur_decimal=intval(round($montant-intval($montant), 2)*100); - $dix_c=intval($valeur_decimal%100/10); - $cent_c=intval($valeur_decimal%1000/100); - $unite[1]=$valeur_entiere%10; - $dix[1]=intval($valeur_entiere%100/10); - $cent[1]=intval($valeur_entiere%1000/100); - $unite[2]=intval($valeur_entiere%10000/1000); - $dix[2]=intval($valeur_entiere%100000/10000); - $cent[2]=intval($valeur_entiere%1000000/100000); - $unite[3]=intval($valeur_entiere%10000000/1000000); - $dix[3]=intval($valeur_entiere%100000000/10000000); - $cent[3]=intval($valeur_entiere%1000000000/100000000); - $chif=array('', 'un', 'deux', 'trois', 'quatre', 'cinq', 'six', 'sept', 'huit', 'neuf', 'dix', 'onze', 'douze', 'treize', 'quatorze', 'quinze', 'seize', 'dix sept', 'dix huit', 'dix neuf'); - $secon_c=''; - $trio_c=''; - for($i=1; $i<=3; $i++) { - $prim[$i]=''; - $secon[$i]=''; - $trio[$i]=''; - if ($dix[$i]==0) { - $secon[$i]=''; - $prim[$i]=$chif[$unite[$i]]; + if (empty($devise1)) $dev1 = 'euros'; + else $dev1 = $devise1; + if (empty($devise2)) $dev2 = 'centimes'; + else $dev2 = $devise2; + $valeur_entiere = intval($montant); + $valeur_decimal = intval(round($montant - intval($montant), 2) * 100); + $dix_c = intval($valeur_decimal % 100 / 10); + $cent_c = intval($valeur_decimal % 1000 / 100); + $unite[1] = $valeur_entiere % 10; + $dix[1] = intval($valeur_entiere % 100 / 10); + $cent[1] = intval($valeur_entiere % 1000 / 100); + $unite[2] = intval($valeur_entiere % 10000 / 1000); + $dix[2] = intval($valeur_entiere % 100000 / 10000); + $cent[2] = intval($valeur_entiere % 1000000 / 100000); + $unite[3] = intval($valeur_entiere % 10000000 / 1000000); + $dix[3] = intval($valeur_entiere % 100000000 / 10000000); + $cent[3] = intval($valeur_entiere % 1000000000 / 100000000); + $chif = array('', 'un', 'deux', 'trois', 'quatre', 'cinq', 'six', 'sept', 'huit', 'neuf', 'dix', 'onze', 'douze', 'treize', 'quatorze', 'quinze', 'seize', 'dix sept', 'dix huit', 'dix neuf'); + $secon_c = ''; + $trio_c = ''; + for ($i = 1; $i <= 3; $i++) { + $prim[$i] = ''; + $secon[$i] = ''; + $trio[$i] = ''; + if ($dix[$i] == 0) { + $secon[$i] = ''; + $prim[$i] = $chif[$unite[$i]]; } - elseif ($dix[$i]==1) { - $secon[$i]=''; - $prim[$i]=$chif[($unite[$i]+10)]; + elseif ($dix[$i] == 1) { + $secon[$i] = ''; + $prim[$i] = $chif[($unite[$i] + 10)]; } - elseif ($dix[$i]==2) { - if ($unite[$i]==1) { - $secon[$i]='vingt et'; - $prim[$i]=$chif[$unite[$i]]; + elseif ($dix[$i] == 2) { + if ($unite[$i] == 1) { + $secon[$i] = 'vingt et'; + $prim[$i] = $chif[$unite[$i]]; } else { - $secon[$i]='vingt'; - $prim[$i]=$chif[$unite[$i]]; + $secon[$i] = 'vingt'; + $prim[$i] = $chif[$unite[$i]]; } } - elseif ($dix[$i]==3) { - if ($unite[$i]==1) { - $secon[$i]='trente et'; - $prim[$i]=$chif[$unite[$i]]; + elseif ($dix[$i] == 3) { + if ($unite[$i] == 1) { + $secon[$i] = 'trente et'; + $prim[$i] = $chif[$unite[$i]]; } else { - $secon[$i]='trente'; - $prim[$i]=$chif[$unite[$i]]; + $secon[$i] = 'trente'; + $prim[$i] = $chif[$unite[$i]]; } } - elseif ($dix[$i]==4) { - if ($unite[$i]==1) { - $secon[$i]='quarante et'; - $prim[$i]=$chif[$unite[$i]]; + elseif ($dix[$i] == 4) { + if ($unite[$i] == 1) { + $secon[$i] = 'quarante et'; + $prim[$i] = $chif[$unite[$i]]; } else { - $secon[$i]='quarante'; - $prim[$i]=$chif[$unite[$i]]; + $secon[$i] = 'quarante'; + $prim[$i] = $chif[$unite[$i]]; } } - elseif ($dix[$i]==5) { - if ($unite[$i]==1) { - $secon[$i]='cinquante et'; - $prim[$i]=$chif[$unite[$i]]; + elseif ($dix[$i] == 5) { + if ($unite[$i] == 1) { + $secon[$i] = 'cinquante et'; + $prim[$i] = $chif[$unite[$i]]; } else { - $secon[$i]='cinquante'; - $prim[$i]=$chif[$unite[$i]]; + $secon[$i] = 'cinquante'; + $prim[$i] = $chif[$unite[$i]]; } } - elseif ($dix[$i]==6) { - if ($unite[$i]==1) { - $secon[$i]='soixante et'; - $prim[$i]=$chif[$unite[$i]]; + elseif ($dix[$i] == 6) { + if ($unite[$i] == 1) { + $secon[$i] = 'soixante et'; + $prim[$i] = $chif[$unite[$i]]; } else { - $secon[$i]='soixante'; - $prim[$i]=$chif[$unite[$i]]; + $secon[$i] = 'soixante'; + $prim[$i] = $chif[$unite[$i]]; } } - elseif ($dix[$i]==7) { - if ($unite[$i]==1) { - $secon[$i]='soixante et'; - $prim[$i]=$chif[$unite[$i]+10]; + elseif ($dix[$i] == 7) { + if ($unite[$i] == 1) { + $secon[$i] = 'soixante et'; + $prim[$i] = $chif[$unite[$i] + 10]; } else { - $secon[$i]='soixante'; - $prim[$i]=$chif[$unite[$i]+10]; + $secon[$i] = 'soixante'; + $prim[$i] = $chif[$unite[$i] + 10]; } } - elseif ($dix[$i]==8) { - if ($unite[$i]==1) { - $secon[$i]='quatre-vingts et'; - $prim[$i]=$chif[$unite[$i]]; + elseif ($dix[$i] == 8) { + if ($unite[$i] == 1) { + $secon[$i] = 'quatre-vingts et'; + $prim[$i] = $chif[$unite[$i]]; } else { - $secon[$i]='quatre-vingt'; - $prim[$i]=$chif[$unite[$i]]; + $secon[$i] = 'quatre-vingt'; + $prim[$i] = $chif[$unite[$i]]; } } - elseif ($dix[$i]==9) { - if ($unite[$i]==1) { - $secon[$i]='quatre-vingts et'; - $prim[$i]=$chif[$unite[$i]+10]; + elseif ($dix[$i] == 9) { + if ($unite[$i] == 1) { + $secon[$i] = 'quatre-vingts et'; + $prim[$i] = $chif[$unite[$i] + 10]; } else { - $secon[$i]='quatre-vingts'; - $prim[$i]=$chif[$unite[$i]+10]; + $secon[$i] = 'quatre-vingts'; + $prim[$i] = $chif[$unite[$i] + 10]; } } - if($cent[$i]==1) $trio[$i]='cent'; - elseif($cent[$i]!=0 || $cent[$i]!='') $trio[$i]=$chif[$cent[$i]] .' cents'; + if ($cent[$i] == 1) $trio[$i] = 'cent'; + elseif ($cent[$i] != 0 || $cent[$i] != '') $trio[$i] = $chif[$cent[$i]].' cents'; } - $chif2=array('', 'dix', 'vingt', 'trente', 'quarante', 'cinquante', 'soixante', 'soixante-dix', 'quatre-vingts', 'quatre-vingts dix'); - $secon_c=$chif2[$dix_c]; - if ($cent_c==1) $trio_c='cent'; - elseif ($cent_c!=0 || $cent_c!='') $trio_c=$chif[$cent_c] .' cents'; + $chif2 = array('', 'dix', 'vingt', 'trente', 'quarante', 'cinquante', 'soixante', 'soixante-dix', 'quatre-vingts', 'quatre-vingts dix'); + $secon_c = $chif2[$dix_c]; + if ($cent_c == 1) $trio_c = 'cent'; + elseif ($cent_c != 0 || $cent_c != '') $trio_c = $chif[$cent_c].' cents'; - if (($cent[3]==0 || $cent[3]=='') && ($dix[3]==0 || $dix[3]=='') && ($unite[3]==1)) - $somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]. ' million '; - elseif (($cent[3]!=0 && $cent[3]!='') || ($dix[3]!=0 && $dix[3]!='') || ($unite[3]!=0 && $unite[3]!='')) - $somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]. ' millions '; + if (($cent[3] == 0 || $cent[3] == '') && ($dix[3] == 0 || $dix[3] == '') && ($unite[3] == 1)) + $somme = $trio[3].' '.$secon[3].' '.$prim[3].' million '; + elseif (($cent[3] != 0 && $cent[3] != '') || ($dix[3] != 0 && $dix[3] != '') || ($unite[3] != 0 && $unite[3] != '')) + $somme = $trio[3].' '.$secon[3].' '.$prim[3].' millions '; else - $somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]; + $somme = $trio[3].' '.$secon[3].' '.$prim[3]; - if (($cent[2]==0 || $cent[2]=='') && ($dix[2]==0 || $dix[2]=='') && ($unite[2]==1)) + if (($cent[2] == 0 || $cent[2] == '') && ($dix[2] == 0 || $dix[2] == '') && ($unite[2] == 1)) $somme = $somme.' mille '; - elseif (($cent[2]!=0 && $cent[2]!='') || ($dix[2]!=0 && $dix[2]!='') || ($unite[2]!=0 && $unite[2]!='')) - $somme = $somme. $trio[2]. ' ' .$secon[2]. ' ' . $prim[2]. ' milles '; + elseif (($cent[2] != 0 && $cent[2] != '') || ($dix[2] != 0 && $dix[2] != '') || ($unite[2] != 0 && $unite[2] != '')) + $somme = $somme.$trio[2].' '.$secon[2].' '.$prim[2].' milles '; else - $somme = $somme. $trio[2]. ' ' .$secon[2]. ' ' . $prim[2]; + $somme = $somme.$trio[2].' '.$secon[2].' '.$prim[2]; - $somme = $somme. $trio[1]. ' ' .$secon[1]. ' ' . $prim[1]; + $somme = $somme.$trio[1].' '.$secon[1].' '.$prim[1]; - $somme = $somme. ' '. $dev1 .' ' ; + $somme = $somme.' '.$dev1.' '; - if (($cent_c=='0' || $cent_c=='') && ($dix_c=='0' || $dix_c=='')) - return $somme. ' et zéro '. $dev2; + if (($cent_c == '0' || $cent_c == '') && ($dix_c == '0' || $dix_c == '')) + return $somme.' et zéro '.$dev2; else - return $somme. $trio_c. ' ' .$secon_c. ' ' . $dev2; + return $somme.$trio_c.' '.$secon_c.' '.$dev2; } } diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 6e8918920a6..7154fcc5836 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -494,7 +494,7 @@ class pdf_crabe extends ModelePDFFactures $curY = $tab_top_newpage; // Allows data in the first page if description is long enough to break in multiples pages - if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; else $showpricebeforepagebreak = 0; @@ -539,7 +539,7 @@ class pdf_crabe extends ModelePDFFactures // We found a page break // Allows data in the first page if description is long enough to break in multiples pages - if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; else $showpricebeforepagebreak = 0; @@ -1051,15 +1051,15 @@ class pdf_crabe extends ModelePDFFactures $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L'); // Show online payment link - $useonlinepayment = ((! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled)) && !empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT)); + $useonlinepayment = ((!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled)) && !empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT)); if (($object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD') && $object->statut != Facture::STATUS_DRAFT && $useonlinepayment) { require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; global $langs; $langs->loadLangs(array('payment', 'paybox')); - $servicename=$langs->transnoentities('Online'); + $servicename = $langs->transnoentities('Online'); $paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, '', '', ''); - $linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '.$outputlangs->transnoentities("ClickHere").''; + $linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '.$outputlangs->transnoentities("ClickHere").''; $pdf->writeHTMLCell(80, 10, '', '', dol_htmlentitiesbr($linktopay), 0, 1); } @@ -1707,27 +1707,27 @@ class pdf_crabe extends ModelePDFFactures $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); } - if (! empty($conf->global->PDF_SHOW_PROJECT_TITLE)) + if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) { $object->fetch_projet(); - if (! empty($object->project->ref)) + if (!empty($object->project->ref)) { - $posy+=3; + $posy += 3; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->title)?'':$object->projet->title), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->projet->title), '', 'R'); } } - if (! empty($conf->global->PDF_SHOW_PROJECT)) + if (!empty($conf->global->PDF_SHOW_PROJECT)) { $object->fetch_projet(); - if (! empty($object->project->ref)) + if (!empty($object->project->ref)) { - $posy+=3; + $posy += 3; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R'); } } diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index a9d1230fdec..4fb6a55362e 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1963,27 +1963,27 @@ class pdf_sponge extends ModelePDFFactures $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); } - if (! empty($conf->global->PDF_SHOW_PROJECT_TITLE)) + if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) { $object->fetch_projet(); - if (! empty($object->project->ref)) + if (!empty($object->project->ref)) { - $posy+=3; + $posy += 3; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->title)?'':$object->projet->title), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->projet->title), '', 'R'); } } - if (! empty($conf->global->PDF_SHOW_PROJECT)) + if (!empty($conf->global->PDF_SHOW_PROJECT)) { $object->fetch_projet(); - if (! empty($object->project->ref)) + if (!empty($object->project->ref)) { - $posy+=3; + $posy += 3; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R'); } } diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index 7f92dcef6d6..61a4dd67d5c 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -24,7 +24,7 @@ * \ingroup category * \brief Fichier de description et activation du module Categorie */ -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; /** @@ -64,11 +64,11 @@ class modCategorie extends DolibarrModules // Config pages $this->config_page_url = array('categorie.php@categories'); - $this->langfiles = array("products","companies","categories","members"); + $this->langfiles = array("products", "companies", "categories", "members"); // Constants $this->const = array(); - $r=0; + $r = 0; $this->const[$r][0] = "CATEGORIE_RECURSIV_ADD"; $this->const[$r][1] = "yesno"; $this->const[$r][2] = "0"; @@ -83,7 +83,7 @@ class modCategorie extends DolibarrModules $this->rights = array(); $this->rights_class = 'categorie'; - $r=0; + $r = 0; $this->rights[$r][0] = 241; // id de la permission $this->rights[$r][1] = 'Lire les categories'; // libelle de la permission @@ -109,115 +109,115 @@ class modCategorie extends DolibarrModules // Menus //------- - $this->menu = 1; // This module add menu entries. They are coded into menu manager. + $this->menu = 1; // This module add menu entries. They are coded into menu manager. // Exports //-------- - $r=0; + $r = 0; $r++; - $this->export_code[$r]='category_'.$r; - $this->export_label[$r]='CatSupList'; - $this->export_icon[$r]='category'; - $this->export_enabled[$r]='$conf->fournisseur->enabled'; - $this->export_permission[$r]=array(array("categorie","lire"),array("fournisseur","lire")); - $this->export_fields_array[$r]=array( - 'u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'s.rowid'=>'IdThirdParty','s.nom'=>'Name','s.prefix_comm'=>"Prefix", - 's.client'=>"Customer",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.address'=>"Address", - 's.zip'=>"Zip",'s.town'=>"Town",'c.label'=>"Country",'c.code'=>"CountryCode",'s.phone'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email", - 's.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital", + $this->export_code[$r] = 'category_'.$r; + $this->export_label[$r] = 'CatSupList'; + $this->export_icon[$r] = 'category'; + $this->export_enabled[$r] = '$conf->fournisseur->enabled'; + $this->export_permission[$r] = array(array("categorie", "lire"), array("fournisseur", "lire")); + $this->export_fields_array[$r] = array( + 'u.rowid'=>"CategId", 'u.label'=>"Label", 'u.description'=>"Description", 's.rowid'=>'IdThirdParty', 's.nom'=>'Name', 's.prefix_comm'=>"Prefix", + 's.client'=>"Customer", 's.datec'=>"DateCreation", 's.tms'=>"DateLastModification", 's.code_client'=>"CustomerCode", 's.address'=>"Address", + 's.zip'=>"Zip", 's.town'=>"Town", 'c.label'=>"Country", 'c.code'=>"CountryCode", 's.phone'=>"Phone", 's.fax'=>"Fax", 's.url'=>"Url", 's.email'=>"Email", + 's.siret'=>"ProfId1", 's.siren'=>"ProfId2", 's.ape'=>"ProfId3", 's.idprof4'=>"ProfId4", 's.tva_intra'=>"VATIntraShort", 's.capital'=>"Capital", 's.note_public'=>"NotePublic" ); - $this->export_TypeFields_array[$r]=array( - 'u.label'=>"Text",'u.description'=>"Text",'s.rowid'=>'List:societe:nom','s.nom'=>'Text','s.prefix_comm'=>"Text",'s.client'=>"Text",'s.datec'=>"Date", - 's.tms'=>"Date",'s.code_client'=>"Text",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'c.label'=>"List:c_country:label:label",'c.code'=>"Text", - 's.phone'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",'s.idprof4'=>"Text", - 's.tva_intra'=>"Text",'s.capital'=>"Numeric",'s.note_public'=>"Text" + $this->export_TypeFields_array[$r] = array( + 'u.label'=>"Text", 'u.description'=>"Text", 's.rowid'=>'List:societe:nom', 's.nom'=>'Text', 's.prefix_comm'=>"Text", 's.client'=>"Text", 's.datec'=>"Date", + 's.tms'=>"Date", 's.code_client'=>"Text", 's.address'=>"Text", 's.zip'=>"Text", 's.town'=>"Text", 'c.label'=>"List:c_country:label:label", 'c.code'=>"Text", + 's.phone'=>"Text", 's.fax'=>"Text", 's.url'=>"Text", 's.email'=>"Text", 's.siret'=>"Text", 's.siren'=>"Text", 's.ape'=>"Text", 's.idprof4'=>"Text", + 's.tva_intra'=>"Text", 's.capital'=>"Numeric", 's.note_public'=>"Text" ); - $this->export_entities_array[$r]=array( - 's.rowid'=>'company','s.nom'=>'company','s.prefix_comm'=>"company",'s.client'=>"company",'s.datec'=>"company",'s.tms'=>"company", - 's.code_client'=>"company",'s.address'=>"company",'s.zip'=>"company",'s.town'=>"company",'c.label'=>"company",'c.code'=>"company", - 's.phone'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company", - 's.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note_public'=>"company" - ); // We define here only fields that use another picto - $this->export_sql_start[$r]='SELECT DISTINCT '; - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '; + $this->export_entities_array[$r] = array( + 's.rowid'=>'company', 's.nom'=>'company', 's.prefix_comm'=>"company", 's.client'=>"company", 's.datec'=>"company", 's.tms'=>"company", + 's.code_client'=>"company", 's.address'=>"company", 's.zip'=>"company", 's.town'=>"company", 'c.label'=>"company", 'c.code'=>"company", + 's.phone'=>"company", 's.fax'=>"company", 's.url'=>"company", 's.email'=>"company", 's.siret'=>"company", 's.siren'=>"company", 's.ape'=>"company", + 's.idprof4'=>"company", 's.tva_intra'=>"company", 's.capital'=>"company", 's.note_public'=>"company" + ); // We define here only fields that use another picto + $this->export_sql_start[$r] = 'SELECT DISTINCT '; + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as u, '; $this->export_sql_end[$r] .= MAIN_DB_PREFIX.'categorie_fournisseur as cf, '; $this->export_sql_end[$r] .= MAIN_DB_PREFIX.'societe as s LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code'; - $this->export_sql_end[$r] .=' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid'; - $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')'; - $this->export_sql_end[$r] .=' AND u.type = 1'; // Supplier categories + $this->export_sql_end[$r] .= ' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid'; + $this->export_sql_end[$r] .= ' AND u.entity IN ('.getEntity('category').')'; + $this->export_sql_end[$r] .= ' AND u.type = 1'; // Supplier categories $r++; - $this->export_code[$r]='category_'.$r; - $this->export_label[$r]='CatCusList'; - $this->export_icon[$r]='category'; - $this->export_enabled[$r]='$conf->societe->enabled'; - $this->export_permission[$r]=array(array("categorie","lire"),array("societe","lire")); - $this->export_fields_array[$r]=array( - 'u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'s.rowid'=>'IdThirdParty','s.nom'=>'Name','s.prefix_comm'=>"Prefix", - 's.client'=>"Customer",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.address'=>"Address", - 's.zip'=>"Zip",'s.town'=>"Town",'c.label'=>"Country",'c.code'=>"CountryCode",'s.phone'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email", - 's.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital", - 's.note_public'=>"NotePublic",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus' + $this->export_code[$r] = 'category_'.$r; + $this->export_label[$r] = 'CatCusList'; + $this->export_icon[$r] = 'category'; + $this->export_enabled[$r] = '$conf->societe->enabled'; + $this->export_permission[$r] = array(array("categorie", "lire"), array("societe", "lire")); + $this->export_fields_array[$r] = array( + 'u.rowid'=>"CategId", 'u.label'=>"Label", 'u.description'=>"Description", 's.rowid'=>'IdThirdParty', 's.nom'=>'Name', 's.prefix_comm'=>"Prefix", + 's.client'=>"Customer", 's.datec'=>"DateCreation", 's.tms'=>"DateLastModification", 's.code_client'=>"CustomerCode", 's.address'=>"Address", + 's.zip'=>"Zip", 's.town'=>"Town", 'c.label'=>"Country", 'c.code'=>"CountryCode", 's.phone'=>"Phone", 's.fax'=>"Fax", 's.url'=>"Url", 's.email'=>"Email", + 's.siret'=>"ProfId1", 's.siren'=>"ProfId2", 's.ape'=>"ProfId3", 's.idprof4'=>"ProfId4", 's.tva_intra'=>"VATIntraShort", 's.capital'=>"Capital", + 's.note_public'=>"NotePublic", 's.fk_prospectlevel'=>'ProspectLevel', 's.fk_stcomm'=>'ProspectStatus' ); - $this->export_TypeFields_array[$r]=array( - 'u.label'=>"Text",'u.description'=>"Text",'s.rowid'=>'List:societe:nom','s.nom'=>'Text','s.prefix_comm'=>"Text",'s.client'=>"Text", - 's.datec'=>"Date",'s.tms'=>"Date",'s.code_client'=>"Text",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'c.label'=>"List:c_country:label:label", - 'c.code'=>"Text",'s.phone'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text", - 's.idprof4'=>"Text",'s.tva_intra'=>"Text",'s.capital'=>"Numeric",'s.note_public'=>"Text",'s.fk_prospectlevel'=>'List:c_prospectlevel:label:code', + $this->export_TypeFields_array[$r] = array( + 'u.label'=>"Text", 'u.description'=>"Text", 's.rowid'=>'List:societe:nom', 's.nom'=>'Text', 's.prefix_comm'=>"Text", 's.client'=>"Text", + 's.datec'=>"Date", 's.tms'=>"Date", 's.code_client'=>"Text", 's.address'=>"Text", 's.zip'=>"Text", 's.town'=>"Text", 'c.label'=>"List:c_country:label:label", + 'c.code'=>"Text", 's.phone'=>"Text", 's.fax'=>"Text", 's.url'=>"Text", 's.email'=>"Text", 's.siret'=>"Text", 's.siren'=>"Text", 's.ape'=>"Text", + 's.idprof4'=>"Text", 's.tva_intra'=>"Text", 's.capital'=>"Numeric", 's.note_public'=>"Text", 's.fk_prospectlevel'=>'List:c_prospectlevel:label:code', 's.fk_stcomm'=>'List:c_stcomm:libelle:code' ); - $this->export_entities_array[$r]=array( - 's.rowid'=>'company','s.nom'=>'company','s.prefix_comm'=>"company",'s.client'=>"company",'s.datec'=>"company",'s.tms'=>"company", - 's.code_client'=>"company",'s.address'=>"company",'s.zip'=>"company",'s.town'=>"company",'c.label'=>"company",'c.code'=>"company", - 's.phone'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company", - 's.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note_public'=>"company",'s.fk_prospectlevel'=>'company', + $this->export_entities_array[$r] = array( + 's.rowid'=>'company', 's.nom'=>'company', 's.prefix_comm'=>"company", 's.client'=>"company", 's.datec'=>"company", 's.tms'=>"company", + 's.code_client'=>"company", 's.address'=>"company", 's.zip'=>"company", 's.town'=>"company", 'c.label'=>"company", 'c.code'=>"company", + 's.phone'=>"company", 's.fax'=>"company", 's.url'=>"company", 's.email'=>"company", 's.siret'=>"company", 's.siren'=>"company", 's.ape'=>"company", + 's.idprof4'=>"company", 's.tva_intra'=>"company", 's.capital'=>"company", 's.note_public'=>"company", 's.fk_prospectlevel'=>'company', 's.fk_stcomm'=>'company' - ); // We define here only fields that use another picto - $this->export_sql_start[$r]='SELECT DISTINCT '; - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '; + ); // We define here only fields that use another picto + $this->export_sql_start[$r] = 'SELECT DISTINCT '; + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as u, '; $this->export_sql_end[$r] .= MAIN_DB_PREFIX.'categorie_societe as cf, '; $this->export_sql_end[$r] .= MAIN_DB_PREFIX.'societe as s LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object '; - $this->export_sql_end[$r] .=' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid'; - $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')'; - $this->export_sql_end[$r] .=' AND u.type = 2'; // Customer/Prospect categories + $this->export_sql_end[$r] .= ' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid'; + $this->export_sql_end[$r] .= ' AND u.entity IN ('.getEntity('category').')'; + $this->export_sql_end[$r] .= ' AND u.type = 2'; // Customer/Prospect categories // Add extra fields - $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")"; - $resql=$this->db->query($sql); + $sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")"; + $resql = $this->db->query($sql); if ($resql) // This can fail when class is used on old database (during migration for example) { - while ($obj=$this->db->fetch_object($resql)) + while ($obj = $this->db->fetch_object($resql)) { - $fieldname='extra.'.$obj->name; - $fieldlabel=ucfirst($obj->label); - $typeFilter="Text"; - switch($obj->type) + $fieldname = 'extra.'.$obj->name; + $fieldlabel = ucfirst($obj->label); + $typeFilter = "Text"; + switch ($obj->type) { case 'int': case 'double': case 'price': - $typeFilter="Numeric"; + $typeFilter = "Numeric"; break; case 'date': case 'datetime': - $typeFilter="Date"; + $typeFilter = "Date"; break; case 'boolean': - $typeFilter="Boolean"; + $typeFilter = "Boolean"; break; case 'sellist': - $typeFilter="List:".$obj->param; + $typeFilter = "List:".$obj->param; break; case 'select': - $typeFilter="Select:".$obj->param; + $typeFilter = "Select:".$obj->param; break; } - $this->export_fields_array[$r][$fieldname]=$fieldlabel; - $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; - $this->export_entities_array[$r][$fieldname]='company'; + $this->export_fields_array[$r][$fieldname] = $fieldlabel; + $this->export_TypeFields_array[$r][$fieldname] = $typeFilter; + $this->export_entities_array[$r][$fieldname] = 'company'; } } // End add axtra fields @@ -227,42 +227,42 @@ class modCategorie extends DolibarrModules $r++; - $this->export_code[$r]='category_'.$r; - $this->export_label[$r]='CatProdList'; - $this->export_icon[$r]='category'; - $this->export_enabled[$r]='$conf->product->enabled || $conf->service->enabled'; - $this->export_permission[$r]=array(array("categorie","lire"),array("produit","lire")); - $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'ProductId','p.ref'=>'Ref'); - $this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.ref'=>'Text'); - $this->export_entities_array[$r]=array('p.rowid'=>'product','p.ref'=>'product'); // We define here only fields that use another picto - $this->export_sql_start[$r]='SELECT DISTINCT '; - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_product as cp, '.MAIN_DB_PREFIX.'product as p'; - $this->export_sql_end[$r] .=' WHERE u.rowid = cp.fk_categorie AND cp.fk_product = p.rowid'; - $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')'; - $this->export_sql_end[$r] .=' AND u.type = 0'; // Supplier categories + $this->export_code[$r] = 'category_'.$r; + $this->export_label[$r] = 'CatProdList'; + $this->export_icon[$r] = 'category'; + $this->export_enabled[$r] = '$conf->product->enabled || $conf->service->enabled'; + $this->export_permission[$r] = array(array("categorie", "lire"), array("produit", "lire")); + $this->export_fields_array[$r] = array('u.rowid'=>"CategId", 'u.label'=>"Label", 'u.description'=>"Description", 'p.rowid'=>'ProductId', 'p.ref'=>'Ref'); + $this->export_TypeFields_array[$r] = array('u.label'=>"Text", 'u.description'=>"Text", 'p.ref'=>'Text'); + $this->export_entities_array[$r] = array('p.rowid'=>'product', 'p.ref'=>'product'); // We define here only fields that use another picto + $this->export_sql_start[$r] = 'SELECT DISTINCT '; + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_product as cp, '.MAIN_DB_PREFIX.'product as p'; + $this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_product = p.rowid'; + $this->export_sql_end[$r] .= ' AND u.entity IN ('.getEntity('category').')'; + $this->export_sql_end[$r] .= ' AND u.type = 0'; // Supplier categories $r++; - $this->export_code[$r]='category_'.$r; - $this->export_label[$r]='CatMemberList'; - $this->export_icon[$r]='category'; - $this->export_enabled[$r]='$conf->adherent->enabled'; - $this->export_permission[$r]=array(array("categorie","lire"),array("adherent","lire")); - $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'MemberId','p.lastname'=>'LastName','p.firstname'=>'Firstname'); - $this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.lastname'=>'Text','p.firstname'=>'Text'); - $this->export_entities_array[$r]=array('p.rowid'=>'member','p.lastname'=>'member','p.firstname'=>'member'); // We define here only fields that use another picto - $this->export_sql_start[$r]='SELECT DISTINCT '; - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_member as cp, '.MAIN_DB_PREFIX.'adherent as p'; - $this->export_sql_end[$r] .=' WHERE u.rowid = cp.fk_categorie AND cp.fk_member = p.rowid'; - $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')'; - $this->export_sql_end[$r] .=' AND u.type = 3'; // Member categories + $this->export_code[$r] = 'category_'.$r; + $this->export_label[$r] = 'CatMemberList'; + $this->export_icon[$r] = 'category'; + $this->export_enabled[$r] = '$conf->adherent->enabled'; + $this->export_permission[$r] = array(array("categorie", "lire"), array("adherent", "lire")); + $this->export_fields_array[$r] = array('u.rowid'=>"CategId", 'u.label'=>"Label", 'u.description'=>"Description", 'p.rowid'=>'MemberId', 'p.lastname'=>'LastName', 'p.firstname'=>'Firstname'); + $this->export_TypeFields_array[$r] = array('u.label'=>"Text", 'u.description'=>"Text", 'p.lastname'=>'Text', 'p.firstname'=>'Text'); + $this->export_entities_array[$r] = array('p.rowid'=>'member', 'p.lastname'=>'member', 'p.firstname'=>'member'); // We define here only fields that use another picto + $this->export_sql_start[$r] = 'SELECT DISTINCT '; + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_member as cp, '.MAIN_DB_PREFIX.'adherent as p'; + $this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_member = p.rowid'; + $this->export_sql_end[$r] .= ' AND u.entity IN ('.getEntity('category').')'; + $this->export_sql_end[$r] .= ' AND u.type = 3'; // Member categories $r++; - $this->export_code[$r]='category_'.$r; - $this->export_label[$r]='CatContactList'; - $this->export_icon[$r]='category'; - $this->export_enabled[$r]='$conf->societe->enabled'; - $this->export_permission[$r]=array(array("categorie", "lire"), array ("societe", "lire")); - $this->export_fields_array[$r]=array ( + $this->export_code[$r] = 'category_'.$r; + $this->export_label[$r] = 'CatContactList'; + $this->export_icon[$r] = 'category'; + $this->export_enabled[$r] = '$conf->societe->enabled'; + $this->export_permission[$r] = array(array("categorie", "lire"), array("societe", "lire")); + $this->export_fields_array[$r] = array( 'u.rowid' => "CategId", 'u.label' => "Label", 'u.description' => "Description", @@ -297,7 +297,7 @@ class modCategorie extends DolibarrModules 's.url'=>"Url", 's.email'=>"Email" ); - $this->export_TypeFields_array[$r] = array ( + $this->export_TypeFields_array[$r] = array( 'u.label' => "Text", 'u.description' => "Text", 'p.lastname' => 'Text', @@ -313,7 +313,7 @@ class modCategorie extends DolibarrModules 's.url'=>"Text", 's.email'=>"Text" ); - $this->export_entities_array[$r] = array ( + $this->export_entities_array[$r] = array( 'u.rowid' => "category", 'u.label' => "category", 'u.description' => "category", @@ -350,67 +350,67 @@ class modCategorie extends DolibarrModules ); // We define here only fields that use another picto // Add extra fields - $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople' AND entity IN (0, ".$conf->entity.")"; - $resql=$this->db->query($sql); + $sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople' AND entity IN (0, ".$conf->entity.")"; + $resql = $this->db->query($sql); if ($resql) // This can fail when class is used on old database (during migration for example) { - while ($obj=$this->db->fetch_object($resql)) + while ($obj = $this->db->fetch_object($resql)) { - $fieldname='extra.'.$obj->name; - $fieldlabel=ucfirst($obj->label); - $typeFilter="Text"; - switch($obj->type) + $fieldname = 'extra.'.$obj->name; + $fieldlabel = ucfirst($obj->label); + $typeFilter = "Text"; + switch ($obj->type) { case 'int': case 'double': case 'price': - $typeFilter="Numeric"; + $typeFilter = "Numeric"; break; case 'date': case 'datetime': - $typeFilter="Date"; + $typeFilter = "Date"; break; case 'boolean': - $typeFilter="Boolean"; + $typeFilter = "Boolean"; break; case 'sellist': - $typeFilter="List:".$obj->param; + $typeFilter = "List:".$obj->param; break; case 'select': - $typeFilter="Select:".$obj->param; + $typeFilter = "Select:".$obj->param; break; } - $this->export_fields_array[$r][$fieldname]=$fieldlabel; - $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; - $this->export_entities_array[$r][$fieldname]='contact'; + $this->export_fields_array[$r][$fieldname] = $fieldlabel; + $this->export_TypeFields_array[$r][$fieldname] = $typeFilter; + $this->export_entities_array[$r][$fieldname] = 'contact'; } } // End add axtra fields $this->export_sql_start[$r] = 'SELECT DISTINCT '; - $this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'categorie as u, '.MAIN_DB_PREFIX . 'categorie_contact as cp, '.MAIN_DB_PREFIX . 'socpeople as p'; - $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_country as country ON p.fk_pays = country.rowid'; - $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe as s ON s.rowid = p.fk_soc'; - $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'socpeople_extrafields as extra ON extra.fk_object = p.rowid'; + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_contact as cp, '.MAIN_DB_PREFIX.'socpeople as p'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as country ON p.fk_pays = country.rowid'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra ON extra.fk_object = p.rowid'; $this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_socpeople = p.rowid AND u.entity IN ('.getEntity('category').')'; $this->export_sql_end[$r] .= ' AND u.type = 4'; // contact categories // Imports //-------- - $r=0; + $r = 0; $r++; - $this->import_code[$r]=$this->rights_class.'_'.$r; - $this->import_label[$r]="CatList"; // Translation key - $this->import_icon[$r]=$this->picto; - $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon - $this->import_tables_array[$r]=array('ca'=>MAIN_DB_PREFIX.'categorie'); - $this->import_fields_array[$r]=array( - 'ca.label'=>"Label*",'ca.type'=>"Type*",'ca.description'=>"Description", + $this->import_code[$r] = $this->rights_class.'_'.$r; + $this->import_label[$r] = "CatList"; // Translation key + $this->import_icon[$r] = $this->picto; + $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r] = array('ca'=>MAIN_DB_PREFIX.'categorie'); + $this->import_fields_array[$r] = array( + 'ca.label'=>"Label*", 'ca.type'=>"Type*", 'ca.description'=>"Description", 'ca.fk_parent' => 'Parent' ); - $this->import_regex_array[$r]=array('ca.type'=>'^[0|1|2|3]'); + $this->import_regex_array[$r] = array('ca.type'=>'^[0|1|2|3]'); $this->import_convertvalue_array[$r] = array( 'ca.fk_parent' => array( 'rule' => 'fetchidfromcodeandlabel', @@ -421,96 +421,96 @@ class modCategorie extends DolibarrModules 'codefromfield' => 'ca.type' ) ); - $typeexample=""; - if ($conf->product->enabled) { $typeexample.=($typeexample?"/":"")."0=Product"; } - if ($conf->fournisseur->enabled) { $typeexample.=($typeexample?"/":"")."1=Supplier"; } - if ($conf->societe->enabled) { $typeexample.=($typeexample?"/":"")."2=Customer-Prospect"; } - if ($conf->adherent->enabled) { $typeexample.=($typeexample?"/":"")."3=Member"; } + $typeexample = ""; + if ($conf->product->enabled) { $typeexample .= ($typeexample ? "/" : "")."0=Product"; } + if ($conf->fournisseur->enabled) { $typeexample .= ($typeexample ? "/" : "")."1=Supplier"; } + if ($conf->societe->enabled) { $typeexample .= ($typeexample ? "/" : "")."2=Customer-Prospect"; } + if ($conf->adherent->enabled) { $typeexample .= ($typeexample ? "/" : "")."3=Member"; } $this->import_examplevalues_array[$r] = array( - 'ca.label'=>"Supplier Category",'ca.type'=>$typeexample,'ca.description'=>"My Category description", + 'ca.label'=>"Supplier Category", 'ca.type'=>$typeexample, 'ca.description'=>"My Category description", 'ca.fk_parent' => '0' ); - if (! empty($conf->product->enabled)) + if (!empty($conf->product->enabled)) { //Products $r++; - $this->import_code[$r]=$this->rights_class.'_'.$r; - $this->import_label[$r]="CatProdLinks"; // Translation key - $this->import_icon[$r]=$this->picto; - $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon - $this->import_tables_array[$r]=array('cp'=>MAIN_DB_PREFIX.'categorie_product'); - $this->import_fields_array[$r]=array('cp.fk_categorie'=>"Category*",'cp.fk_product'=>"Product*"); - $this->import_regex_array[$r]=array('cp.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=0'); + $this->import_code[$r] = $this->rights_class.'_'.$r; + $this->import_label[$r] = "CatProdLinks"; // Translation key + $this->import_icon[$r] = $this->picto; + $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r] = array('cp'=>MAIN_DB_PREFIX.'categorie_product'); + $this->import_fields_array[$r] = array('cp.fk_categorie'=>"Category*", 'cp.fk_product'=>"Product*"); + $this->import_regex_array[$r] = array('cp.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=0'); - $this->import_convertvalue_array[$r]=array( - 'cp.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'), - 'cp.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'product') + $this->import_convertvalue_array[$r] = array( + 'cp.fk_categorie'=>array('rule'=>'fetchidfromref', 'classfile'=>'/categories/class/categorie.class.php', 'class'=>'Categorie', 'method'=>'fetch', 'element'=>'category'), + 'cp.fk_product'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/class/product.class.php', 'class'=>'Product', 'method'=>'fetch', 'element'=>'product') ); - $this->import_examplevalues_array[$r]=array('cp.fk_categorie'=>"Imported category",'cp.fk_product'=>"PREF123456"); + $this->import_examplevalues_array[$r] = array('cp.fk_categorie'=>"Imported category", 'cp.fk_product'=>"PREF123456"); } - if (! empty($conf->societe->enabled)) + if (!empty($conf->societe->enabled)) { // Customers $r++; - $this->import_code[$r]=$this->rights_class.'_'.$r; - $this->import_label[$r]="CatCusLinks"; // Translation key - $this->import_icon[$r]=$this->picto; - $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon - $this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_societe'); - $this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"ThirdParty*"); - $this->import_regex_array[$r]=array( + $this->import_code[$r] = $this->rights_class.'_'.$r; + $this->import_label[$r] = "CatCusLinks"; // Translation key + $this->import_icon[$r] = $this->picto; + $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r] = array('cs'=>MAIN_DB_PREFIX.'categorie_societe'); + $this->import_fields_array[$r] = array('cs.fk_categorie'=>"Category*", 'cs.fk_soc'=>"ThirdParty*"); + $this->import_regex_array[$r] = array( 'cs.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=2', 'cs.fk_soc'=>'rowid@'.MAIN_DB_PREFIX.'societe:client>0' ); - $this->import_convertvalue_array[$r]=array( - 'cs.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'), - 'cs.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty') + $this->import_convertvalue_array[$r] = array( + 'cs.fk_categorie'=>array('rule'=>'fetchidfromref', 'classfile'=>'/categories/class/categorie.class.php', 'class'=>'Categorie', 'method'=>'fetch', 'element'=>'category'), + 'cs.fk_soc'=>array('rule'=>'fetchidfromref', 'classfile'=>'/societe/class/societe.class.php', 'class'=>'Societe', 'method'=>'fetch', 'element'=>'ThirdParty') ); - $this->import_examplevalues_array[$r]=array('cs.fk_categorie'=>"Imported category",'cs.fk_soc'=>"MyBigCompany"); + $this->import_examplevalues_array[$r] = array('cs.fk_categorie'=>"Imported category", 'cs.fk_soc'=>"MyBigCompany"); // Contacts/Addresses $r++; - $this->import_code[$r]=$this->rights_class.'_'.$r; - $this->import_label[$r]="CatContactsLinks"; // Translation key - $this->import_icon[$r]=$this->picto; - $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon - $this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_contact'); - $this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_socpeople'=>"Contact ID*"); - $this->import_regex_array[$r]=array( + $this->import_code[$r] = $this->rights_class.'_'.$r; + $this->import_label[$r] = "CatContactsLinks"; // Translation key + $this->import_icon[$r] = $this->picto; + $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r] = array('cs'=>MAIN_DB_PREFIX.'categorie_contact'); + $this->import_fields_array[$r] = array('cs.fk_categorie'=>"Category*", 'cs.fk_socpeople'=>"Contact ID*"); + $this->import_regex_array[$r] = array( 'cs.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=4' //'cs.fk_socpeople'=>'rowid@'.MAIN_DB_PREFIX.'socpeople' ); - $this->import_convertvalue_array[$r]=array( - 'cs.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category') + $this->import_convertvalue_array[$r] = array( + 'cs.fk_categorie'=>array('rule'=>'fetchidfromref', 'classfile'=>'/categories/class/categorie.class.php', 'class'=>'Categorie', 'method'=>'fetch', 'element'=>'category') //'cs.fk_socpeople'=>array('rule'=>'fetchidfromref','classfile'=>'/contact/class/contact.class.php','class'=>'Contact','method'=>'fetch','element'=>'Contact') ); - $this->import_examplevalues_array[$r]=array('cs.fk_categorie'=>"Imported category",'cs.fk_socpeople'=>"123"); + $this->import_examplevalues_array[$r] = array('cs.fk_categorie'=>"Imported category", 'cs.fk_socpeople'=>"123"); } - if (! empty($conf->fournisseur->enabled)) + if (!empty($conf->fournisseur->enabled)) { // Suppliers $r++; - $this->import_code[$r]=$this->rights_class.'_'.$r; - $this->import_label[$r]="CatSupLinks"; // Translation key - $this->import_icon[$r]=$this->picto; - $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon - $this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_fournisseur'); - $this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"Supplier*"); - $this->import_regex_array[$r]=array( + $this->import_code[$r] = $this->rights_class.'_'.$r; + $this->import_label[$r] = "CatSupLinks"; // Translation key + $this->import_icon[$r] = $this->picto; + $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r] = array('cs'=>MAIN_DB_PREFIX.'categorie_fournisseur'); + $this->import_fields_array[$r] = array('cs.fk_categorie'=>"Category*", 'cs.fk_soc'=>"Supplier*"); + $this->import_regex_array[$r] = array( 'cs.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=1', 'cs.fk_soc'=>'rowid@'.MAIN_DB_PREFIX.'societe:fournisseur>0' ); - $this->import_convertvalue_array[$r]=array( - 'cs.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'), - 'cs.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty') + $this->import_convertvalue_array[$r] = array( + 'cs.fk_categorie'=>array('rule'=>'fetchidfromref', 'classfile'=>'/categories/class/categorie.class.php', 'class'=>'Categorie', 'method'=>'fetch', 'element'=>'category'), + 'cs.fk_soc'=>array('rule'=>'fetchidfromref', 'classfile'=>'/societe/class/societe.class.php', 'class'=>'Societe', 'method'=>'fetch', 'element'=>'ThirdParty') ); - $this->import_examplevalues_array[$r]=array('cs.fk_categorie'=>"Imported category",'cs.fk_soc'=>"MyBigCompany"); + $this->import_examplevalues_array[$r] = array('cs.fk_categorie'=>"Imported category", 'cs.fk_soc'=>"MyBigCompany"); } } diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index aa68fdeb698..77d339da035 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -28,7 +28,7 @@ * \ingroup projet * \brief Fichier de description et activation du module Projet */ -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; /** @@ -58,22 +58,22 @@ class modProjet extends DolibarrModules $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->config_page_url = array("project.php@projet"); - $this->picto='project'; + $this->picto = 'project'; // Data directories to create when module is enabled $this->dirs = array("/projet/temp"); // Dependencies - $this->hidden = false; // A condition to hide module - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled - $this->requiredby = array(); // List of module ids to disable if this one is disabled - $this->conflictwith = array(); // List of module class names as string this module is in conflict with - $this->phpmin = array(5,4); // Minimum version of PHP required by module + $this->hidden = false; // A condition to hide module + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled + $this->requiredby = array(); // List of module ids to disable if this one is disabled + $this->conflictwith = array(); // List of module class names as string this module is in conflict with + $this->phpmin = array(5, 4); // Minimum version of PHP required by module $this->langfiles = array('projects'); // Constants $this->const = array(); - $r=0; + $r = 0; $this->const[$r][0] = "PROJECT_ADDON_PDF"; $this->const[$r][1] = "chaine"; @@ -139,7 +139,7 @@ class modProjet extends DolibarrModules // Boxes $this->boxes = array(); - $r=0; + $r = 0; $this->boxes[$r][1] = "box_project.php"; $r++; $this->boxes[$r][1] = "box_task.php"; @@ -148,7 +148,7 @@ class modProjet extends DolibarrModules // Permissions $this->rights = array(); $this->rights_class = 'projet'; - $r=0; + $r = 0; $r++; $this->rights[$r][0] = 41; // id de la permission @@ -205,43 +205,43 @@ class modProjet extends DolibarrModules // Menus //------- - $this->menu = 1; // This module add menu entries. They are coded into menu manager. + $this->menu = 1; // This module add menu entries. They are coded into menu manager. //Exports //-------- - $r=1; + $r = 1; - $this->export_code[$r]=$this->rights_class.'_'.$r; - $this->export_label[$r]='ProjectsAndTasksLines'; // Translation key (used only if key ExportDataset_xxx_z not found) - $this->export_permission[$r]=array(array("projet","export")); - $this->export_dependencies_array[$r]=array('projecttask'=>'pt.rowid', 'task_time'=>'ptt.rowid'); + $this->export_code[$r] = $this->rights_class.'_'.$r; + $this->export_label[$r] = 'ProjectsAndTasksLines'; // Translation key (used only if key ExportDataset_xxx_z not found) + $this->export_permission[$r] = array(array("projet", "export")); + $this->export_dependencies_array[$r] = array('projecttask'=>'pt.rowid', 'task_time'=>'ptt.rowid'); - $this->export_TypeFields_array[$r]=array( - 's.rowid'=>"List:societe:nom::thirdparty",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label', - 's.phone'=>'Text','s.email'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text', - 'p.rowid'=>"List:projet:ref::project",'p.ref'=>"Text",'p.title'=>"Text", + $this->export_TypeFields_array[$r] = array( + 's.rowid'=>"List:societe:nom::thirdparty", 's.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 's.fk_pays'=>'List:c_country:label', + 's.phone'=>'Text', 's.email'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', + 'p.rowid'=>"List:projet:ref::project", 'p.ref'=>"Text", 'p.title'=>"Text", 'p.usage_opportunity'=>'Boolean', 'p.usage_task'=>'Boolean', 'p.usage_bill_time'=>'Boolean', - 'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.opp_amount'=>'Numeric','p.description'=>"Text",'p.entity'=>'Numeric', - 'pt.rowid'=>'Numeric','pt.ref'=>'Text','pt.label'=>'Text','pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Numeric",'pt.progress'=>"Numeric",'pt.description'=>"Text", - 'ptt.rowid'=>'Numeric','ptt.task_date'=>'Date','ptt.task_duration'=>"Duree",'ptt.fk_user'=>"List:user:CONCAT(lastname,' ',firstname)",'ptt.note'=>"Text" + 'p.datec'=>"Date", 'p.dateo'=>"Date", 'p.datee'=>"Date", 'p.fk_statut'=>'Status', 'cls.code'=>"Text", 'p.opp_percent'=>'Numeric', 'p.opp_amount'=>'Numeric', 'p.description'=>"Text", 'p.entity'=>'Numeric', + 'pt.rowid'=>'Numeric', 'pt.ref'=>'Text', 'pt.label'=>'Text', 'pt.dateo'=>"Date", 'pt.datee'=>"Date", 'pt.duration_effective'=>"Duree", 'pt.planned_workload'=>"Numeric", 'pt.progress'=>"Numeric", 'pt.description'=>"Text", + 'ptt.rowid'=>'Numeric', 'ptt.task_date'=>'Date', 'ptt.task_duration'=>"Duree", 'ptt.fk_user'=>"List:user:CONCAT(lastname,' ',firstname)", 'ptt.note'=>"Text" ); - $this->export_entities_array[$r]=array( - 's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company', - 's.phone'=>'company','s.email'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company' + $this->export_entities_array[$r] = array( + 's.rowid'=>"company", 's.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 's.fk_pays'=>'company', + 's.phone'=>'company', 's.email'=>'company', 's.siren'=>'company', 's.siret'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.code_compta'=>'company', 's.code_compta_fournisseur'=>'company' ); - $this->export_fields_array[$r]=array( - 's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country', - 's.phone'=>'Phone','s.email'=>'Email','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode', - 'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.title'=>'ProjectLabel', + $this->export_fields_array[$r] = array( + 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 's.fk_pays'=>'Country', + 's.phone'=>'Phone', 's.email'=>'Email', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.code_compta'=>'CustomerAccountancyCode', 's.code_compta_fournisseur'=>'SupplierAccountancyCode', + 'p.rowid'=>"ProjectId", 'p.ref'=>"RefProject", 'p.title'=>'ProjectLabel', 'p.usage_opportunity'=>'ProjectFollowOpportunity', 'p.usage_task'=>'ProjectFollowTasks', 'p.usage_bill_time'=>'BillTime', - 'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'ProjectStatus','cls.code'=>'OpportunityStatus','p.opp_percent'=>'OpportunityProbability','p.opp_amount'=>'OpportunityAmount','p.description'=>"Description" + 'p.datec'=>"DateCreation", 'p.dateo'=>"DateStart", 'p.datee'=>"DateEnd", 'p.fk_statut'=>'ProjectStatus', 'cls.code'=>'OpportunityStatus', 'p.opp_percent'=>'OpportunityProbability', 'p.opp_amount'=>'OpportunityAmount', 'p.description'=>"Description" ); // Add multicompany field - if (! empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED)) + if (!empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED)) { - $nbofallowedentities=count(explode(',', getEntity('project'))); // If project are shared, nb will be > 1 - if (! empty($conf->multicompany->enabled) && $nbofallowedentities > 1) $this->export_fields_array[$r]+=array('p.entity'=>'Entity'); + $nbofallowedentities = count(explode(',', getEntity('project'))); // If project are shared, nb will be > 1 + if (!empty($conf->multicompany->enabled) && $nbofallowedentities > 1) $this->export_fields_array[$r] += array('p.entity'=>'Entity'); } if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { @@ -251,68 +251,68 @@ class modProjet extends DolibarrModules } // Add fields for project - $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array()); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array()); // Add extra fields for project - $keyforselect='projet'; $keyforelement='project'; $keyforaliasextra='extra'; + $keyforselect = 'projet'; $keyforelement = 'project'; $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; // Add fields for tasks - $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('pt.rowid'=>'TaskId', 'pt.ref'=>'RefTask', 'pt.label'=>'LabelTask', 'pt.dateo'=>"TaskDateStart", 'pt.datee'=>"TaskDateEnd", 'pt.duration_effective'=>"DurationEffective", 'pt.planned_workload'=>"PlannedWorkload", 'pt.progress'=>"Progress", 'pt.description'=>"TaskDescription")); - $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('pt.rowid'=>'projecttask', 'pt.ref'=>'projecttask', 'pt.label'=>'projecttask', 'pt.dateo'=>"projecttask", 'pt.datee'=>"projecttask", 'pt.duration_effective'=>"projecttask", 'pt.planned_workload'=>"projecttask", 'pt.progress'=>"projecttask", 'pt.description'=>"projecttask")); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('pt.rowid'=>'TaskId', 'pt.ref'=>'RefTask', 'pt.label'=>'LabelTask', 'pt.dateo'=>"TaskDateStart", 'pt.datee'=>"TaskDateEnd", 'pt.duration_effective'=>"DurationEffective", 'pt.planned_workload'=>"PlannedWorkload", 'pt.progress'=>"Progress", 'pt.description'=>"TaskDescription")); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('pt.rowid'=>'projecttask', 'pt.ref'=>'projecttask', 'pt.label'=>'projecttask', 'pt.dateo'=>"projecttask", 'pt.datee'=>"projecttask", 'pt.duration_effective'=>"projecttask", 'pt.planned_workload'=>"projecttask", 'pt.progress'=>"projecttask", 'pt.description'=>"projecttask")); // Add extra fields for task - $keyforselect='projet_task'; $keyforelement='projecttask'; $keyforaliasextra='extra2'; + $keyforselect = 'projet_task'; $keyforelement = 'projecttask'; $keyforaliasextra = 'extra2'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; // End add extra fields - $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('ptt.rowid'=>'IdTaskTime','ptt.task_date'=>'TaskTimeDate','ptt.task_duration'=>"TimesSpent",'ptt.fk_user'=>"TaskTimeUser",'ptt.note'=>"TaskTimeNote")); - $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('ptt.rowid'=>'task_time','ptt.task_date'=>'task_time','ptt.task_duration'=>"task_time",'ptt.fk_user'=>"task_time",'ptt.note'=>"task_time")); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('ptt.rowid'=>'IdTaskTime', 'ptt.task_date'=>'TaskTimeDate', 'ptt.task_duration'=>"TimesSpent", 'ptt.fk_user'=>"TaskTimeUser", 'ptt.note'=>"TaskTimeNote")); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('ptt.rowid'=>'task_time', 'ptt.task_date'=>'task_time', 'ptt.task_duration'=>"task_time", 'ptt.fk_user'=>"task_time", 'ptt.note'=>"task_time")); if (empty($conf->global->PROJECT_HIDE_TASKS)) { - $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('f.ref'=>"Billed")); - $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('f.ref'=>"task_time")); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('f.ref'=>"Billed")); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('f.ref'=>"task_time")); } - $this->export_sql_start[$r]='SELECT DISTINCT '; - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'projet as p'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet_extrafields as extra ON p.rowid = extra.fk_object'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_lead_status as cls ON p.fk_opp_status = cls.rowid'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task as pt ON p.rowid = pt.fk_projet"; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet_task_extrafields as extra2 ON pt.rowid = extra2.fk_object'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task_time as ptt ON pt.rowid = ptt.fk_task"; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON p.fk_soc = s.rowid'; + $this->export_sql_start[$r] = 'SELECT DISTINCT '; + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'projet as p'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet_extrafields as extra ON p.rowid = extra.fk_object'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_lead_status as cls ON p.fk_opp_status = cls.rowid'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX."projet_task as pt ON p.rowid = pt.fk_projet"; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet_task_extrafields as extra2 ON pt.rowid = extra2.fk_object'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX."projet_task_time as ptt ON pt.rowid = ptt.fk_task"; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON p.fk_soc = s.rowid'; if (empty($conf->global->PROJECT_HIDE_TASKS)) { - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture as f ON ptt.invoice_id = f.rowid'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture as f ON ptt.invoice_id = f.rowid'; } - $this->export_sql_end[$r] .=" WHERE p.entity IN (".getEntity('project').")"; + $this->export_sql_end[$r] .= " WHERE p.entity IN (".getEntity('project').")"; // Import list of tasks if (empty($conf->global->PROJECT_HIDE_TASKS)) { $r++; - $this->import_code[$r]='tasksofprojects'; - $this->import_label[$r]='ImportDatasetTasks'; - $this->import_icon[$r]='task'; - $this->import_entities_array[$r]=array('t.fk_projet'=>'project'); // We define here only fields that use another icon that the one defined into import_icon - $this->import_tables_array[$r]=array('t'=>MAIN_DB_PREFIX.'projet_task','extra'=>MAIN_DB_PREFIX.'projet_task_extrafields'); // List of tables to insert into (insert done in same order) - $this->import_fields_array[$r]=array('t.fk_projet'=>'ProjectRef*','t.ref'=>'RefTask*','t.label'=>'LabelTask*','t.dateo'=>"DateStart",'t.datee'=>"DateEnd",'t.planned_workload'=>"PlannedWorkload",'t.progress'=>"Progress",'t.note_private'=>"NotePrivate",'t.note_public'=>"NotePublic",'t.datec'=>"DateCreation"); + $this->import_code[$r] = 'tasksofprojects'; + $this->import_label[$r] = 'ImportDatasetTasks'; + $this->import_icon[$r] = 'task'; + $this->import_entities_array[$r] = array('t.fk_projet'=>'project'); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r] = array('t'=>MAIN_DB_PREFIX.'projet_task', 'extra'=>MAIN_DB_PREFIX.'projet_task_extrafields'); // List of tables to insert into (insert done in same order) + $this->import_fields_array[$r] = array('t.fk_projet'=>'ProjectRef*', 't.ref'=>'RefTask*', 't.label'=>'LabelTask*', 't.dateo'=>"DateStart", 't.datee'=>"DateEnd", 't.planned_workload'=>"PlannedWorkload", 't.progress'=>"Progress", 't.note_private'=>"NotePrivate", 't.note_public'=>"NotePublic", 't.datec'=>"DateCreation"); // Add extra fields - $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'projet_task' AND entity IN (0,".$conf->entity.")"; - $resql=$this->db->query($sql); + $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'projet_task' AND entity IN (0,".$conf->entity.")"; + $resql = $this->db->query($sql); if ($resql) // This can fail when class is used on old database (during migration for example) { - while ($obj=$this->db->fetch_object($resql)) + while ($obj = $this->db->fetch_object($resql)) { - $fieldname='extra.'.$obj->name; - $fieldlabel=ucfirst($obj->label); - $this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':''); + $fieldname = 'extra.'.$obj->name; + $fieldlabel = ucfirst($obj->label); + $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : ''); } } // End add extra fields - $this->import_fieldshidden_array[$r]=array('t.fk_user_creat'=>'user->id','extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'projet_task'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) - $this->import_convertvalue_array[$r]=array( - 't.fk_projet'=>array('rule'=>'fetchidfromref','classfile'=>'/projet/class/project.class.php','class'=>'Project','method'=>'fetch','element'=>'Project'), + $this->import_fieldshidden_array[$r] = array('t.fk_user_creat'=>'user->id', 'extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'projet_task'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) + $this->import_convertvalue_array[$r] = array( + 't.fk_projet'=>array('rule'=>'fetchidfromref', 'classfile'=>'/projet/class/project.class.php', 'class'=>'Project', 'method'=>'fetch', 'element'=>'Project'), 't.ref'=>array('rule'=>'getrefifauto') ); //$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t'); - $this->import_regex_array[$r]=array('t.dateo'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','t.datee'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','t.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$'); - $this->import_examplevalues_array[$r]=array('t.fk_projet'=>'MyProjectRef','t.ref'=>"auto or TK2010-1234",'t.label'=>"My task",'t.progress'=>"0 (not started) to 100 (finished)",'t.datec'=>'1972-10-10','t.note_private'=>"My private note",'t.note_public'=>"My public note"); + $this->import_regex_array[$r] = array('t.dateo'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$', 't.datee'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$', 't.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$'); + $this->import_examplevalues_array[$r] = array('t.fk_projet'=>'MyProjectRef', 't.ref'=>"auto or TK2010-1234", 't.label'=>"My task", 't.progress'=>"0 (not started) to 100 (finished)", 't.datec'=>'1972-10-10', 't.note_private'=>"My private note", 't.note_public'=>"My public note"); } } @@ -327,54 +327,54 @@ class modProjet extends DolibarrModules */ public function init($options = '') { - global $conf,$langs; + global $conf, $langs; // Permissions $this->remove($options); //ODT template for project - $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/projects/template_project.odt'; - $dirodt=DOL_DATA_ROOT.'/doctemplates/projects'; - $dest=$dirodt.'/template_project.odt'; + $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/projects/template_project.odt'; + $dirodt = DOL_DATA_ROOT.'/doctemplates/projects'; + $dest = $dirodt.'/template_project.odt'; - if (file_exists($src) && ! file_exists($dest)) + if (file_exists($src) && !file_exists($dest)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; dol_mkdir($dirodt); - $result=dol_copy($src, $dest, 0, 0); + $result = dol_copy($src, $dest, 0, 0); if ($result < 0) { $langs->load("errors"); - $this->error=$langs->trans('ErrorFailToCopyFile', $src, $dest); + $this->error = $langs->trans('ErrorFailToCopyFile', $src, $dest); return 0; } } //ODT template for tasks - $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/tasks/template_task_summary.odt'; - $dirodt=DOL_DATA_ROOT.'/doctemplates/tasks'; - $dest=$dirodt.'/template_task_summary.odt'; + $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/tasks/template_task_summary.odt'; + $dirodt = DOL_DATA_ROOT.'/doctemplates/tasks'; + $dest = $dirodt.'/template_task_summary.odt'; - if (file_exists($src) && ! file_exists($dest)) + if (file_exists($src) && !file_exists($dest)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; dol_mkdir($dirodt); - $result=dol_copy($src, $dest, 0, 0); + $result = dol_copy($src, $dest, 0, 0); if ($result < 0) { $langs->load("errors"); - $this->error=$langs->trans('ErrorFailToCopyFile', $src, $dest); + $this->error = $langs->trans('ErrorFailToCopyFile', $src, $dest); return 0; } } $sql = array(); - $sql[] ="DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[3][2])."' AND type = 'task' AND entity = ".$conf->entity; - $sql[] ="INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[3][2])."','task',".$conf->entity.")"; - $sql[] ="DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'beluga' AND type = 'project' AND entity = ".$conf->entity; - $sql[] ="INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('beluga','project',".$conf->entity.")"; - $sql[] ="DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'baleine' AND type = 'project' AND entity = ".$conf->entity; - $sql[] ="INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('baleine','project',".$conf->entity.")"; + $sql[] = "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[3][2])."' AND type = 'task' AND entity = ".$conf->entity; + $sql[] = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[3][2])."','task',".$conf->entity.")"; + $sql[] = "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'beluga' AND type = 'project' AND entity = ".$conf->entity; + $sql[] = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('beluga','project',".$conf->entity.")"; + $sql[] = "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'baleine' AND type = 'project' AND entity = ".$conf->entity; + $sql[] = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('baleine','project',".$conf->entity.")"; return $this->_init($sql, $options); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 3810ad67237..0167d900b3f 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -502,7 +502,7 @@ class pdf_azur extends ModelePDFPropales $curY = $tab_top_newpage; // Allows data in the first page if description is long enough to break in multiples pages - if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; else $showpricebeforepagebreak = 0; @@ -548,7 +548,7 @@ class pdf_azur extends ModelePDFPropales // We found a page break // Allows data in the first page if description is long enough to break in multiples pages - if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; else $showpricebeforepagebreak = 0; @@ -1101,28 +1101,28 @@ class pdf_azur extends ModelePDFPropales //Local tax 1 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach ($this->localtax1 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('1','3','5'))) continue; + if (in_array((string) $localtax_type, array('1', '3', '5'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + foreach ($localtax_rate as $tvakey => $tvaval) { - if ($tvakey!=0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); @@ -1133,13 +1133,13 @@ class pdf_azur extends ModelePDFPropales //Local tax 2 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach ($this->localtax2 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('1','3','5'))) continue; + if (in_array((string) $localtax_type, array('1', '3', '5'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + foreach ($localtax_rate as $tvakey => $tvaval) { - if ($tvakey!=0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -1148,15 +1148,15 @@ class pdf_azur extends ModelePDFPropales $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); @@ -1192,11 +1192,11 @@ class pdf_azur extends ModelePDFPropales //Local tax 1 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach ($this->localtax1 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; + if (in_array((string) $localtax_type, array('2', '4', '6'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + foreach ($localtax_rate as $tvakey => $tvaval) { if ($tvakey != 0) // On affiche pas taux 0 { @@ -1205,16 +1205,16 @@ class pdf_azur extends ModelePDFPropales $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } @@ -1224,11 +1224,11 @@ class pdf_azur extends ModelePDFPropales //Local tax 2 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach ($this->localtax2 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; + if (in_array((string) $localtax_type, array('2', '4', '6'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + foreach ($localtax_rate as $tvakey => $tvaval) { // retrieve global local tax if ($tvakey != 0) // On affiche pas taux 0 @@ -1238,16 +1238,16 @@ class pdf_azur extends ModelePDFPropales $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); @@ -1476,7 +1476,7 @@ class pdf_azur extends ModelePDFPropales if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; - if (! empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; @@ -1528,27 +1528,27 @@ class pdf_azur extends ModelePDFPropales $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); } - if (! empty($conf->global->PDF_SHOW_PROJECT_TITLE)) + if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) { $object->fetch_projet(); - if (! empty($object->project->ref)) + if (!empty($object->project->ref)) { - $posy+=3; + $posy += 3; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->title)?'':$object->projet->title), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->projet->title), '', 'R'); } } - if (! empty($conf->global->PDF_SHOW_PROJECT)) + if (!empty($conf->global->PDF_SHOW_PROJECT)) { $object->fetch_projet(); - if (! empty($object->project->ref)) + if (!empty($object->project->ref)) { - $posy+=3; + $posy += 3; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R'); } } diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 07ceb461803..cbbf462b446 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -594,7 +594,7 @@ class pdf_cyan extends ModelePDFPropales $curY = $tab_top_newpage; // Allows data in the first page if description is long enough to break in multiples pages - if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; else $showpricebeforepagebreak = 0; @@ -640,7 +640,7 @@ class pdf_cyan extends ModelePDFPropales { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages - if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; else $showpricebeforepagebreak = 0; @@ -1588,27 +1588,27 @@ class pdf_cyan extends ModelePDFPropales $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); } - if (! empty($conf->global->PDF_SHOW_PROJECT_TITLE)) + if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) { $object->fetch_projet(); - if (! empty($object->project->ref)) + if (!empty($object->project->ref)) { - $posy+=3; + $posy += 3; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->title)?'':$object->projet->title), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->projet->title), '', 'R'); } } - if (! empty($conf->global->PDF_SHOW_PROJECT)) + if (!empty($conf->global->PDF_SHOW_PROJECT)) { $object->fetch_projet(); - if (! empty($object->project->ref)) + if (!empty($object->project->ref)) { - $posy+=3; + $posy += 3; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R'); } } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 6ca038a8a3d..bed02b94d55 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -185,7 +185,7 @@ class CommandeFournisseur extends CommonOrder - public $fields=array( + public $fields = array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15), 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20), @@ -455,11 +455,11 @@ class CommandeFournisseur extends CommonOrder $sql .= " l.date_start, l.date_end,"; $sql .= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc'; if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) - $sql.= ", pfp.rowid as fk_pfp, pfp.packaging"; + $sql .= ", pfp.rowid as fk_pfp, pfp.packaging"; $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l"; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid'; if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON l.fk_product = pfp.fk_product and l.ref = pfp.ref_fourn"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON l.fk_product = pfp.fk_product and l.ref = pfp.ref_fourn"; $sql .= " WHERE l.fk_commande = ".$this->id; if ($only_product) $sql .= ' AND p.fk_product_type = 0'; $sql .= " ORDER BY l.rang, l.rowid"; @@ -516,7 +516,7 @@ class CommandeFournisseur extends CommonOrder $line->packaging = $objp->packaging; } - $line->date_start = $this->db->jdate($objp->date_start); + $line->date_start = $this->db->jdate($objp->date_start); $line->date_end = $this->db->jdate($objp->date_end); $line->fk_unit = $objp->fk_unit; @@ -1701,7 +1701,7 @@ class CommandeFournisseur extends CommonOrder if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { $prod = new Product($this->db, $fk_product); - $prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', ($this->fk_soc?$this->fk_soc:$this->socid)); + $prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', ($this->fk_soc ? $this->fk_soc : $this->socid)); if ($qty < $prod->packaging) { $qty = $prod->packaging; @@ -1710,7 +1710,7 @@ class CommandeFournisseur extends CommonOrder { if (($qty % $prod->packaging) > 0) { - $coeff = intval($qty/$prod->packaging) + 1; + $coeff = intval($qty / $prod->packaging) + 1; $qty = $prod->packaging * $coeff; setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs'); } @@ -2679,7 +2679,7 @@ class CommandeFournisseur extends CommonOrder { if (($qty % $this->line->packaging) > 0) { - $coeff = intval($qty/$this->line->packaging) + 1; + $coeff = intval($qty / $this->line->packaging) + 1; $qty = $this->line->packaging * $coeff; setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs'); } @@ -3451,11 +3451,11 @@ class CommandeFournisseurLigne extends CommonOrderLine $sql .= ' cd.date_start, cd.date_end, cd.fk_unit,'; $sql .= ' cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc'; if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) - $sql.= ", pfp.rowid as fk_pfp, pfp.packaging"; + $sql .= ", pfp.rowid as fk_pfp, pfp.packaging"; $sql .= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid'; if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON cd.fk_product = pfp.fk_product and cd.ref = pfp.ref_fourn"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON cd.fk_product = pfp.fk_product and cd.ref = pfp.ref_fourn"; $sql .= ' WHERE cd.rowid = '.$rowid; $result = $this->db->query($sql); if ($result) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index a0cf142a23b..6178bc5ae3c 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -218,7 +218,7 @@ class FactureFournisseur extends CommonInvoice public $fk_facture_source; - public $fields=array( + public $fields = array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), 'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>15), 'ref_supplier' =>array('type'=>'varchar(255)', 'label'=>'RefSupplier', 'enabled'=>1, 'visible'=>-1, 'position'=>20), @@ -2287,7 +2287,7 @@ class FactureFournisseur extends CommonInvoice if ($facturestatic->hasDelay()) { $response->nbtodolate++; - $response->url_late=DOL_URL_ROOT.'/fourn/facture/list.php?option=late&mainmenu=billing&leftmenu=suppliers_bills'; + $response->url_late = DOL_URL_ROOT.'/fourn/facture/list.php?option=late&mainmenu=billing&leftmenu=suppliers_bills'; } } $this->db->free($resql); diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 6c139d73707..332e33ece59 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -360,7 +360,7 @@ class ProductFournisseur extends Product $sql .= " supplier_reputation = ".(empty($supplier_reputation) ? 'NULL' : "'".$this->db->escape($supplier_reputation)."'").","; $sql .= " barcode = ".(empty($barcode) ? 'NULL' : "'".$this->db->escape($barcode)."'").","; $sql .= " fk_barcode_type = ".(empty($fk_barcode_type) ? 'NULL' : "'".$this->db->escape($fk_barcode_type)."'"); - if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", packaging = ".(empty($packaging) ? 1 : $packaging); + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", packaging = ".(empty($packaging) ? 1 : $packaging); $sql .= " WHERE rowid = ".$this->product_fourn_price_id; // TODO Add price_base_type and price_ttc @@ -410,7 +410,7 @@ class ProductFournisseur extends Product $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price("; $sql .= " multicurrency_price, multicurrency_unitprice, multicurrency_tx, fk_multicurrency, multicurrency_code,"; $sql .= "datec, fk_product, fk_soc, ref_fourn, desc_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, fk_availability, default_vat_code, info_bits, entity, delivery_time_days, supplier_reputation, barcode, fk_barcode_type)"; - if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", packaging"; + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", packaging"; $sql .= " values("; $sql .= (isset($multicurrency_buyprice) ? "'".$this->db->escape(price2num($multicurrency_buyprice))."'" : 'null').","; $sql .= (isset($multicurrency_unitBuyPrice) ? "'".$this->db->escape(price2num($multicurrency_unitBuyPrice))."'" : 'null').","; @@ -438,14 +438,14 @@ class ProductFournisseur extends Product $sql .= (empty($supplier_reputation) ? 'NULL' : "'".$this->db->escape($supplier_reputation)."'").","; $sql .= (empty($barcode) ? 'NULL' : "'".$this->db->escape($barcode)."'").","; $sql .= (empty($fk_barcode_type) ? 'NULL' : "'".$this->db->escape($fk_barcode_type)."'"); - if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", ".(empty($this->packaging) ? 1 : $this->db->escape($this->packaging)) ; + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", ".(empty($this->packaging) ? 1 : $this->db->escape($this->packaging)); $sql .= ")"; $this->product_fourn_price_id = 0; $resql = $this->db->query($sql); if ($resql) { - $this->product_fourn_price_id = $this->db->last_insert_id(MAIN_DB_PREFIX . "product_fournisseur_price"); + $this->product_fourn_price_id = $this->db->last_insert_id(MAIN_DB_PREFIX."product_fournisseur_price"); } else { $error++; @@ -505,7 +505,7 @@ class ProductFournisseur extends Product $sql .= " pfp.supplier_reputation, pfp.fk_user, pfp.datec,"; $sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code,"; $sql .= " pfp.barcode, pfp.fk_barcode_type"; - if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", pfp.packaging"; + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", pfp.packaging"; $sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql .= " WHERE pfp.rowid = ".(int) $rowid; @@ -609,7 +609,7 @@ class ProductFournisseur extends Product $sql .= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.info_bits, pfp.delivery_time_days, pfp.supplier_reputation,"; $sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code, pfp.datec, pfp.tms,"; $sql .= " pfp.barcode, pfp.fk_barcode_type"; - if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", pfp.packaging"; + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", pfp.packaging"; $sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp, ".MAIN_DB_PREFIX."societe as s"; $sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")"; $sql .= " AND pfp.fk_soc = s.rowid"; diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index b6720a93e57..45abd70e0be 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -166,7 +166,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as cf"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE cf.fk_soc = s.rowid"; -$sql.= " AND cf.entity IN (".getEntity("supplier_order").")"; // Thirdparty sharing is mandatory with supplier order sharing +$sql .= " AND cf.entity IN (".getEntity("supplier_order").")"; // Thirdparty sharing is mandatory with supplier order sharing if ($user->socid) $sql .= ' AND cf.fk_soc = '.$user->socid; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; $sql .= " GROUP BY cf.fk_statut"; @@ -253,23 +253,23 @@ if (!empty($conf->fournisseur->enabled)) */ $sql = "SELECT"; -if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { +if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { $sql .= " DISTINCT"; } -$sql.= " u.rowid, u.lastname, u.firstname, u.email, u.statut"; -$sql.= " FROM ".MAIN_DB_PREFIX."user as u"; -if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) +$sql .= " u.rowid, u.lastname, u.firstname, u.email, u.statut"; +$sql .= " FROM ".MAIN_DB_PREFIX."user as u"; +if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { - $sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug"; - $sql.= " WHERE ((ug.fk_user = u.rowid"; - $sql.= " AND ug.entity IN (".getEntity('usergroup')."))"; - $sql.= " OR u.entity = 0)"; // Show always superadmin + $sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug"; + $sql .= " WHERE ((ug.fk_user = u.rowid"; + $sql .= " AND ug.entity IN (".getEntity('usergroup')."))"; + $sql .= " OR u.entity = 0)"; // Show always superadmin } else { - $sql.= " WHERE (u.entity IN (".getEntity('user').")"; + $sql .= " WHERE (u.entity IN (".getEntity('user').")"; } -$sql.= " AND u.fk_soc IS NULL"; // An external user can not approved +$sql .= " AND u.fk_soc IS NULL"; // An external user can not approved $resql = $db->query($sql); if ($resql) @@ -290,7 +290,7 @@ if ($resql) $userstatic->id = $obj->rowid; $userstatic->getrights('fournisseur'); - if (! empty($userstatic->rights->fournisseur->commande->approuver)) + if (!empty($userstatic->rights->fournisseur->commande->approuver)) { print ''; print ''; diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index b93b239ef72..1b6f8257977 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -301,8 +301,8 @@ if (empty($reshook)) $paiement->num_payment = GETPOST('num_paiement', 'alpha'); $paiement->note_private = GETPOST('comment', 'alpha'); - $paiement->num_paiement = $paiement->num_payment; // For bacward compatibility - $paiement->note = $paiement->note_private; // For bacward compatibility + $paiement->num_paiement = $paiement->num_payment; // For bacward compatibility + $paiement->note = $paiement->note_private; // For bacward compatibility if (!$error) { diff --git a/htdocs/modulebuilder/template/mymoduleindex.php b/htdocs/modulebuilder/template/mymoduleindex.php index fe2f932c129..2d9bdf2f1e6 100644 --- a/htdocs/modulebuilder/template/mymoduleindex.php +++ b/htdocs/modulebuilder/template/mymoduleindex.php @@ -25,39 +25,39 @@ */ // Load Dolibarr environment -$res=0; +$res = 0; // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; -while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } -if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; -if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; +$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; +while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } +if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; +if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; // Try main.inc.php using relative path -if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php"; -if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; -if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; -if (! $res) die("Include of main fails"); +if (!$res && file_exists("../main.inc.php")) $res = @include "../main.inc.php"; +if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; +if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; +if (!$res) die("Include of main fails"); require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; // Load translation files required by the page $langs->loadLangs(array("mymodule@mymodule")); -$action=GETPOST('action', 'alpha'); +$action = GETPOST('action', 'alpha'); // Security check //if (! $user->rights->mymodule->myobject->read) accessforbidden(); -$socid=GETPOST('socid', 'int'); +$socid = GETPOST('socid', 'int'); if (isset($user->socid) && $user->socid > 0) { $action = ''; $socid = $user->socid; } -$max=5; -$now=dol_now(); +$max = 5; +$now = dol_now(); /* @@ -164,8 +164,8 @@ END MODULEBUILDER DRAFT MYOBJECT */ print '
'; -$NBMAX=3; -$max=3; +$NBMAX = 3; +$max = 3; /* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT // Last modified myobject diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 6de52586763..d7f4384c5cd 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -624,7 +624,7 @@ class Mo extends CommonObject $moline->role = 'toproduce'; $moline->position = 1; - $resultline = $moline->create($user, false); // Never use triggers here + $resultline = $moline->create($user, false); // Never use triggers here if ($resultline <= 0) { $error++; $this->error = $moline->error; @@ -639,14 +639,14 @@ class Mo extends CommonObject if ($bom->id > 0) { // Lines to consume - if (! $error) { + if (!$error) { foreach ($bom->lines as $line) { $moline = new MoLine($this->db); $moline->fk_mo = $this->id; if ($line->qty_frozen) { - $moline->qty = $line->qty; // Qty to consume does not depends on quantity to produce + $moline->qty = $line->qty; // Qty to consume does not depends on quantity to produce } else { $moline->qty = round($line->qty * $this->qty / $bom->efficiency, 2); } @@ -662,7 +662,7 @@ class Mo extends CommonObject $moline->qty_frozen = $line->qty_frozen; $moline->disable_stock_change = $line->disable_stock_change; - $resultline = $moline->create($user, false); // Never use triggers here + $resultline = $moline->create($user, false); // Never use triggers here if ($resultline <= 0) { $error++; $this->error = $moline->error; diff --git a/htdocs/mrp/mo_movements.php b/htdocs/mrp/mo_movements.php index ace336b7d29..82742868c9c 100644 --- a/htdocs/mrp/mo_movements.php +++ b/htdocs/mrp/mo_movements.php @@ -670,57 +670,57 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print "\n"; print ''; - if (! empty($arrayfields['m.rowid']['checked'])) + if (!empty($arrayfields['m.rowid']['checked'])) print_liste_field_titre($arrayfields['m.rowid']['label'], $_SERVER["PHP_SELF"], 'm.rowid', '', $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['m.datem']['checked'])) + if (!empty($arrayfields['m.datem']['checked'])) print_liste_field_titre($arrayfields['m.datem']['label'], $_SERVER["PHP_SELF"], 'm.datem', '', $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['p.ref']['checked'])) + if (!empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['p.label']['checked'])) + if (!empty($arrayfields['p.label']['checked'])) print_liste_field_titre($arrayfields['p.label']['label'], $_SERVER["PHP_SELF"], 'p.label', '', $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['m.batch']['checked'])) + if (!empty($arrayfields['m.batch']['checked'])) print_liste_field_titre($arrayfields['m.batch']['label'], $_SERVER["PHP_SELF"], 'm.batch', '', $param, '', $sortfield, $sortorder, 'center '); - if (! empty($arrayfields['pl.eatby']['checked'])) + if (!empty($arrayfields['pl.eatby']['checked'])) print_liste_field_titre($arrayfields['pl.eatby']['label'], $_SERVER["PHP_SELF"], 'pl.eatby', '', $param, '', $sortfield, $sortorder, 'center '); - if (! empty($arrayfields['pl.sellby']['checked'])) + if (!empty($arrayfields['pl.sellby']['checked'])) print_liste_field_titre($arrayfields['pl.sellby']['label'], $_SERVER["PHP_SELF"], 'pl.sellby', '', $param, '', $sortfield, $sortorder, 'center '); - if (! empty($arrayfields['e.ref']['checked'])) { + if (!empty($arrayfields['e.ref']['checked'])) { // We are on a specific warehouse card, no filter on other should be possible print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", "", $param, "", $sortfield, $sortorder); } - if (! empty($arrayfields['m.fk_user_author']['checked'])) + if (!empty($arrayfields['m.fk_user_author']['checked'])) print_liste_field_titre($arrayfields['m.fk_user_author']['label'], $_SERVER["PHP_SELF"], "m.fk_user_author", "", $param, "", $sortfield, $sortorder); - if (! empty($arrayfields['m.inventorycode']['checked'])) + if (!empty($arrayfields['m.inventorycode']['checked'])) print_liste_field_titre($arrayfields['m.inventorycode']['label'], $_SERVER["PHP_SELF"], "m.inventorycode", "", $param, "", $sortfield, $sortorder); - if (! empty($arrayfields['m.label']['checked'])) + if (!empty($arrayfields['m.label']['checked'])) print_liste_field_titre($arrayfields['m.label']['label'], $_SERVER["PHP_SELF"], "m.label", "", $param, "", $sortfield, $sortorder); - if (! empty($arrayfields['m.type_mouvement']['checked'])) + if (!empty($arrayfields['m.type_mouvement']['checked'])) print_liste_field_titre($arrayfields['m.type_mouvement']['label'], $_SERVER["PHP_SELF"], "m.type_mouvement", "", $param, '', $sortfield, $sortorder, 'center '); - if (! empty($arrayfields['origin']['checked'])) + if (!empty($arrayfields['origin']['checked'])) print_liste_field_titre($arrayfields['origin']['label'], $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder); - if (! empty($arrayfields['m.value']['checked'])) + if (!empty($arrayfields['m.value']['checked'])) print_liste_field_titre($arrayfields['m.value']['label'], $_SERVER["PHP_SELF"], "m.value", "", $param, '', $sortfield, $sortorder, 'right '); - if (! empty($arrayfields['m.price']['checked'])) + if (!empty($arrayfields['m.price']['checked'])) print_liste_field_titre($arrayfields['m.price']['label'], $_SERVER["PHP_SELF"], "m.price", "", $param, '', $sortfield, $sortorder, 'right '); // Extra fields - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_title.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields - $parameters = array('arrayfields' => $arrayfields,'param' => $param,'sortfield' => $sortfield,'sortorder' => $sortorder); + $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 print $hookmanager->resPrint; - if (! empty($arrayfields['m.datec']['checked'])) { + if (!empty($arrayfields['m.datec']['checked'])) { print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); } - if (! empty($arrayfields['m.tms']['checked'])) { + if (!empty($arrayfields['m.tms']['checked'])) { print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); } print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; $resql = $db->query($sql); - if (! $resql) { + if (!$resql) { dol_print_error($db); } $num = $db->num_rows($resql); @@ -752,7 +752,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $warehousestatic->label = $objp->warehouse_ref; $warehousestatic->lieu = $objp->lieu; - if (! empty($objp->fk_origin)) { + if (!empty($objp->fk_origin)) { $origin = $objectlist->get_origin($objp->fk_origin, $objp->origintype); } else { $origin = ''; @@ -760,21 +760,21 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; // Id movement - if (! empty($arrayfields['m.rowid']['checked'])) { + if (!empty($arrayfields['m.rowid']['checked'])) { // This is primary not movement id - print '' . $objp->mid . ''; + print ''.$objp->mid.''; } - if (! empty($arrayfields['m.datem']['checked'])) { + if (!empty($arrayfields['m.datem']['checked'])) { // Date - print '' . dol_print_date($db->jdate($objp->datem), 'dayhour') . ''; + print ''.dol_print_date($db->jdate($objp->datem), 'dayhour').''; } - if (! empty($arrayfields['p.ref']['checked'])) { + if (!empty($arrayfields['p.ref']['checked'])) { // Product ref print ''; print $productstatic->getNomUrl(1, 'stock', 16); print "\n"; } - if (! empty($arrayfields['p.label']['checked'])) { + if (!empty($arrayfields['p.label']['checked'])) { // Product label print ''; /* @@ -786,7 +786,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print $productstatic->label; print "\n"; } - if (! empty($arrayfields['m.batch']['checked'])) { + if (!empty($arrayfields['m.batch']['checked'])) { print ''; if ($productlot->id > 0) print $productlot->getNomUrl(1); @@ -794,25 +794,25 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print $productlot->batch; // the id may not be defined if movement was entered when lot was not saved or if lot was removed after movement. print ''; } - if (! empty($arrayfields['pl.eatby']['checked'])) { - print '' . dol_print_date($objp->eatby, 'day') . ''; + if (!empty($arrayfields['pl.eatby']['checked'])) { + print ''.dol_print_date($objp->eatby, 'day').''; } - if (! empty($arrayfields['pl.sellby']['checked'])) { - print '' . dol_print_date($objp->sellby, 'day') . ''; + if (!empty($arrayfields['pl.sellby']['checked'])) { + print ''.dol_print_date($objp->sellby, 'day').''; } // Warehouse - if (! empty($arrayfields['e.ref']['checked'])) { + if (!empty($arrayfields['e.ref']['checked'])) { print ''; print $warehousestatic->getNomUrl(1); print "\n"; } // Author - if (! empty($arrayfields['m.fk_user_author']['checked'])) { + if (!empty($arrayfields['m.fk_user_author']['checked'])) { print ''; - print $userstatic->getNomUrl(- 1); + print $userstatic->getNomUrl(-1); print "\n"; } - if (! empty($arrayfields['m.inventorycode']['checked'])) { + if (!empty($arrayfields['m.inventorycode']['checked'])) { // Inventory code print ''; //print ''; @@ -820,32 +820,32 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea //print ''; print ''; } - if (! empty($arrayfields['m.label']['checked'])) { + if (!empty($arrayfields['m.label']['checked'])) { // Label of movement - print '' . $objp->label . ''; + print ''.$objp->label.''; } - if (! empty($arrayfields['m.type_mouvement']['checked'])) { + if (!empty($arrayfields['m.type_mouvement']['checked'])) { // Type of movement switch ($objp->type_mouvement) { case "0": - print '' . $langs->trans('StockIncreaseAfterCorrectTransfer') . ''; + print ''.$langs->trans('StockIncreaseAfterCorrectTransfer').''; break; case "1": - print '' . $langs->trans('StockDecreaseAfterCorrectTransfer') . ''; + print ''.$langs->trans('StockDecreaseAfterCorrectTransfer').''; break; case "2": - print '' . $langs->trans('StockDecrease') . ''; + print ''.$langs->trans('StockDecrease').''; break; case "3": - print '' . $langs->trans('StockIncrease') . ''; + print ''.$langs->trans('StockIncrease').''; break; } } - if (! empty($arrayfields['origin']['checked'])) { + if (!empty($arrayfields['origin']['checked'])) { // Origin of movement - print '' . $origin . ''; + print ''.$origin.''; } - if (! empty($arrayfields['m.value']['checked'])) { + if (!empty($arrayfields['m.value']['checked'])) { // Qty print ''; if ($objp->qt > 0) @@ -853,7 +853,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print $objp->qty; print ''; } - if (! empty($arrayfields['m.price']['checked'])) { + if (!empty($arrayfields['m.price']['checked'])) { // Price print ''; if ($objp->price != 0) @@ -867,11 +867,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $selected = 0; if (in_array($obj->rowid, $arrayofselected)) $selected = 1; - print ''; + print ''; } print ''; - if (! $i) - $totalarray['nbfield'] ++; + if (!$i) + $totalarray['nbfield']++; print "\n"; $i++; diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index f6866ba26bd..6cf45bf238b 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -167,12 +167,12 @@ if (empty($reshook)) // Line to produce $moline->fk_mo = $object->id; - $moline->qty = GETPOST('qtytoadd', 'int');; + $moline->qty = GETPOST('qtytoadd', 'int'); ; $moline->fk_product = GETPOST('productidtoadd', 'int'); $moline->role = 'toconsume'; $moline->position = 0; - $resultline = $moline->create($user, false); // Never use triggers here + $resultline = $moline->create($user, false); // Never use triggers here if ($resultline <= 0) { $error++; setEventMessages($moline->error, $molines->errors, 'errors'); @@ -546,7 +546,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea dol_fiche_end(); - if (! in_array($action, array('consumeorproduce', 'consumeandproduceall'))) + if (!in_array($action, array('consumeorproduce', 'consumeandproduceall'))) { print '
'; @@ -700,14 +700,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (!empty($object->lines)) { $nblinetoconsume = 0; - foreach($object->lines as $line) { + foreach ($object->lines as $line) { if ($line->role == 'toconsume') { $nblinetoconsume++; } } $nblinetoconsumecursor = 0; - foreach($object->lines as $line) { + foreach ($object->lines as $line) { if ($line->role == 'toconsume') { $nblinetoconsumecursor++; @@ -716,7 +716,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $arrayoflines = $object->fetchLinesLinked('consumed', $line->id); $alreadyconsumed = 0; - foreach($arrayoflines as $line2) { + foreach ($arrayoflines as $line2) { $alreadyconsumed += $line2['qty']; } @@ -756,7 +756,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } print ' '.$alreadyconsumed; print ''; - print ''; // Warehouse + print ''; // Warehouse print ''; if ($conf->productbatch->enabled) { print ''; // Lot @@ -764,7 +764,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; // Show detailed of already consumed with js code to collapse - foreach($arrayoflines as $line2) { + foreach ($arrayoflines as $line2) { print ''; print ''; print dol_print_date($line2['date'], 'dayhour'); @@ -792,7 +792,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print ''.$langs->trans("ToConsume").''; $preselected = (GETPOSTISSET('qty-'.$line->id.'-'.$i) ? GETPOST('qty-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyconsumed)); - if ($action == 'consumeorproduce' && ! GETPOSTISSET('qty-'.$line->id.'-'.$i)) $preselected = 0; + if ($action == 'consumeorproduce' && !GETPOSTISSET('qty-'.$line->id.'-'.$i)) $preselected = 0; print ''; print ''; print ''; @@ -851,14 +851,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (!empty($object->lines)) { $nblinetoproduce = 0; - foreach($object->lines as $line) { + foreach ($object->lines as $line) { if ($line->role == 'toproduce') { $nblinetoproduce++; } } $nblinetoproducecursor = 0; - foreach($object->lines as $line) { + foreach ($object->lines as $line) { if ($line->role == 'toproduce') { $nblinetoproducecursor++; @@ -867,7 +867,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $arrayoflines = $object->fetchLinesLinked('produced', $line->id); $alreadyproduced = 0; - foreach($arrayoflines as $line2) { + foreach ($arrayoflines as $line2) { $alreadyproduced += $line2['qty']; } @@ -894,7 +894,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } print ' '.$alreadyproduced; print ''; - print ''; // Warehouse + print ''; // Warehouse print ''; if ($conf->productbatch->enabled) { print ''; // Lot @@ -902,7 +902,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; // Show detailed of already consumed with js code to collapse - foreach($arrayoflines as $line2) { + foreach ($arrayoflines as $line2) { print ''; print ''; print dol_print_date($line2['date'], 'dayhour'); @@ -928,7 +928,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print ''.$langs->trans("ToProduce").''; $preselected = (GETPOSTISSET('qtytoproduce-'.$line->id.'-'.$i) ? GETPOST('qtytoproduce-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyproduced)); - if ($action == 'consumeorproduce' && ! GETPOSTISSET('qtytoproduce-'.$line->id.'-'.$i)) $preselected = 0; + if ($action == 'consumeorproduce' && !GETPOSTISSET('qtytoproduce-'.$line->id.'-'.$i)) $preselected = 0; print ''; print ''; print ''; diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index d1a4f6bcf6f..f3ef5441144 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -37,31 +37,31 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php'; // Load translation files required by the page -$langs->loadLangs(array("admin","products")); +$langs->loadLangs(array("admin", "products")); // Security check -if (! $user->admin || (empty($conf->product->enabled) && empty($conf->service->enabled))) +if (!$user->admin || (empty($conf->product->enabled) && empty($conf->service->enabled))) accessforbidden(); $action = GETPOST('action', 'alpha'); $value = GETPOST('value', 'alpha'); $label = GETPOST('label', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha'); -$type='product'; +$type = 'product'; // Pricing Rules -$select_pricing_rules=array( - 'PRODUCT_PRICE_UNIQ'=>$langs->trans('PriceCatalogue'), // Unique price - 'PRODUIT_MULTIPRICES'=>$langs->trans('MultiPricesAbility'), // Several prices according to a customer level - 'PRODUIT_CUSTOMER_PRICES'=>$langs->trans('PriceByCustomer'), // Different price for each customer +$select_pricing_rules = array( + 'PRODUCT_PRICE_UNIQ'=>$langs->trans('PriceCatalogue'), // Unique price + 'PRODUIT_MULTIPRICES'=>$langs->trans('MultiPricesAbility'), // Several prices according to a customer level + 'PRODUIT_CUSTOMER_PRICES'=>$langs->trans('PriceByCustomer'), // Different price for each customer ); -$keyforparam='PRODUIT_CUSTOMER_PRICES_BY_QTY'; -if ($conf->global->MAIN_FEATURES_LEVEL >= 1 || ! empty($conf->global->$keyforparam)) $select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY'] = $langs->trans('PriceByQuantity').' ('.$langs->trans("VersionExperimental").')'; // TODO If this is enabled, price must be hidden when price by qty is enabled, also price for quantity must be used when adding product into order/propal/invoice -$keyforparam='PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'; -if ($conf->global->MAIN_FEATURES_LEVEL >= 2 || ! empty($conf->global->$keyforparam)) $select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'] = $langs->trans('MultiPricesAbility') . '+' . $langs->trans('PriceByQuantity').' ('.$langs->trans("VersionExperimental").')'; +$keyforparam = 'PRODUIT_CUSTOMER_PRICES_BY_QTY'; +if ($conf->global->MAIN_FEATURES_LEVEL >= 1 || !empty($conf->global->$keyforparam)) $select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY'] = $langs->trans('PriceByQuantity').' ('.$langs->trans("VersionExperimental").')'; // TODO If this is enabled, price must be hidden when price by qty is enabled, also price for quantity must be used when adding product into order/propal/invoice +$keyforparam = 'PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'; +if ($conf->global->MAIN_FEATURES_LEVEL >= 2 || !empty($conf->global->$keyforparam)) $select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'] = $langs->trans('MultiPricesAbility').'+'.$langs->trans('PriceByQuantity').' ('.$langs->trans("VersionExperimental").')'; // Clean param -if (! empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_MULTIPRICES_LIMIT)) { +if (!empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_MULTIPRICES_LIMIT)) { dolibarr_set_const($db, 'PRODUIT_MULTIPRICES_LIMIT', 5, 'chaine', 0, '', $conf->entity); } @@ -72,7 +72,7 @@ $error = 0; * Actions */ -$nomessageinsetmoduleoptions=1; +$nomessageinsetmoduleoptions = 1; include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if ($action == 'setcodeproduct') @@ -91,12 +91,12 @@ if ($action == 'setcodeproduct') if ($action == 'other' && GETPOST('value_PRODUIT_LIMIT_SIZE') >= 0) { $res = dolibarr_set_const($db, "PRODUIT_LIMIT_SIZE", GETPOST('value_PRODUIT_LIMIT_SIZE'), 'chaine', 0, '', $conf->entity); - if (! $res > 0) $error++; + if (!$res > 0) $error++; } if ($action == 'other' && GETPOST('value_PRODUIT_MULTIPRICES_LIMIT') > 0) { $res = dolibarr_set_const($db, "PRODUIT_MULTIPRICES_LIMIT", GETPOST('value_PRODUIT_MULTIPRICES_LIMIT'), 'chaine', 0, '', $conf->entity); - if (! $res > 0) $error++; + if (!$res > 0) $error++; } if ($action == 'other') { @@ -114,8 +114,8 @@ if ($action == 'other') } else { - $multirule=explode('&', $princingrules); - foreach($multirule as $rulesselected) + $multirule = explode('&', $princingrules); + foreach ($multirule as $rulesselected) { $res = dolibarr_set_const($db, $rulesselected, 1, 'chaine', 0, '', $conf->entity); } @@ -123,7 +123,7 @@ if ($action == 'other') } else // We clear this mode { - if (strpos($rule, '&')===false) { + if (strpos($rule, '&') === false) { $res = dolibarr_set_const($db, $rule, 0, 'chaine', 0, '', $conf->entity); } } @@ -172,20 +172,20 @@ if ($action == 'other') if ($action == 'specimen') // For products { - $modele= GETPOST('module', 'alpha'); + $modele = GETPOST('module', 'alpha'); $product = new Product($db); $product->initAsSpecimen(); // Search template files - $file=''; $classname=''; $filefound=0; - $dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']); - foreach($dirmodels as $reldir) + $file = ''; $classname = ''; $filefound = 0; + $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); + foreach ($dirmodels as $reldir) { - $file=dol_buildpath($reldir."core/modules/product/doc/pdf_".$modele.".modules.php", 0); + $file = dol_buildpath($reldir."core/modules/product/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound=1; + $filefound = 1; $classname = "pdf_".$modele; break; } @@ -255,7 +255,7 @@ if ($action == 'set') $value = GETPOST('value'); if (GETPOST('value', 'alpha')) $res = dolibarr_set_const($db, $const, $value, 'chaine', 0, '', $conf->entity); else $res = dolibarr_del_const($db, $const, $conf->entity); - if (! $res > 0) $error++; + if (!$res > 0) $error++; } //if ($action == 'other') @@ -267,7 +267,7 @@ if ($action == 'set') if ($action) { - if (! $error) + if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } @@ -281,7 +281,7 @@ if ($action) * View */ -$formbarcode=new FormBarCode($db); +$formbarcode = new FormBarCode($db); $title = $langs->trans('ProductServiceSetup'); $tab = $langs->trans("ProductsAndServices"); @@ -298,17 +298,17 @@ elseif (empty($conf->service->enabled)) llxHeader('', $title); -$linkback=''.$langs->trans("BackToModuleList").''; +$linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($title, $linkback, 'title_setup'); $head = product_admin_prepare_head(); dol_fiche_head($head, 'general', $tab, -1, 'product'); -$form=new Form($db); +$form = new Form($db); // Module to manage product / services code -$dirproduct=array('/core/modules/product/'); -$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']); +$dirproduct = array('/core/modules/product/'); +$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); print load_fiche_titre($langs->trans("ProductCodeChecker"), '', ''); @@ -330,16 +330,16 @@ foreach ($dirproduct as $dirroot) if (is_resource($handle)) { // Loop on each module find in opened directory - while (($file = readdir($handle))!==false) + while (($file = readdir($handle)) !== false) { if (substr($file, 0, 16) == 'mod_codeproduct_' && substr($file, -3) == 'php') { - $file = substr($file, 0, dol_strlen($file)-4); + $file = substr($file, 0, dol_strlen($file) - 4); try { dol_include_once($dirroot.$file.'.php'); } - catch(Exception $e) + catch (Exception $e) { dol_syslog($e->getMessage(), LOG_ERR); } @@ -347,7 +347,7 @@ foreach ($dirproduct as $dirroot) $modCodeProduct = new $file; // Show modules according to features level - if ($modCodeProduct->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; + if ($modCodeProduct->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; if ($modCodeProduct->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; $var = !$var; @@ -356,7 +356,7 @@ foreach ($dirproduct as $dirroot) print ''.$modCodeProduct->info($langs).''."\n"; print ''.$modCodeProduct->getExample($langs).''."\n"; - if (! empty($conf->global->PRODUCT_CODEPRODUCT_ADDON) && $conf->global->PRODUCT_CODEPRODUCT_ADDON == $file) + if (!empty($conf->global->PRODUCT_CODEPRODUCT_ADDON) && $conf->global->PRODUCT_CODEPRODUCT_ADDON == $file) { print ''."\n"; print img_picto($langs->trans("Activated"), 'switch_on'); @@ -365,16 +365,16 @@ foreach ($dirproduct as $dirroot) else { $disabled = false; - if (! empty($conf->multicompany->enabled) && (is_object($mc) && ! empty($mc->sharings['referent']) && $mc->sharings['referent'] == $conf->entity) ? false : true); + if (!empty($conf->multicompany->enabled) && (is_object($mc) && !empty($mc->sharings['referent']) && $mc->sharings['referent'] == $conf->entity) ? false : true); print ''; - if (! $disabled) print ''; + if (!$disabled) print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); - if (! $disabled) print ''; + if (!$disabled) print ''; print ''; } print ''; - $s=$modCodeProduct->getToolTip($langs, null, -1); + $s = $modCodeProduct->getToolTip($langs, null, -1); print $form->textwithpicto('', $s, 1); print ''; @@ -389,14 +389,14 @@ print ''; // Module to build doc $def = array(); $sql = "SELECT nom"; -$sql.= " FROM ".MAIN_DB_PREFIX."document_model"; -$sql.= " WHERE type = '".$type."'"; -$sql.= " AND entity = ".$conf->entity; -$resql=$db->query($sql); +$sql .= " FROM ".MAIN_DB_PREFIX."document_model"; +$sql .= " WHERE type = '".$type."'"; +$sql .= " AND entity = ".$conf->entity; +$resql = $db->query($sql); if ($resql) { $i = 0; - $num_rows=$db->num_rows($resql); + $num_rows = $db->num_rows($resql); while ($i < $num_rows) { $array = $db->fetch_array($resql); @@ -427,41 +427,41 @@ clearstatcache(); foreach ($dirmodels as $reldir) { - foreach (array('','/doc') as $valdir) + foreach (array('', '/doc') as $valdir) { $dir = dol_buildpath($reldir."core/modules/product".$valdir); if (is_dir($dir)) { - $handle=opendir($dir); + $handle = opendir($dir); if (is_resource($handle)) { - while (($file = readdir($handle))!==false) + while (($file = readdir($handle)) !== false) { - $filelist[]=$file; + $filelist[] = $file; } closedir($handle); arsort($filelist); - foreach($filelist as $file) + foreach ($filelist as $file) { if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { if (file_exists($dir.'/'.$file)) { - $name = substr($file, 4, dol_strlen($file) -16); - $classname = substr($file, 0, dol_strlen($file) -12); + $name = substr($file, 4, dol_strlen($file) - 16); + $classname = substr($file, 0, dol_strlen($file) - 12); require_once $dir.'/'.$file; $module = new $classname($db); - $modulequalified=1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; + $modulequalified = 1; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0; if ($modulequalified) { print ''; - print (empty($module->name)?$name:$module->name); + print (empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) print $module->info($langs); else print $module->description; @@ -496,15 +496,15 @@ foreach ($dirmodels as $reldir) print ''; // Info - $htmltooltip = ''.$langs->trans("Name").': '.$module->name; - $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); + $htmltooltip = ''.$langs->trans("Name").': '.$module->name; + $htmltooltip .= '
'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown")); if ($module->type == 'pdf') { - $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; + $htmltooltip .= '
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; } - $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; - $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); - $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); + $htmltooltip .= '

'.$langs->trans("FeaturesSupported").':'; + $htmltooltip .= '
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); + $htmltooltip .= '
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); print ''; @@ -561,10 +561,10 @@ print ' '."\n"; */ $rowspan = 4; -if (! empty($conf->global->PRODUIT_MULTIPRICES) || ! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) $rowspan++; +if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) $rowspan++; if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) $rowspan++; -if (! empty($conf->global->MAIN_MULTILANGS)) $rowspan++; -if (! empty($conf->fournisseur->enabled)) $rowspan++; +if (!empty($conf->global->MAIN_MULTILANGS)) $rowspan++; +if (!empty($conf->fournisseur->enabled)) $rowspan++; print ''; @@ -578,10 +578,10 @@ else } print ''; $current_rule = 'PRODUCT_PRICE_UNIQ'; -if (!empty($conf->global->PRODUIT_MULTIPRICES)) $current_rule='PRODUIT_MULTIPRICES'; -if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) $current_rule='PRODUIT_CUSTOMER_PRICES_BY_QTY'; -if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) $current_rule='PRODUIT_CUSTOMER_PRICES'; -if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) $current_rule='PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'; +if (!empty($conf->global->PRODUIT_MULTIPRICES)) $current_rule = 'PRODUIT_MULTIPRICES'; +if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) $current_rule = 'PRODUIT_CUSTOMER_PRICES_BY_QTY'; +if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) $current_rule = 'PRODUIT_CUSTOMER_PRICES'; +if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) $current_rule = 'PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'; print $form->selectarray("princingrule", $select_pricing_rules, $current_rule); print ''; print ''; @@ -590,7 +590,7 @@ print ''; // multiprix nombre de prix a proposer -if (! empty($conf->global->PRODUIT_MULTIPRICES) || ! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) +if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { print ''; print ''.$langs->trans("MultiPricesNumPrices").''; @@ -620,7 +620,7 @@ if (empty($conf->use_javascript_ajax)) else { print ''; - $arrval=array( + $arrval = array( '0'=>$langs->trans("No"), '1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 1).')', '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')', @@ -670,38 +670,38 @@ print ''; */ // View product description in thirdparty language -if (! empty($conf->global->MAIN_MULTILANGS)) +if (!empty($conf->global->MAIN_MULTILANGS)) { print ''; print ''.$langs->trans("ViewProductDescInThirdpartyLanguageAbility").''; print ''; - print $form->selectyesno("activate_viewProdTextsInThirdpartyLanguage", (! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)?$conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE:0), 1); + print $form->selectyesno("activate_viewProdTextsInThirdpartyLanguage", (!empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE) ? $conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE : 0), 1); print ''; print ''; } -if (! empty($conf->fournisseur->enabled)) +if (!empty($conf->fournisseur->enabled)) { print ''; print ''.$langs->trans("UseProductFournDesc").''; print ''; - print $form->selectyesno("activate_useProdFournDesc", (! empty($conf->global->PRODUIT_FOURN_TEXTS)?$conf->global->PRODUIT_FOURN_TEXTS:0), 1); + print $form->selectyesno("activate_useProdFournDesc", (!empty($conf->global->PRODUIT_FOURN_TEXTS) ? $conf->global->PRODUIT_FOURN_TEXTS : 0), 1); print ''; print ''; print ''; print ''.$langs->trans("UseProductSupplierPackaging").''; print ''; - print $form->selectyesno("activate_useProdSupplierPackaging", (! empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)?$conf->global->PRODUCT_USE_SUPPLIER_PACKAGING:0), 1); + print $form->selectyesno("activate_useProdSupplierPackaging", (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING) ? $conf->global->PRODUCT_USE_SUPPLIER_PACKAGING : 0), 1); print ''; print ''; } -if (! empty($conf->global->PRODUCT_CANVAS_ABILITY)) +if (!empty($conf->global->PRODUCT_CANVAS_ABILITY)) { // Add canvas feature - $dir = DOL_DOCUMENT_ROOT . "/product/canvas/"; + $dir = DOL_DOCUMENT_ROOT."/product/canvas/"; print ''; print ''.$langs->trans("ProductSpecial").''."\n"; @@ -710,12 +710,12 @@ if (! empty($conf->global->PRODUCT_CANVAS_ABILITY)) if (is_dir($dir)) { - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; - $handle=opendir($dir); + $handle = opendir($dir); if (is_resource($handle)) { - while (($file = readdir($handle))!==false) + while (($file = readdir($handle)) !== false) { if (file_exists($dir.$file.'/product.'.$file.'.class.php')) { diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 473671fd1a3..bffc941a35c 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1724,7 +1724,7 @@ class Product extends CommonObject $sql .= " pfp.fk_product, pfp.ref_fourn, pfp.desc_fourn, pfp.fk_soc, pfp.tva_tx, pfp.fk_supplier_price_expression"; $sql .= " ,pfp.default_vat_code"; $sql .= " ,pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code"; - if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", pfp.packaging"; + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", pfp.packaging"; $sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql .= " WHERE pfp.rowid = ".$prodfournprice; if ($qty > 0) { $sql .= " AND pfp.quantity <= ".$qty; @@ -1778,7 +1778,7 @@ class Product extends CommonObject $sql .= " pfp.fk_product, pfp.ref_fourn as ref_supplier, pfp.desc_fourn as desc_supplier, pfp.tva_tx, pfp.fk_supplier_price_expression"; $sql .= " ,pfp.default_vat_code"; $sql .= " ,pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code"; - if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", pfp.packaging"; + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", pfp.packaging"; $sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql .= " WHERE pfp.fk_product = ".$product_id; if ($fourn_ref != 'none') { $sql .= " AND pfp.ref_fourn = '".$fourn_ref."'"; diff --git a/htdocs/product/dynamic_price/class/price_parser.class.php b/htdocs/product/dynamic_price/class/price_parser.class.php index 4b0c61073cf..d0eae2f3b17 100644 --- a/htdocs/product/dynamic_price/class/price_parser.class.php +++ b/htdocs/product/dynamic_price/class/price_parser.class.php @@ -181,7 +181,7 @@ class PriceParser //Do processing $res = $entry->process(); //Store any error or clear status if OK - $entry->update_status($res < 1?$entry->error:'', $user); + $entry->update_status($res < 1 ? $entry->error : '', $user); } //Get all global values @@ -216,7 +216,7 @@ class PriceParser { $data = explode($this->special_chr, $expression); $variable = $this->special_chr.$data[1]; - if (isset($data[2])) $variable.= $this->special_chr; + if (isset($data[2])) $variable .= $this->special_chr; $this->error_parser = array(23, array($variable, $expression)); return -6; } @@ -276,7 +276,7 @@ class PriceParser if ($res < 0) { $this->error_parser = array(25, null); return -1; - } elseif($res == 0){ + } elseif ($res == 0) { $supplier_min_price = 0; } else { $supplier_min_price = $productFournisseur->fourn_unitprice; diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index aab0d428191..55d12f26c6c 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -77,7 +77,7 @@ class MouvementStock extends CommonObject public $batch; - public $fields=array( + public $fields = array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10, 'showoncombobox'=>1), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15), 'datem' =>array('type'=>'datetime', 'label'=>'Datem', 'enabled'=>1, 'visible'=>-1, 'position'=>20), @@ -376,8 +376,8 @@ class MouvementStock extends CommonObject if ($movestock && $entrepot_id > 0) // Change stock for current product, change for subproduct is done after { $fk_project = 0; - if(!empty($this->origin)) { // This is set by caller for tracking reason - $origintype = empty($this->origin->origin_type)?$this->origin->element:$this->origin->origin_type; + if (!empty($this->origin)) { // This is set by caller for tracking reason + $origintype = empty($this->origin->origin_type) ? $this->origin->element : $this->origin->origin_type; $fk_origin = $this->origin->id; if ($origintype == 'project') $fk_project = $fk_origin; else @@ -985,7 +985,7 @@ class MouvementStock extends CommonObject $origintype_array = explode('@', $origintype); $classname = ucfirst($origintype_array[0]); $modulename = empty($origintype_array[1]) ? $classname : empty($origintype_array[1]); - $result=dol_include_once('/'.$modulename.'/class/'.strtolower($classname).'.class.php'); + $result = dol_include_once('/'.$modulename.'/class/'.strtolower($classname).'.class.php'); if ($result) { $classname = ucfirst($classname); diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 2ad465bdedb..bd7941e1448 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -160,7 +160,7 @@ if ($action == 'order' && isset($_POST['valid'])) $desc = $productsupplier->description; } $line->desc = $desc; - if (! empty($conf->global->MAIN_MULTILANGS)) + if (!empty($conf->global->MAIN_MULTILANGS)) { // TODO Get desc in language of thirdparty } @@ -362,8 +362,8 @@ $sql .= ', s.fk_product'; if ($usevirtualstock) { - if (! empty($conf->commande->enabled)) { - $sqlCommandesCli = "(SELECT ".$db->ifsql("SUM(cd1.qty) IS NULL", "0", "SUM(cd1.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL + if (!empty($conf->commande->enabled)) { + $sqlCommandesCli = "(SELECT ".$db->ifsql("SUM(cd1.qty) IS NULL", "0", "SUM(cd1.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL $sqlCommandesCli .= " FROM ".MAIN_DB_PREFIX."commandedet as cd1, ".MAIN_DB_PREFIX."commande as c1"; $sqlCommandesCli .= " WHERE c1.rowid = cd1.fk_commande AND c1.entity IN (".getEntity('commande').")"; $sqlCommandesCli .= " AND cd1.fk_product = p.rowid"; @@ -372,8 +372,8 @@ if ($usevirtualstock) $sqlCommandesCli = '0'; } - if (! empty($conf->expedition->enabled)) { - $sqlExpeditionsCli = "(SELECT ".$db->ifsql("SUM(ed2.qty) IS NULL", "0", "SUM(ed2.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL + if (!empty($conf->expedition->enabled)) { + $sqlExpeditionsCli = "(SELECT ".$db->ifsql("SUM(ed2.qty) IS NULL", "0", "SUM(ed2.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL $sqlExpeditionsCli .= " FROM ".MAIN_DB_PREFIX."expedition as e2,"; $sqlExpeditionsCli .= " ".MAIN_DB_PREFIX."expeditiondet as ed2,"; $sqlExpeditionsCli .= " ".MAIN_DB_PREFIX."commandedet as cd2"; @@ -384,8 +384,8 @@ if ($usevirtualstock) $sqlExpeditionsCli = '0'; } - if (! empty($conf->fournisseur->enabled)) { - $sqlCommandesFourn = "(SELECT ".$db->ifsql("SUM(cd3.qty) IS NULL", "0", "SUM(cd3.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL + if (!empty($conf->fournisseur->enabled)) { + $sqlCommandesFourn = "(SELECT ".$db->ifsql("SUM(cd3.qty) IS NULL", "0", "SUM(cd3.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL $sqlCommandesFourn .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd3,"; $sqlCommandesFourn .= " ".MAIN_DB_PREFIX."commande_fournisseur as c3"; $sqlCommandesFourn .= " WHERE c3.rowid = cd3.fk_commande"; @@ -393,7 +393,7 @@ if ($usevirtualstock) $sqlCommandesFourn .= " AND cd3.fk_product = p.rowid"; $sqlCommandesFourn .= " AND c3.fk_statut IN (3,4))"; - $sqlReceptionFourn = "(SELECT ".$db->ifsql("SUM(fd4.qty) IS NULL", "0", "SUM(fd4.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL + $sqlReceptionFourn = "(SELECT ".$db->ifsql("SUM(fd4.qty) IS NULL", "0", "SUM(fd4.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL $sqlReceptionFourn .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf4,"; $sqlReceptionFourn .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as fd4"; $sqlReceptionFourn .= " WHERE fd4.fk_commande = cf4.rowid AND cf4.entity IN (".getEntity('supplier_order').")"; @@ -404,8 +404,8 @@ if ($usevirtualstock) $sqlReceptionFourn = '0'; } - if (! empty($conf->mrp->enabled)) { - $sqlProductionToConsume = "(SELECT GREATEST(0, ".$db->ifsql("SUM(".$db->ifsql("mp5.role = 'toconsume'", 'mp5.qty', '- mp5.qty').") IS NULL", "0", "SUM(".$db->ifsql("mp5.role = 'toconsume'", 'mp5.qty', '- mp5.qty').")").") as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL + if (!empty($conf->mrp->enabled)) { + $sqlProductionToConsume = "(SELECT GREATEST(0, ".$db->ifsql("SUM(".$db->ifsql("mp5.role = 'toconsume'", 'mp5.qty', '- mp5.qty').") IS NULL", "0", "SUM(".$db->ifsql("mp5.role = 'toconsume'", 'mp5.qty', '- mp5.qty').")").") as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL $sqlProductionToConsume .= " FROM ".MAIN_DB_PREFIX."mrp_mo as mm5,"; $sqlProductionToConsume .= " ".MAIN_DB_PREFIX."mrp_production as mp5"; $sqlProductionToConsume .= " WHERE mm5.rowid = mp5.fk_mo AND mm5.entity IN (".getEntity('mo').")"; @@ -413,7 +413,7 @@ if ($usevirtualstock) $sqlProductionToConsume .= " AND mp5.role IN ('toconsume', 'consummed')"; $sqlProductionToConsume .= " AND mm5.status IN (1,2))"; - $sqlProductionToProduce = "(SELECT GREATEST(0, ".$db->ifsql("SUM(".$db->ifsql("mp5.role = 'toproduce'", 'mp5.qty', '- mp5.qty').") IS NULL", "0", "SUM(".$db->ifsql("mp5.role = 'toconsume'", 'mp5.qty', '- mp5.qty').")").") as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL + $sqlProductionToProduce = "(SELECT GREATEST(0, ".$db->ifsql("SUM(".$db->ifsql("mp5.role = 'toproduce'", 'mp5.qty', '- mp5.qty').") IS NULL", "0", "SUM(".$db->ifsql("mp5.role = 'toconsume'", 'mp5.qty', '- mp5.qty').")").") as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL $sqlProductionToProduce .= " FROM ".MAIN_DB_PREFIX."mrp_mo as mm5,"; $sqlProductionToProduce .= " ".MAIN_DB_PREFIX."mrp_production as mp5"; $sqlProductionToProduce .= " WHERE mm5.rowid = mp5.fk_mo AND mm5.entity IN (".getEntity('mo').")"; diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 7baefc6964e..d80c7220866 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -263,8 +263,8 @@ if (empty($reshook)) $object->socid = GETPOST('socid', 'int'); $object->description = GETPOST('description', 'none'); // Do not use 'alpha' here, we want field as it is $object->public = GETPOST('public', 'alpha'); - $object->date_start = (! GETPOST('projectstart')) ? '' : $date_start; - $object->date_end = (! GETPOST('projectend')) ? '' : $date_end; + $object->date_start = (!GETPOST('projectstart')) ? '' : $date_start; + $object->date_end = (!GETPOST('projectend')) ? '' : $date_end; if (GETPOSTISSET('opp_amount')) $object->opp_amount = price2num(GETPOST('opp_amount', 'alpha')); if (GETPOSTISSET('budget_amount')) $object->budget_amount = price2num(GETPOST('budget_amount', 'alpha')); if (GETPOSTISSET('opp_status')) $object->opp_status = $opp_status; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index b7a4c800ee3..f7f7cce75e1 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -131,7 +131,7 @@ $arrayfields = array( 'p.opp_amount'=>array('label'=>$langs->trans("OpportunityAmountShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>103), 'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatusShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>104), 'p.opp_percent'=>array('label'=>$langs->trans("OpportunityProbabilityShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>105), - 'opp_weighted_amount'=>array('label'=>$langs->trans('OpportunityWeightedAmountShort'), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>106), + 'opp_weighted_amount'=>array('label'=>$langs->trans('OpportunityWeightedAmountShort'), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>106), 'p.budget_amount'=>array('label'=>$langs->trans("Budget"), 'checked'=>0, 'position'=>110), 'p.usage_opportunity'=>array('label'=>$langs->trans("UsageOpportunity"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>115), 'p.usage_task'=>array('label'=>$langs->trans("UsageTasks"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_HIDE_TASKS ? 0 : 1), 'position'=>116), @@ -847,16 +847,16 @@ while ($i < min($num, $limit)) $totalarray['val']['p.opp_amount'] += $obj->opp_amount; } print ''; - if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['pos'][$totalarray['nbfield']]='p.opp_amount'; + if (!$i) $totalarray['nbfield']++; + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.opp_amount'; } // Opp percent - if (! empty($arrayfields['p.opp_percent']['checked'])) + if (!empty($arrayfields['p.opp_percent']['checked'])) { print ''; if ($obj->opp_percent) print price($obj->opp_percent, 1, $langs, 1, 0).'%'; print ''; - if (! $i) $totalarray['nbfield']++; + if (!$i) $totalarray['nbfield']++; } // Opp weighted amount if (!empty($arrayfields['opp_weighted_amount']['checked'])) @@ -868,11 +868,11 @@ while ($i < min($num, $limit)) $totalarray['val']['opp_weighted_amount'] += $obj->opp_weighted_amount; } print ''; - if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['pos'][$totalarray['nbfield']] = 'opp_weighted_amount'; + if (!$i) $totalarray['nbfield']++; + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'opp_weighted_amount'; } // Budget - if (! empty($arrayfields['p.budget_amount']['checked'])) + if (!empty($arrayfields['p.budget_amount']['checked'])) { print ''; if ($obj->budget_amount != '') @@ -881,11 +881,11 @@ while ($i < min($num, $limit)) $totalarray['val']['p.budget_amount'] += $obj->budget_amount; } print ''; - if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['pos'][$totalarray['nbfield']]='p.budget_amount'; + if (!$i) $totalarray['nbfield']++; + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.budget_amount'; } // Usage opportunity - if (! empty($arrayfields['p.usage_opportunity']['checked'])) + if (!empty($arrayfields['p.usage_opportunity']['checked'])) { print ''; if ($obj->usage_opportunity) diff --git a/htdocs/public/error-401.php b/htdocs/public/error-401.php index ac921fc9f78..87da7c347e3 100644 --- a/htdocs/public/error-401.php +++ b/htdocs/public/error-401.php @@ -21,7 +21,7 @@ Sorry. You are not allowed to access this resource.
- +
diff --git a/htdocs/public/error-404.php b/htdocs/public/error-404.php index 34a4ac03e9e..baaa26cd833 100644 --- a/htdocs/public/error-404.php +++ b/htdocs/public/error-404.php @@ -21,7 +21,7 @@ You requested a website or a page that does not exists.
- +
diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index 2ae9fd34869..d8efc00f85e 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -74,7 +74,7 @@ class Contacts extends DolibarrApi { throw new RestException(401, 'No permission to read contacts'); } - if ($id ==0) { + if ($id == 0) { $result = $this->contact->initAsSpecimen(); } else { $result = $this->contact->fetch($id); @@ -87,7 +87,7 @@ class Contacts extends DolibarrApi if (!DolibarrApi::_checkAccessToResource('contact', $this->contact->id, 'socpeople&societe')) { - throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } if ($includecount) @@ -134,37 +134,37 @@ class Contacts extends DolibarrApi $search_sale = DolibarrApiAccess::$user->id; $sql = "SELECT t.rowid"; - $sql.= " FROM " . MAIN_DB_PREFIX . "socpeople as t"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX . "socpeople_extrafields as te ON te.fk_object = t.rowid"; + $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as t"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as te ON te.fk_object = t.rowid"; if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) { // We need this table joined to the select in order to filter by sale - $sql.= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } - $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON t.fk_soc = s.rowid"; - $sql.= ' WHERE t.entity IN (' . getEntity('socpeople') . ')'; - if ($socids) $sql.= " AND t.fk_soc IN (" . $socids . ")"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON t.fk_soc = s.rowid"; + $sql .= ' WHERE t.entity IN ('.getEntity('socpeople').')'; + if ($socids) $sql .= " AND t.fk_soc IN (".$socids.")"; if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) - $sql.= " AND t.fk_soc = sc.fk_soc"; + $sql .= " AND t.fk_soc = sc.fk_soc"; if ($search_sale > 0) - $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale + $sql .= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale // Insert sale filter if ($search_sale > 0) { - $sql .= " AND sc.fk_user = " . $search_sale; + $sql .= " AND sc.fk_user = ".$search_sale; } // Add sql filters if ($sqlfilters) { - if (! DolibarrApi::_checkFilters($sqlfilters)) + if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; - $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } - $sql.= $db->order($sortfield, $sortorder); + $sql .= $db->order($sortfield, $sortorder); if ($limit) { @@ -174,7 +174,7 @@ class Contacts extends DolibarrApi } $offset = $limit * $page; - $sql.= $db->plimit($limit + 1, $offset); + $sql .= $db->plimit($limit + 1, $offset); } $result = $db->query($sql); if ($result) @@ -199,7 +199,7 @@ class Contacts extends DolibarrApi } } else { - throw new RestException(503, 'Error when retrieve contacts : ' . $sql); + throw new RestException(503, 'Error when retrieve contacts : '.$sql); } if (!count($obj_ret)) { @@ -255,7 +255,7 @@ class Contacts extends DolibarrApi if (!DolibarrApi::_checkAccessToResource('contact', $this->contact->id, 'socpeople&societe')) { - throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } foreach ($request_data as $field => $value) @@ -290,7 +290,7 @@ class Contacts extends DolibarrApi if (!DolibarrApi::_checkAccessToResource('contact', $this->contact->id, 'socpeople&societe')) { - throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } $this->contact->oldcopy = clone $this->contact; return $this->contact->delete(); @@ -330,7 +330,7 @@ class Contacts extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('contact', $contact->id, 'socpeople&societe')) { - throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } // Check mandatory fields @@ -362,7 +362,7 @@ class Contacts extends DolibarrApi */ public function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { - if (! DolibarrApiAccess::$user->rights->categorie->lire) { + if (!DolibarrApiAccess::$user->rights->categorie->lire) { throw new RestException(401); } @@ -396,24 +396,24 @@ class Contacts extends DolibarrApi */ public function addCategory($id, $category_id) { - if(! DolibarrApiAccess::$user->rights->societe->contact->creer) { + if (!DolibarrApiAccess::$user->rights->societe->contact->creer) { throw new RestException(401, 'Insufficient rights'); } $result = $this->contact->fetch($id); - if (! $result) { + if (!$result) { throw new RestException(404, 'Contact not found'); } $category = new Categorie($this->db); $result = $category->fetch($category_id); - if (! $result) { + if (!$result) { throw new RestException(404, 'category not found'); } - if (! DolibarrApi::_checkAccessToResource('contact', $this->contact->id)) { + if (!DolibarrApi::_checkAccessToResource('contact', $this->contact->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - if (! DolibarrApi::_checkAccessToResource('category', $category->id)) { + if (!DolibarrApi::_checkAccessToResource('category', $category->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } @@ -436,24 +436,24 @@ class Contacts extends DolibarrApi */ public function deleteCategory($id, $category_id) { - if(! DolibarrApiAccess::$user->rights->societe->contact->creer) { + if (!DolibarrApiAccess::$user->rights->societe->contact->creer) { throw new RestException(401, 'Insufficient rights'); } $result = $this->contact->fetch($id); - if( ! $result ) { + if (!$result) { throw new RestException(404, 'Contact not found'); } $category = new Categorie($this->db); $result = $category->fetch($category_id); - if( ! $result ) { + if (!$result) { throw new RestException(404, 'category not found'); } - if( ! DolibarrApi::_checkAccessToResource('contact', $this->contact->id)) { + if (!DolibarrApi::_checkAccessToResource('contact', $this->contact->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - if( ! DolibarrApi::_checkAccessToResource('category', $category->id)) { + if (!DolibarrApi::_checkAccessToResource('category', $category->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index e480d68eca4..9402627e44a 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -236,17 +236,17 @@ if ($action == "change") // Change customer for TakePOS $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' AND entity IN (".getEntity('invoice').")"; $result = $db->query($sql); $num_lines = $db->num_rows($result); - if ($num_lines==0) + if ($num_lines == 0) { - require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; + require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $invoice = new Facture($db); $constforthirdpartyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]; $invoice->socid = $conf->global->$constforthirdpartyid; $invoice->date = dol_now(); $invoice->module_source = 'takepos'; $invoice->pos_source = $_SESSION["takeposterminal"]; - $placeid =$invoice->create($user); - $sql="UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid=".$placeid; + $placeid = $invoice->create($user); + $sql = "UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid=".$placeid; $db->query($sql); } @@ -356,140 +356,140 @@ if ($search_status == '') $search_status = 1; // always display active thirdpart External user socid=x + No permission to see ALL customers => Can see only himself */ -$form=new Form($db); -$formother=new FormOther($db); -$companystatic=new Societe($db); -$companyparent=new Societe($db); -$formcompany=new FormCompany($db); -$prospectstatic=new Client($db); -$prospectstatic->client=2; +$form = new Form($db); +$formother = new FormOther($db); +$companystatic = new Societe($db); +$companyparent = new Societe($db); +$formcompany = new FormCompany($db); +$prospectstatic = new Client($db); +$prospectstatic->client = 2; $prospectstatic->loadCacheOfProspStatus(); -$title=$langs->trans("ListOfThirdParties"); -if ($type == 'c' && (empty($search_type) || ($search_type == '1,3'))) $title=$langs->trans("ListOfCustomers"); -if ($type == 'p' && (empty($search_type) || ($search_type == '2,3'))) $title=$langs->trans("ListOfProspects"); -if ($type == 'f' && (empty($search_type) || ($search_type == '4'))) $title=$langs->trans("ListOfSuppliers"); +$title = $langs->trans("ListOfThirdParties"); +if ($type == 'c' && (empty($search_type) || ($search_type == '1,3'))) $title = $langs->trans("ListOfCustomers"); +if ($type == 'p' && (empty($search_type) || ($search_type == '2,3'))) $title = $langs->trans("ListOfProspects"); +if ($type == 'f' && (empty($search_type) || ($search_type == '4'))) $title = $langs->trans("ListOfSuppliers"); // Select every potentiels, and note each potentiels which fit in search parameters $tab_level = array(); $sql = "SELECT code, label, sortorder"; -$sql.= " FROM ".MAIN_DB_PREFIX."c_prospectlevel"; -$sql.= " WHERE active > 0"; -$sql.= " ORDER BY sortorder"; +$sql .= " FROM ".MAIN_DB_PREFIX."c_prospectlevel"; +$sql .= " WHERE active > 0"; +$sql .= " ORDER BY sortorder"; $resql = $db->query($sql); if ($resql) { while ($obj = $db->fetch_object($resql)) { // Compute level text - $level=$langs->trans($obj->code); - if ($level == $obj->code) $level=$langs->trans($obj->label); + $level = $langs->trans($obj->code); + if ($level == $obj->code) $level = $langs->trans($obj->label); $tab_level[$obj->code] = $level; } } else dol_print_error($db); $sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.barcode, s.town, s.zip, s.datec, s.code_client, s.code_fournisseur, s.logo,"; -$sql.= " s.entity,"; -$sql.= " st.libelle as stcomm, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,"; -$sql.= " s.email, s.phone, s.fax, s.url, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4 as idprof4, s.idprof5 as idprof5, s.idprof6 as idprof6, s.tva_intra, s.fk_pays,"; -$sql.= " s.tms as date_update, s.datec as date_creation,"; -$sql.= " s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,"; -$sql.= " s2.nom as name2,"; -$sql.= " typent.code as typent_code,"; -$sql.= " staff.code as staff_code,"; -$sql.= " country.code as country_code, country.label as country_label,"; -$sql.= " state.code_departement as state_code, state.nom as state_name,"; -$sql.= " region.code_region as region_code, region.nom as region_name"; +$sql .= " s.entity,"; +$sql .= " st.libelle as stcomm, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,"; +$sql .= " s.email, s.phone, s.fax, s.url, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4 as idprof4, s.idprof5 as idprof5, s.idprof6 as idprof6, s.tva_intra, s.fk_pays,"; +$sql .= " s.tms as date_update, s.datec as date_creation,"; +$sql .= " s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,"; +$sql .= " s2.nom as name2,"; +$sql .= " typent.code as typent_code,"; +$sql .= " staff.code as staff_code,"; +$sql .= " country.code as country_code, country.label as country_label,"; +$sql .= " state.code_departement as state_code, state.nom as state_name,"; +$sql .= " region.code_region as region_code, region.nom as region_name"; // We'll need these fields in order to filter by sale (including the case where the user can only see his prospects) if ($search_sale) $sql .= ", sc.fk_soc, sc.fk_user"; // We'll need these fields in order to filter by categ if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc"; if ($search_categ_sup) $sql .= ", cs.fk_categorie, cs.fk_soc"; // Add fields from extrafields -if (! empty($extrafields->attributes[$object->table_element]['label'])) { - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); +if (!empty($extrafields->attributes[$object->table_element]['label'])) { + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); } // Add fields from hooks -$parameters=array(); -$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook -$sql.=$hookmanager->resPrint; -$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s2 ON s.parent = s2.rowid"; -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (s.rowid = ef.fk_object)"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_effectif as staff on (staff.id = s.fk_effectif)"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region. code_region = state.fk_region)"; +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; +$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s2 ON s.parent = s2.rowid"; +if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (s.rowid = ef.fk_object)"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_effectif as staff on (staff.id = s.fk_effectif)"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region. code_region = state.fk_region)"; // We'll need this table joined to the select in order to filter by categ -if (! empty($search_categ_cus)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ -if (! empty($search_categ_sup)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; // We'll need this table joined to the select in order to filter by categ -$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."c_stcomm as st ON s.fk_stcomm = st.id"; +if (!empty($search_categ_cus)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ +if (!empty($search_categ_sup)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; // We'll need this table joined to the select in order to filter by categ +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."c_stcomm as st ON s.fk_stcomm = st.id"; // We'll need this table joined to the select in order to filter by sale -if ($search_sale == -2) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; -elseif ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -$sql.= " WHERE s.entity IN (".getEntity('societe').")"; -if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; -if ($socid) $sql.= " AND s.rowid = ".$socid; -if ($search_sale && $search_sale != -2) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale -if (! $user->rights->fournisseur->lire) $sql.=" AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible -if ($search_sale == -2) $sql.= " AND sc.fk_user IS NULL"; -elseif ($search_sale) $sql.= " AND sc.fk_user = ".$db->escape($search_sale); -if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); -if ($search_categ_sup > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ_sup); -if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; -if ($search_categ_sup == -2) $sql.= " AND cs.fk_categorie IS NULL"; +if ($search_sale == -2) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; +elseif ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +$sql .= " WHERE s.entity IN (".getEntity('societe').")"; +if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; +if ($socid) $sql .= " AND s.rowid = ".$socid; +if ($search_sale && $search_sale != -2) $sql .= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale +if (!$user->rights->fournisseur->lire) $sql .= " AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible +if ($search_sale == -2) $sql .= " AND sc.fk_user IS NULL"; +elseif ($search_sale) $sql .= " AND sc.fk_user = ".$db->escape($search_sale); +if ($search_categ_cus > 0) $sql .= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); +if ($search_categ_sup > 0) $sql .= " AND cs.fk_categorie = ".$db->escape($search_categ_sup); +if ($search_categ_cus == -2) $sql .= " AND cc.fk_categorie IS NULL"; +if ($search_categ_sup == -2) $sql .= " AND cs.fk_categorie IS NULL"; -if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all); -if (strlen($search_cti)) $sql.= natural_search('s.phone', $search_cti); +if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all); +if (strlen($search_cti)) $sql .= natural_search('s.phone', $search_cti); -if ($search_id > 0) $sql.= natural_search("s.rowid", $search_id, 1); -if ($search_nom) $sql.= natural_search("s.nom", $search_nom); -if ($search_alias) $sql.= natural_search("s.name_alias", $search_alias); -if ($search_nom_only) $sql.= natural_search("s.nom", $search_nom_only); -if ($search_customer_code) $sql.= natural_search("s.code_client", $search_customer_code); -if ($search_supplier_code) $sql.= natural_search("s.code_fournisseur", $search_supplier_code); -if ($search_account_customer_code) $sql.= natural_search("s.code_compta", $search_account_customer_code); -if ($search_account_supplier_code) $sql.= natural_search("s.code_compta_fournisseur", $search_account_supplier_code); -if ($search_town) $sql.= natural_search("s.town", $search_town); -if (strlen($search_zip)) $sql.= natural_search("s.zip", $search_zip); -if ($search_state) $sql.= natural_search("state.nom", $search_state); -if ($search_region) $sql.= natural_search("region.nom", $search_region); +if ($search_id > 0) $sql .= natural_search("s.rowid", $search_id, 1); +if ($search_nom) $sql .= natural_search("s.nom", $search_nom); +if ($search_alias) $sql .= natural_search("s.name_alias", $search_alias); +if ($search_nom_only) $sql .= natural_search("s.nom", $search_nom_only); +if ($search_customer_code) $sql .= natural_search("s.code_client", $search_customer_code); +if ($search_supplier_code) $sql .= natural_search("s.code_fournisseur", $search_supplier_code); +if ($search_account_customer_code) $sql .= natural_search("s.code_compta", $search_account_customer_code); +if ($search_account_supplier_code) $sql .= natural_search("s.code_compta_fournisseur", $search_account_supplier_code); +if ($search_town) $sql .= natural_search("s.town", $search_town); +if (strlen($search_zip)) $sql .= natural_search("s.zip", $search_zip); +if ($search_state) $sql .= natural_search("state.nom", $search_state); +if ($search_region) $sql .= natural_search("region.nom", $search_region); if ($search_country && $search_country != '-1') $sql .= " AND s.fk_pays IN (".$db->escape($search_country).')'; -if ($search_email) $sql.= natural_search("s.email", $search_email); -if (strlen($search_phone)) $sql.= natural_search("s.phone", $search_phone); -if (strlen($search_fax)) $sql.= natural_search("s.fax", $search_fax); -if ($search_url) $sql.= natural_search("s.url", $search_url); -if (strlen($search_idprof1)) $sql.= natural_search("s.siren", $search_idprof1); -if (strlen($search_idprof2)) $sql.= natural_search("s.siret", $search_idprof2); -if (strlen($search_idprof3)) $sql.= natural_search("s.ape", $search_idprof3); -if (strlen($search_idprof4)) $sql.= natural_search("s.idprof4", $search_idprof4); -if (strlen($search_idprof5)) $sql.= natural_search("s.idprof5", $search_idprof5); -if (strlen($search_idprof6)) $sql.= natural_search("s.idprof6", $search_idprof6); -if (strlen($search_vat)) $sql.= natural_search("s.tva_intra", $search_vat); +if ($search_email) $sql .= natural_search("s.email", $search_email); +if (strlen($search_phone)) $sql .= natural_search("s.phone", $search_phone); +if (strlen($search_fax)) $sql .= natural_search("s.fax", $search_fax); +if ($search_url) $sql .= natural_search("s.url", $search_url); +if (strlen($search_idprof1)) $sql .= natural_search("s.siren", $search_idprof1); +if (strlen($search_idprof2)) $sql .= natural_search("s.siret", $search_idprof2); +if (strlen($search_idprof3)) $sql .= natural_search("s.ape", $search_idprof3); +if (strlen($search_idprof4)) $sql .= natural_search("s.idprof4", $search_idprof4); +if (strlen($search_idprof5)) $sql .= natural_search("s.idprof5", $search_idprof5); +if (strlen($search_idprof6)) $sql .= natural_search("s.idprof6", $search_idprof6); +if (strlen($search_vat)) $sql .= natural_search("s.tva_intra", $search_vat); // Filter on type of thirdparty -if ($search_type > 0 && in_array($search_type, array('1,3','2,3'))) $sql .= " AND s.client IN (".$db->escape($search_type).")"; +if ($search_type > 0 && in_array($search_type, array('1,3', '2,3'))) $sql .= " AND s.client IN (".$db->escape($search_type).")"; if ($search_type > 0 && in_array($search_type, array('4'))) $sql .= " AND s.fournisseur = 1"; if ($search_type == '0') $sql .= " AND s.client = 0 AND s.fournisseur = 0"; -if ($search_status!='' && $search_status >= 0) $sql .= natural_search("s.status", $search_status, 2); -if (!empty($conf->barcode->enabled) && $search_barcode) $sql.= natural_search("s.barcode", $search_barcode); -if ($search_type_thirdparty && $search_type_thirdparty != '-1') $sql.= natural_search("s.fk_typent", $search_type_thirdparty, 2); -if (! empty($search_staff) && $search_staff != '-1') $sql.= natural_search("s.fk_effectif", $search_staff, 2); +if ($search_status != '' && $search_status >= 0) $sql .= natural_search("s.status", $search_status, 2); +if (!empty($conf->barcode->enabled) && $search_barcode) $sql .= natural_search("s.barcode", $search_barcode); +if ($search_type_thirdparty && $search_type_thirdparty != '-1') $sql .= natural_search("s.fk_typent", $search_type_thirdparty, 2); +if (!empty($search_staff) && $search_staff != '-1') $sql .= natural_search("s.fk_effectif", $search_staff, 2); if ($search_level) $sql .= natural_search("s.fk_prospectlevel", join(',', $search_level), 3); -if ($search_parent_name) $sql.= natural_search("s2.nom", $search_parent_name); -if ($search_stcomm != '' && $search_stcomm != -2) $sql.= natural_search("s.fk_stcomm", $search_stcomm, 2); -if ($search_import_key) $sql.= natural_search("s.import_key", $search_import_key); +if ($search_parent_name) $sql .= natural_search("s2.nom", $search_parent_name); +if ($search_stcomm != '' && $search_stcomm != -2) $sql .= natural_search("s.fk_stcomm", $search_stcomm, 2); +if ($search_import_key) $sql .= natural_search("s.import_key", $search_import_key); // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks -$parameters=array(); -$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook -$sql.=$hookmanager->resPrint; +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; -$sql.= $db->order($sortfield, $sortorder); +$sql .= $db->order($sortfield, $sortorder); // Count total nb of records $nbtotalofrecords = ''; @@ -626,258 +626,258 @@ print ''; print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'building', 0, $newcardbutton, '', $limit); $langs->load("other"); -$textprofid=array(); -foreach(array(1,2,3,4,5,6) as $key) +$textprofid = array(); +foreach (array(1, 2, 3, 4, 5, 6) as $key) { - $label=$langs->transnoentities("ProfId".$key.$mysoc->country_code); - $textprofid[$key]=''; + $label = $langs->transnoentities("ProfId".$key.$mysoc->country_code); + $textprofid[$key] = ''; if ($label != "ProfId".$key.$mysoc->country_code) { // Get only text between () - if (preg_match('/\((.*)\)/i', $label, $reg)) $label=$reg[1]; - $textprofid[$key]=$langs->trans("ProfIdShortDesc", $key, $mysoc->country_code, $label); + if (preg_match('/\((.*)\)/i', $label, $reg)) $label = $reg[1]; + $textprofid[$key] = $langs->trans("ProfIdShortDesc", $key, $mysoc->country_code, $label); } } -$topicmail="Information"; -$modelmail="thirdparty"; -$objecttmp=new Societe($db); -$trackid='thi'.$object->id; +$topicmail = "Information"; +$modelmail = "thirdparty"; +$objecttmp = new Societe($db); +$trackid = 'thi'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) { - foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print '
'.$langs->trans("FilterOnInto", $search_all) . join(', ', $fieldstosearchall).'
'; + foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val); + print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'; } // Filter on categories -$moreforfilter=''; +$moreforfilter = ''; if (empty($type) || $type == 'c' || $type == 'p') { - if (! empty($conf->categorie->enabled)) + if (!empty($conf->categorie->enabled)) { - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; - $moreforfilter.='
'; - $moreforfilter.=$langs->trans('CustomersProspectsCategoriesShort').': '; - $moreforfilter.=$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $langs->trans('CustomersProspectsCategoriesShort')); - $moreforfilter.='
'; + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + $moreforfilter .= '
'; + $moreforfilter .= $langs->trans('CustomersProspectsCategoriesShort').': '; + $moreforfilter .= $formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $langs->trans('CustomersProspectsCategoriesShort')); + $moreforfilter .= '
'; } } if (empty($type) || $type == 'f') { - if (! empty($conf->categorie->enabled)) + if (!empty($conf->categorie->enabled)) { - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; - $moreforfilter.='
'; - $moreforfilter.=$langs->trans('SuppliersCategoriesShort').': '; - $moreforfilter.=$formother->select_categories('supplier', $search_categ_sup, 'search_categ_sup', 1); - $moreforfilter.='
'; + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + $moreforfilter .= '
'; + $moreforfilter .= $langs->trans('SuppliersCategoriesShort').': '; + $moreforfilter .= $formother->select_categories('supplier', $search_categ_sup, 'search_categ_sup', 1); + $moreforfilter .= '
'; } } // If the user can view prospects other than his' if ($user->rights->societe->client->voir || $socid) { - $moreforfilter.='
'; - $moreforfilter.=$langs->trans('SalesRepresentatives'). ': '; - $moreforfilter.=$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth300', 1); - $moreforfilter.='
'; + $moreforfilter .= '
'; + $moreforfilter .= $langs->trans('SalesRepresentatives').': '; + $moreforfilter .= $formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth300', 1); + $moreforfilter .= '
'; } if ($moreforfilter) { print '
'; print $moreforfilter; - $parameters=array('type'=>$type); - $reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook + $parameters = array('type'=>$type); + $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print '
'; } -$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; -$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields -if ($massactionbutton && $contextpage != 'poslist') $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); +$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +if ($massactionbutton && $contextpage != 'poslist') $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); if (empty($arrayfields['customerorsupplier']['checked'])) print ''; print '
'; -print ''."\n"; +print '
'."\n"; // Fields title search print ''; -if (! empty($arrayfields['s.rowid']['checked'])) +if (!empty($arrayfields['s.rowid']['checked'])) { print ''; } -if (! empty($arrayfields['s.nom']['checked'])) +if (!empty($arrayfields['s.nom']['checked'])) { print ''; } -if (! empty($arrayfields['s.name_alias']['checked'])) +if (!empty($arrayfields['s.name_alias']['checked'])) { print ''; } // Barcode -if (! empty($arrayfields['s.barcode']['checked'])) +if (!empty($arrayfields['s.barcode']['checked'])) { print ''; } // Customer code -if (! empty($arrayfields['s.code_client']['checked'])) +if (!empty($arrayfields['s.code_client']['checked'])) { print ''; } // Supplier code -if (! empty($arrayfields['s.code_fournisseur']['checked'])) +if (!empty($arrayfields['s.code_fournisseur']['checked'])) { print ''; } // Account Customer code -if (! empty($arrayfields['s.code_compta']['checked'])) +if (!empty($arrayfields['s.code_compta']['checked'])) { print ''; } // Account Supplier code -if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) +if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) { print ''; } // Town -if (! empty($arrayfields['s.town']['checked'])) +if (!empty($arrayfields['s.town']['checked'])) { print ''; } // Zip -if (! empty($arrayfields['s.zip']['checked'])) +if (!empty($arrayfields['s.zip']['checked'])) { print ''; } // State -if (! empty($arrayfields['state.nom']['checked'])) +if (!empty($arrayfields['state.nom']['checked'])) { print ''; } // Region -if (! empty($arrayfields['region.nom']['checked'])) +if (!empty($arrayfields['region.nom']['checked'])) { print ''; } // Country -if (! empty($arrayfields['country.code_iso']['checked'])) +if (!empty($arrayfields['country.code_iso']['checked'])) { print ''; } // Company type -if (! empty($arrayfields['typent.code']['checked'])) +if (!empty($arrayfields['typent.code']['checked'])) { print ''; } // Staff -if (! empty($arrayfields['staff.code']['checked'])) +if (!empty($arrayfields['staff.code']['checked'])) { print ''; } -if (! empty($arrayfields['s.email']['checked'])) +if (!empty($arrayfields['s.email']['checked'])) { // Email print ''; } -if (! empty($arrayfields['s.phone']['checked'])) +if (!empty($arrayfields['s.phone']['checked'])) { // Phone print ''; } -if (! empty($arrayfields['s.fax']['checked'])) +if (!empty($arrayfields['s.fax']['checked'])) { // Fax print ''; } -if (! empty($arrayfields['s.url']['checked'])) +if (!empty($arrayfields['s.url']['checked'])) { // Url print ''; } -if (! empty($arrayfields['s.siren']['checked'])) +if (!empty($arrayfields['s.siren']['checked'])) { // IdProf1 print ''; } -if (! empty($arrayfields['s.siret']['checked'])) +if (!empty($arrayfields['s.siret']['checked'])) { // IdProf2 print ''; } -if (! empty($arrayfields['s.ape']['checked'])) +if (!empty($arrayfields['s.ape']['checked'])) { // IdProf3 print ''; } -if (! empty($arrayfields['s.idprof4']['checked'])) +if (!empty($arrayfields['s.idprof4']['checked'])) { // IdProf4 print ''; } -if (! empty($arrayfields['s.idprof5']['checked'])) +if (!empty($arrayfields['s.idprof5']['checked'])) { // IdProf5 print ''; } -if (! empty($arrayfields['s.idprof6']['checked'])) +if (!empty($arrayfields['s.idprof6']['checked'])) { // IdProf6 print ''; } -if (! empty($arrayfields['s.tva_intra']['checked'])) +if (!empty($arrayfields['s.tva_intra']['checked'])) { // Vat number print '
'; print ''; print ''; - if (! empty($search_nom_only) && empty($search_nom)) $search_nom=$search_nom_only; + if (!empty($search_nom_only) && empty($search_nom)) $search_nom = $search_nom_only; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100'); print ''; - print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); + print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT)); print ''; print $form->selectarray("search_staff", $formcompany->effectif_array(0), $search_staff, 0, 0, 0, '', 0, 0, 0, $sort, 'maxwidth100'); print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; diff --git a/htdocs/societe/project.php b/htdocs/societe/project.php index c6029544c90..1c2604e0e44 100644 --- a/htdocs/societe/project.php +++ b/htdocs/societe/project.php @@ -35,7 +35,7 @@ $langs->loadLangs(array("companies", "projects")); // Security check $socid = GETPOST('socid', 'int'); -if ($user->socid) $socid=$user->socid; +if ($user->socid) $socid = $user->socid; $result = restrictedArea($user, 'societe', $socid, '&societe'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -46,8 +46,8 @@ $hookmanager->initHooks(array('projectthirdparty')); * Actions */ -$parameters=array('id'=>$socid); -$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +$parameters = array('id'=>$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'); @@ -71,25 +71,25 @@ if ($socid) $object = new Societe($db); $result = $object->fetch($socid); - $title=$langs->trans("Projects"); - if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; + $title = $langs->trans("Projects"); + if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->name." - ".$title; llxHeader('', $title); - if (! empty($conf->notification->enabled)) $langs->load("mails"); + if (!empty($conf->notification->enabled)) $langs->load("mails"); $head = societe_prepare_head($object); dol_fiche_head($head, 'project', $langs->trans("ThirdParty"), -1, 'company'); $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom'); + dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom'); print '
'; print '
'; print ''; - if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field + if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { print ''; } @@ -126,7 +126,7 @@ if ($socid) // Projects list - $result=show_projects($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id, 1, $newcardbutton); + $result = show_projects($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id, 1, $newcardbutton); } // End of page diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index c1fa8b10b42..17e286d2064 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -265,17 +265,17 @@ print $langs->trans("SortProductField"); print '\n"; -$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2); -$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); +$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2); +$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation"); $htmltext = ''.$langs->trans("AvailableVariables").':
'; -foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; -$htmltext.='
'; +foreach ($substitutionarray as $key => $val) $htmltext .= $key.'
'; +$htmltext .= ''; // Color theme print '
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'; $prod = new Product($db); $array = []; -foreach($prod->fields as $k => $v) { - $array[$k]=$k; +foreach ($prod->fields as $k => $v) { + $array[$k] = $k; } -print $form->selectarray('TAKEPOS_SORTPRODUCTFIELD', $array, (empty($conf->global->TAKEPOS_SORTPRODUCTFIELD)?'rowid':$conf->global->TAKEPOS_SORTPRODUCTFIELD), 0); +print $form->selectarray('TAKEPOS_SORTPRODUCTFIELD', $array, (empty($conf->global->TAKEPOS_SORTPRODUCTFIELD) ? 'rowid' : $conf->global->TAKEPOS_SORTPRODUCTFIELD), 0); print "
'; print $langs->trans("ColorTheme"); diff --git a/htdocs/theme/md/dropdown.inc.php b/htdocs/theme/md/dropdown.inc.php index 93dfc532197..5889485664a 100644 --- a/htdocs/theme/md/dropdown.inc.php +++ b/htdocs/theme/md/dropdown.inc.php @@ -1,5 +1,5 @@ +if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> /*