From fb27c98f9ca3b0bd1b6a72beca34c5052e6a5ddc Mon Sep 17 00:00:00 2001 From: quentin Date: Tue, 10 Nov 2020 09:40:45 +0100 Subject: [PATCH 001/124] FIX : handling $heightforinfotot when he's superior to a page height --- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index a32ba1308a3..87fbf1f5085 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -328,6 +328,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetAutoPageBreak(1, 0); $heightforinfotot = 50 + (4 * $nbpayments); // Height reserved to output the info and total part and payment part + if($heightforinfotot > 220) $heightforinfotot = 220; $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; From dea92299f3556a244e2ba860fbf909755ba79a3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 10 Nov 2020 21:54:34 +0100 Subject: [PATCH 002/124] Update thirdparty_lettering_supplier.php --- .../accountancy/bookkeeping/thirdparty_lettering_supplier.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php index 16aa51beded..3759c45c32a 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php @@ -4,7 +4,7 @@ * Copyright (C) 2013 Olivier Geffroy * Copyright (C) 2013 Florian Henry * Copyright (C) 2013-2019 Alexandre Spangaro - * Copyright (C) 2018-2019 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -41,7 +41,7 @@ $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); -$socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int'); +$socid = GETPOST('socid', 'int') ? (int) GETPOST('socid', 'int') : (int) GETPOST('id', 'int'); $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); From 4d48eb96edb82e308d0479a41787b83cb23686db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Nov 2020 07:16:07 +0100 Subject: [PATCH 003/124] Update adherent.class.php --- htdocs/adherents/class/adherent.class.php | 27 ++++++++++++++++------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 009c73cf318..9bedb1a39ca 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2404,6 +2404,7 @@ class Adherent extends CommonObject global $conf, $langs; $info = array(); + $socialnetworks = getArrayOfSocialNetworks(); $keymodified = false; // Object classes @@ -2418,8 +2419,13 @@ class Adherent extends CommonObject } // Possible LDAP KEY (constname => varname) - $ldapkey = array('LDAP_MEMBER_FIELD_FULLNAME' => 'fullname', 'LDAP_MEMBER_FIELD_NAME' => 'lastname', 'LDAP_MEMBER_FIELD_LOGIN' => 'login', 'LDAP_MEMBER_FIELD_LOGIN_SAMBA' => 'login', - 'LDAP_MEMBER_FIELD_MAIL' => 'email'); + $ldapkey = array( + 'LDAP_MEMBER_FIELD_FULLNAME' => 'fullname', + 'LDAP_MEMBER_FIELD_NAME' => 'lastname', + 'LDAP_MEMBER_FIELD_LOGIN' => 'login', + 'LDAP_MEMBER_FIELD_LOGIN_SAMBA' => 'login', + 'LDAP_MEMBER_FIELD_MAIL' => 'email' + ); // Member foreach ($ldapkey as $constname => $varname) { @@ -2439,10 +2445,11 @@ class Adherent extends CommonObject if ($this->zip && !empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip; if ($this->town && !empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town; if ($this->country_code && !empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code; - if ($this->skype && !empty($conf->global->LDAP_MEMBER_FIELD_SKYPE)) $info[$conf->global->LDAP_MEMBER_FIELD_SKYPE] = $this->skype; - if ($this->twitter && !empty($conf->global->LDAP_MEMBER_FIELD_TWITTER)) $info[$conf->global->LDAP_MEMBER_FIELD_TWITTER] = $this->twitter; - if ($this->facebook && !empty($conf->global->LDAP_MEMBER_FIELD_FACEBOOK)) $info[$conf->global->LDAP_MEMBER_FIELD_FACEBOOK] = $this->facebook; - if ($this->linkedin && !empty($conf->global->LDAP_MEMBER_FIELD_LINKEDIN)) $info[$conf->global->LDAP_MEMBER_FIELD_LINKEDIN] = $this->linkedin; + foreach ($socialnetworks as $key => $value) { + if ($this->socialnetworks[$value['label']] && !empty($conf->global->{'LDAP_MEMBER_FIELD_'.strtoupper($value['label'])})) { + $info[$conf->global->{'LDAP_MEMBER_FIELD_'.strtoupper($value['label'])}] = $this->socialnetworks[$value['label']]; + } + } if ($this->phone && !empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone; if ($this->phone_perso && !empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso; if ($this->phone_mobile && !empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile; @@ -2455,8 +2462,12 @@ class Adherent extends CommonObject // When password is modified if (!empty($this->pass)) { - if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte - if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption) + if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) { + $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte + } + if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) { + $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption) + } } // Set LDAP password if possible elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') { // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) { From b783a8775d5babd397d6a393625be7ac1715667f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Nov 2020 07:31:10 +0100 Subject: [PATCH 004/124] Update user.class.php --- htdocs/user/class/user.class.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index b4682939ef2..336a4f1d515 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2653,6 +2653,9 @@ class User extends CommonObject global $conf, $langs; $info = array(); + + $socialnetworks = getArrayOfSocialNetworks(); + $keymodified = false; // Object classes @@ -2672,10 +2675,6 @@ class User extends CommonObject 'LDAP_FIELD_FAX' => 'office_fax', 'LDAP_FIELD_MAIL' => 'email', 'LDAP_FIELD_SID' => 'ldap_sid', - 'LDAP_FIELD_SKYPE' => 'skype', - 'LDAP_FIELD_TWITTER' => 'twitter', - 'LDAP_FIELD_FACEBOOK' => 'facebook', - 'LDAP_FIELD_LINKEDIN' => 'linkedin' ); // Champs @@ -2691,6 +2690,11 @@ class User extends CommonObject } } } + foreach ($socialnetworks as $key => $value) { + if ($this->socialnetworks[$value['label']] && !empty($conf->global->{'LDAP_FIELD_'.strtoupper($value['label'])})) { + $info[$conf->global->{'LDAP_FIELD_'.strtoupper($value['label'])}] = $this->socialnetworks[$value['label']]; + } + } if ($this->address && !empty($conf->global->LDAP_FIELD_ADDRESS)) { $info[$conf->global->LDAP_FIELD_ADDRESS] = $this->address; } @@ -2959,6 +2963,8 @@ class User extends CommonObject // TODO: Voir pourquoi le update met à jour avec toutes les valeurs vide (global $user écrase ?) global $user, $conf; + $socialnetworks = getArrayOfSocialNetworks(); + $this->firstname = $ldapuser->{$conf->global->LDAP_FIELD_FIRSTNAME}; $this->lastname = $ldapuser->{$conf->global->LDAP_FIELD_NAME}; $this->login = $ldapuser->{$conf->global->LDAP_FIELD_LOGIN}; @@ -2969,10 +2975,9 @@ class User extends CommonObject $this->user_mobile = $ldapuser->{$conf->global->LDAP_FIELD_MOBILE}; $this->office_fax = $ldapuser->{$conf->global->LDAP_FIELD_FAX}; $this->email = $ldapuser->{$conf->global->LDAP_FIELD_MAIL}; - $this->skype = $ldapuser->{$conf->global->LDAP_FIELD_SKYPE}; - $this->twitter = $ldapuser->{$conf->global->LDAP_FIELD_TWITTER}; - $this->facebook = $ldapuser->{$conf->global->LDAP_FIELD_FACEBOOK}; - $this->linkedin = $ldapuser->{$conf->global->LDAP_FIELD_LINKEDIN}; + foreach ($socialnetworks as $key => $value) { + $this->socialnetworks[$value['label']] = $info[$conf->global->{'LDAP_FIELD_'.strtoupper($value['label'])}]; + } $this->ldap_sid = $ldapuser->{$conf->global->LDAP_FIELD_SID}; $this->job = $ldapuser->{$conf->global->LDAP_FIELD_TITLE}; From d28249d5685d56ff202191de936cfc446e811577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Nov 2020 07:35:33 +0100 Subject: [PATCH 005/124] Update user.class.php --- htdocs/user/class/user.class.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 336a4f1d515..1f7581ae39d 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -96,6 +96,30 @@ class User extends CommonObject */ public $socialnetworks; + /** + * @var string skype account + * @deprecated + */ + public $skype; + + /** + * @var string twitter account + * @deprecated + */ + public $twitter; + + /** + * @var string facebook account + * @deprecated + */ + public $facebook; + + /** + * @var string linkedin account + * @deprecated + */ + public $linkedin; + /** * @var string job position */ From 36cd4a8d4df7ae7eb80c464116e8eb219985f098 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Nov 2020 07:39:09 +0100 Subject: [PATCH 006/124] Update user.class.php --- htdocs/user/class/user.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 1f7581ae39d..6b7199f188e 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -3000,7 +3000,7 @@ class User extends CommonObject $this->office_fax = $ldapuser->{$conf->global->LDAP_FIELD_FAX}; $this->email = $ldapuser->{$conf->global->LDAP_FIELD_MAIL}; foreach ($socialnetworks as $key => $value) { - $this->socialnetworks[$value['label']] = $info[$conf->global->{'LDAP_FIELD_'.strtoupper($value['label'])}]; + $this->socialnetworks[$value['label']] = $ldapuser{$conf->global->{'LDAP_FIELD_'.strtoupper($value['label'])}}; } $this->ldap_sid = $ldapuser->{$conf->global->LDAP_FIELD_SID}; From 05410ebbb3c6bd6a6eab9a4b57545af81ca935fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Nov 2020 09:26:13 +0100 Subject: [PATCH 007/124] Update user.class.php --- htdocs/user/class/user.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index b4682939ef2..b8af02e8ad1 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1643,7 +1643,7 @@ class User extends CommonObject $this->datestartvalidity = empty($this->datestartvalidity) ? '' : $this->datestartvalidity; $this->dateendvalidity = empty($this->dateendvalidity) ? '' : $this->dateendvalidity; $this->birth = trim($this->birth); - $this->fk_warehouse = trim(empty($this->fk_warehouse) ? '' : $this->fk_warehouse); + $this->fk_warehouse = (int) $this->fk_warehouse; // Check parameters if (!empty($conf->global->USER_MAIL_REQUIRED) && !isValidEMail($this->email)) { @@ -1714,7 +1714,7 @@ class User extends CommonObject $sql .= ", entity = '".$this->db->escape($this->entity)."'"; $sql .= ", default_range = ".($this->default_range > 0 ? $this->default_range : 'null'); $sql .= ", default_c_exp_tax_cat = ".($this->default_c_exp_tax_cat > 0 ? $this->default_c_exp_tax_cat : 'null'); - $sql .= ", fk_warehouse = ".($this->fk_warehouse ? "'".$this->db->escape($this->fk_warehouse)."'" : "null"); + $sql .= ", fk_warehouse = ".($this->fk_warehouse > 0 ? $this->fk_warehouse : "null"); $sql .= ", lang = ".($this->lang ? "'".$this->db->escape($this->lang)."'" : "null"); $sql .= " WHERE rowid = ".$this->id; From b16af0a7c3f2a674eae83206f817b368d2e7b022 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 11 Nov 2020 15:43:36 +0100 Subject: [PATCH 008/124] fix deprecated warning php 7.4 --- htdocs/contact/list.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 843a894a0fd..295e63c9606 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -76,7 +76,7 @@ $search_no_email = GETPOST("search_no_email", 'int'); if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { if ($value['active']) { - $search_{$key} = GETPOST("search_".$key, 'alpha'); + ${"search_".$key} = GETPOST("search_".$key, 'alpha'); } } } @@ -259,7 +259,7 @@ if (empty($reshook)) if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { if ($value['active']) { - $search_{$key} = ""; + ${"search_".$key} = ""; } } } @@ -363,8 +363,8 @@ if (strlen($search_phone_mobile)) $sql .= natural_search('p.phone_mobile', $se if (strlen($search_fax)) $sql .= natural_search('p.fax', $search_fax); if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { - if ($value['active'] && strlen($search_{$key})) { - $sql .= ' AND p.socialnetworks LIKE \'%"'.$key.'":"'.$search_{$key}.'%\''; + if ($value['active'] && strlen(${"search_".$key})) { + $sql .= ' AND p.socialnetworks LIKE \'%"'.$key.'":"'.${"search_".$key}.'%\''; } } } @@ -674,7 +674,7 @@ if (!empty($conf->socialnetworks->enabled)) { if (!empty($arrayfields['p.'.$key]['checked'])) { print ''; - print ''; + print ''; print ''; } } From ad04646c0519f8e118d9eac97eba7aebfd0f6ee0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Nov 2020 15:55:04 +0100 Subject: [PATCH 009/124] Fix must use json_encode/decode instead of dol_json_encode/decode --- htdocs/admin/system/phpinfo.php | 13 ++++++++----- htdocs/modulebuilder/index.php | 2 +- htdocs/societe/paymentmodes.php | 4 ++-- htdocs/stripe/class/stripe.class.php | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index 11d0dbc49cf..da21d52cd43 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -105,36 +105,39 @@ if (!isset($_GET["testget"]) && !isset($_POST["testpost"]) && !isset($_GET["main print ''; print 'Sessions support'; - if (!function_exists("session_id")) { print 'Error '.$langs->trans("ErrorPHPDoesNotSupportSessions"); } else { print 'Ok '.$langs->trans("PHPSupportSessions"); } - print ''; print 'UTF-8 support'; - if (!function_exists("utf8_encode")) { print 'Warning '.$langs->trans("ErrorPHPDoesNotSupport", "UTF8"); } else { print 'Ok '.$langs->trans("PHPSupport", "UTF8"); } - print ''; print 'MBString support'; - if (!function_exists("mb_check_encoding")) { print 'Warning '.$langs->trans("ErrorPHPDoesNotSupport", "mbstring"); } else { print 'Ok '.$langs->trans("PHPSupport", "mbstring"); } +print ''; +print 'JSon support'; +if (!function_exists("json_decode")) +{ + print 'Warning '.$langs->trans("ErrorPHPDoesNotSupport", "json"); +} else { + print 'Ok '.$langs->trans("PHPSupport", "json"); +} print ''; print ''; diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index dfa8b5adef6..051a2d1a42d 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1200,7 +1200,7 @@ if ($dirins && $action == 'addproperty' && !empty($module) && !empty($tabobj)) if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) { - $addfieldentry['arrayofkeyval'] = dol_json_decode($addfieldentry['arrayofkeyval'], true); + $addfieldentry['arrayofkeyval'] = json_decode($addfieldentry['arrayofkeyval'], true); } } } diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 761365e1280..d7ca24299b0 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -611,7 +611,7 @@ if (empty($reshook)) $tokenstring['stripe_user_id'] = $stripesup->id; $tokenstring['type'] = $stripesup->type; $sql = "UPDATE ".MAIN_DB_PREFIX."oauth_token"; - $sql .= " SET tokenstring = '".dol_json_encode($tokenstring)."'"; + $sql .= " SET tokenstring = '".$db->escape(json_encode($tokenstring))."'"; $sql .= " WHERE site = 'stripe' AND (site_account IS NULL or site_account = '".$db->escape($site_account)."') AND fk_soc = ".$object->id." AND service = '".$db->escape($service)."' AND entity = ".$conf->entity; // Keep = here for entity. Only 1 record must be modified ! // TODO Add site and site_account on oauth_token table $sql .= " WHERE fk_soc = ".$object->id." AND service = '".$db->escape($service)."' AND entity = ".$conf->entity; // Keep = here for entity. Only 1 record must be modified ! @@ -630,7 +630,7 @@ if (empty($reshook)) $tokenstring['stripe_user_id'] = $stripesup->id; $tokenstring['type'] = $stripesup->type; $sql = "INSERT INTO ".MAIN_DB_PREFIX."oauth_token (service, fk_soc, entity, tokenstring)"; - $sql .= " VALUES ('".$db->escape($service)."', ".$object->id.", ".$conf->entity.", '".dol_json_encode($tokenstring)."')"; + $sql .= " VALUES ('".$db->escape($service)."', ".$object->id.", ".$conf->entity.", '".$db->escape(json_encode($tokenstring))."')"; // TODO Add site and site_account on oauth_token table } catch (Exception $e) { $error++; diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 742072cdcc1..93f1ed066af 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -110,7 +110,7 @@ class Stripe extends CommonObject $obj = $this->db->fetch_object($result); $tokenstring = $obj->tokenstring; - $tmparray = dol_json_decode($tokenstring); + $tmparray = json_decode($tokenstring); $key = $tmparray->stripe_user_id; } else { $tokenstring = ''; From 741806f47ea163e077efdd89a49d57cf7b9fa61f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Nov 2020 16:08:00 +0100 Subject: [PATCH 010/124] Clean code --- htdocs/admin/defaultvalues.php | 5 ++-- htdocs/admin/system/phpinfo.php | 43 ++++++++++++++++++--------------- htdocs/langs/en_US/install.lang | 8 +----- 3 files changed, 26 insertions(+), 30 deletions(-) diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index e3006635b39..a3e015b2d44 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -378,9 +378,8 @@ if ($result) print ''; if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) { - print ''.img_edit().''; - print '   '; - print ''.img_delete().''; + print ''.img_edit().''; + print ''.img_delete().''; } else { print ''; print ''; diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index da21d52cd43..bbca616f9b4 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -122,24 +122,6 @@ if (!function_exists("utf8_encode")) } print ''; -print 'MBString support'; -if (!function_exists("mb_check_encoding")) -{ - print 'Warning '.$langs->trans("ErrorPHPDoesNotSupport", "mbstring"); -} else { - print 'Ok '.$langs->trans("PHPSupport", "mbstring"); -} -print ''; - -print 'JSon support'; -if (!function_exists("json_decode")) -{ - print 'Warning '.$langs->trans("ErrorPHPDoesNotSupport", "json"); -} else { - print 'Ok '.$langs->trans("PHPSupport", "json"); -} -print ''; - print ''; print '
'; @@ -156,6 +138,28 @@ print ''.$langs->trans("FunctionTest").''; print ''.$langs->trans("Result").''; print ''; +$functions = ["mb_check_encoding"]; +$name = "MBString"; + +print ""; +print "".$name.""; +//print getTableColumn($name, $activatedExtensions); +print getTableColumn($name, $loadedExtensions); +print getTableColumnFunction($functions); +print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); +print ""; + +$functions = ["json_decode"]; +$name = "JSON"; + +print ""; +print "".$name.""; +//print getTableColumn($name, $activatedExtensions); +print getTableColumn($name, $loadedExtensions); +print getTableColumnFunction($functions); +print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); +print ""; + $functions = ["imagecreate"]; $name = "GD"; @@ -189,7 +193,6 @@ if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@loc print getTableColumn($name, $loadedExtensions); print getTableColumnFunction($functions); print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); - print ""; } @@ -428,7 +431,7 @@ function getResultColumn($name, array $activated, array $loaded, array $function } $html = ""; - $html .= $result ? $langs->trans("PHPSupport".$name) : $langs->trans("ErrorPHPDoesNotSupport".$name); + $html .= $result ? $langs->trans("PHPSupport", $name) : $langs->trans("ErrorPHPDoesNotSupport".$name); $html .= ""; return $html; diff --git a/htdocs/langs/en_US/install.lang b/htdocs/langs/en_US/install.lang index 2d708c04147..63947dad154 100644 --- a/htdocs/langs/en_US/install.lang +++ b/htdocs/langs/en_US/install.lang @@ -8,15 +8,9 @@ ConfFileIsNotWritable=Configuration file %s is not writable. Check permis ConfFileIsWritable=Configuration file %s is writable. ConfFileMustBeAFileNotADir=Configuration file %s must be a file, not a directory. ConfFileReload=Reloading parameters from configuration file. -PHPSupportSessions=This PHP supports sessions. PHPSupportPOSTGETOk=This PHP supports variables POST and GET. PHPSupportPOSTGETKo=It's possible your PHP setup does not support variables POST and/or GET. Check the parameter variables_order in php.ini. -PHPSupportGD=This PHP supports GD graphical functions. -PHPSupportCurl=This PHP supports Curl. -PHPSupportCalendar=This PHP supports calendars extensions. -PHPSupportUTF8=This PHP supports UTF8 functions. -PHPSupportIntl=This PHP supports Intl functions. -PHPSupportxDebug=This PHP supports extended debug functions. +PHPSupportSessions=This PHP supports sessions. 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. From a804ad4914eb193e41d80a908750875419dea0aa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Nov 2020 16:15:06 +0100 Subject: [PATCH 011/124] css --- 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 bbca616f9b4..78146b85a76 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -231,7 +231,7 @@ foreach ($phparray as $key => $value) print ''.$keyparam.''; $valtoshow = $keyvalue; if ($keyparam == 'X-ChromePhp-Data') $valtoshow = dol_trunc($keyvalue, 80); - print ''; + print ''; if ($keyparam == 'Path') $valtoshow = implode('; ', explode(';', trim($valtoshow))); if ($keyparam == 'PATH') $valtoshow = implode('; ', explode(';', trim($valtoshow))); if ($keyparam == '_SERVER["PATH"]') $valtoshow = implode('; ', explode(';', trim($valtoshow))); From 90884d8085642f1dc2399304eafa6ddf2cfdd200 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Nov 2020 18:08:40 +0100 Subject: [PATCH 012/124] Fix compatibility with date_delivery --- htdocs/comm/propal/card.php | 1 + htdocs/comm/propal/class/propal.class.php | 12 ++++++++++-- htdocs/commande/card.php | 1 + htdocs/commande/class/commande.class.php | 11 +++++++++++ htdocs/commande/list.php | 1 + htdocs/compta/facture/class/facture.class.php | 9 +++++++++ .../box_supplier_orders_awaiting_reception.php | 5 +++-- htdocs/core/class/commonobject.class.php | 5 +++++ htdocs/fourn/class/fournisseur.commande.class.php | 13 +++++++++++-- htdocs/fourn/commande/card.php | 1 + htdocs/supplier_proposal/card.php | 2 ++ .../class/supplier_proposal.class.php | 5 +++-- htdocs/webservices/server_order.php | 4 ++-- 13 files changed, 60 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 9977910518b..8613828f632 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -184,6 +184,7 @@ if (empty($reshook)) if ($difference != 0) { $object->date_livraison = $date_delivery; + $object->delivery_date = $date_delivery; foreach ($object->lines as $line) { if (isset($line->date_start)) $line->date_start = $line->date_start + $difference; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index d81c0fd288a..27f57569c3a 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -152,9 +152,15 @@ class Propal extends CommonObject public $datep; /** - * @var integer|string $delivery_date; + * @var int Date expected for delivery + * @deprecated */ - public $delivery_date; + public $date_livraison; // deprecated; Use delivery_date instead. + + /** + * @var integer|string $delivery_date; + */ + public $delivery_date; // Date expected of shipment (date starting shipment, not the reception that occurs some days after) public $fin_validite; @@ -1518,6 +1524,7 @@ class Propal extends CommonObject $this->datep = $this->db->jdate($obj->dp); // deprecated $this->fin_validite = $this->db->jdate($obj->dfv); $this->date_livraison = $this->db->jdate($obj->date_livraison); + $this->delivery_date = $this->db->jdate($obj->date_livraison); $this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null; $this->availability_id = $obj->fk_availability; $this->availability_code = $obj->availability_code; @@ -2104,6 +2111,7 @@ class Propal extends CommonObject { $this->oldcopy = clone $this; $this->date_livraison = $delivery_date; + $this->date_delivery = $delivery_date; } if (!$notrigger && empty($error)) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index e69b2dfb8da..fd4c895caec 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -275,6 +275,7 @@ if (empty($reshook)) $object->availability_id = GETPOST('availability_id'); $object->demand_reason_id = GETPOST('demand_reason_id'); $object->date_livraison = $datelivraison; + $object->delivery_date = $datelivraison; $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); $object->warehouse_id = GETPOST('warehouse_id', 'int'); $object->fk_delivery_address = GETPOST('fk_address'); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index a86a751dcb5..5c341ac0ffb 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -180,6 +180,12 @@ class Commande extends CommonOrder */ public $date_commande; + /** + * @var int Date expected for delivery + * @deprecated + */ + public $date_livraison; // deprecated; Use delivery_date instead. + public $delivery_date; // Date expected of shipment (date starting shipment, not the reception that occurs some days after) /** @@ -1354,6 +1360,7 @@ class Commande extends CommonOrder $this->availability_id = $object->availability_id; $this->demand_reason_id = $object->demand_reason_id; $this->date_livraison = $object->date_livraison; + $this->delivery_date = $object->date_livraison; $this->shipping_method_id = $object->shipping_method_id; $this->warehouse_id = $object->warehouse_id; $this->fk_delivery_address = $object->fk_delivery_address; @@ -1864,6 +1871,7 @@ class Commande extends CommonOrder $this->demand_reason_id = $obj->fk_input_reason; $this->demand_reason_code = $obj->demand_reason_code; $this->date_livraison = $this->db->jdate($obj->date_livraison); + $this->delivery_date = $this->db->jdate($obj->date_livraison); $this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null; $this->warehouse_id = ($obj->fk_warehouse > 0) ? $obj->fk_warehouse : null; $this->fk_delivery_address = $obj->fk_delivery_address; @@ -2595,6 +2603,7 @@ class Commande extends CommonOrder { $this->oldcopy = clone $this; $this->date_livraison = $delivery_date; + $this->delivery_date = $delivery_date; } if (!$notrigger && empty($error)) @@ -3495,7 +3504,9 @@ class Commande extends CommonOrder $generic_commande->statut = $obj->fk_statut; $generic_commande->date_commande = $this->db->jdate($obj->date_commande); + $generic_commande->date = $this->db->jdate($obj->date_commande); $generic_commande->date_livraison = $this->db->jdate($obj->delivery_date); + $generic_commande->delivery_date = $this->db->jdate($obj->delivery_date); if ($generic_commande->hasDelay()) { $response->nbtodolate++; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 05c6089bfff..1c9cffcdacd 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -932,6 +932,7 @@ if ($resql) $generic_commande->billed = $obj->billed; $generic_commande->date = $db->jdate($obj->date_commande); $generic_commande->date_livraison = $db->jdate($obj->date_delivery); + $generic_commande->delivery_date = $db->jdate($obj->date_delivery); $generic_commande->ref_client = $obj->ref_client; $generic_commande->total_ht = $obj->total_ht; $generic_commande->total_tva = $obj->total_tva; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 5049ed41e57..9c78fa6acb9 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -115,6 +115,14 @@ class Facture extends CommonInvoice public $date; // Date invoice public $datem; + /** + * @var int Date expected for delivery + * @deprecated + */ + public $date_livraison; // deprecated; Use delivery_date instead. + + public $delivery_date; // Date expected of shipment (date starting shipment, not the reception that occurs some days after) + /** * @var string customer ref */ @@ -1331,6 +1339,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->delivery_date = $object->date_livraison; $this->fk_delivery_address = $object->fk_delivery_address; // deprecated $this->contact_id = $object->contact_id; $this->ref_client = $object->ref_client; diff --git a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php index 1d367774432..f59cb8b6e26 100644 --- a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php +++ b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php @@ -86,7 +86,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes $sql = "SELECT s.nom as name, s.rowid as socid,"; $sql .= " s.code_client, s.code_fournisseur, s.email,"; $sql .= " s.logo,"; - $sql .= " c.rowid, c.ref, c.tms, c.date_commande, c.date_livraison, "; + $sql .= " c.rowid, c.ref, c.tms, c.date_commande, c.date_livraison as delivery_date, "; $sql .= " c.total_ht,"; $sql .= " c.tva as total_tva,"; $sql .= " c.total_ttc,"; @@ -112,10 +112,11 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes while ($line < $num) { $objp = $this->db->fetch_object($result); $date = $this->db->jdate($objp->date_commande); - $delivery_date = $this->db->jdate($objp->date_livraison); + $delivery_date = $this->db->jdate($objp->delivery_date); $datem = $this->db->jdate($objp->tms); $supplierorderstatic->date_livraison = $delivery_date; + $supplierorderstatic->delivery_date = $delivery_date; $supplierorderstatic->statut = $objp->fk_statut; $supplierorderstatic->id = $objp->rowid; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1dd68accbc9..d6cdce9f7f5 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -296,6 +296,11 @@ abstract class CommonObject */ public $cond_reglement_id; + /** + * @var int Demand reason ID + */ + public $demand_reason_id; + /** * @var int Transport mode ID (For module intracomm report) * @see setTransportMode() diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 9b927360025..13c1e966c6d 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -114,6 +114,12 @@ class CommandeFournisseur extends CommonOrder public $date_approve2; // Used when SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED is set public $date_commande; + /** + * @var int Date expected for delivery + * @deprecated See delivery_date + */ + public $date_livraison; + /** * Delivery date */ @@ -313,7 +319,7 @@ class CommandeFournisseur extends CommonOrder $sql .= " c.localtax1, c.localtax2, "; $sql .= " c.date_creation, c.date_valid, c.date_approve, c.date_approve2,"; $sql .= " c.fk_user_author, c.fk_user_valid, c.fk_user_approve, c.fk_user_approve2,"; - $sql .= " c.date_commande as date_commande, c.date_livraison as date_livraison, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_projet as fk_project, c.remise_percent, c.source, c.fk_input_method,"; + $sql .= " c.date_commande as date_commande, c.date_livraison as delivery_date, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_projet as fk_project, c.remise_percent, c.source, c.fk_input_method,"; $sql .= " c.fk_account,"; $sql .= " c.note_private, c.note_public, c.model_pdf, c.extraparams, c.billed,"; $sql .= " c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva, c.multicurrency_total_ttc,"; @@ -369,7 +375,8 @@ class CommandeFournisseur extends CommonOrder $this->date_approve = $this->db->jdate($obj->date_approve); $this->date_approve2 = $this->db->jdate($obj->date_approve2); $this->date_commande = $this->db->jdate($obj->date_commande); // date we make the order to supplier - $this->date_livraison = $this->db->jdate($obj->date_livraison); + $this->date_livraison = $this->db->jdate($obj->delivery_date); + $this->delivery_date = $this->db->jdate($obj->delivery_date); $this->remise_percent = $obj->remise_percent; $this->methode_commande_id = $obj->fk_input_method; $this->methode_commande = $obj->methode_commande; @@ -2313,6 +2320,7 @@ class CommandeFournisseur extends CommonOrder { $this->oldcopy = clone $this; $this->date_livraison = $delivery_date; + $this->delivery_date = $delivery_date; } if (!$notrigger && empty($error)) @@ -2918,6 +2926,7 @@ class CommandeFournisseur extends CommonOrder $response->nbtodo++; $commandestatic->date_livraison = $this->db->jdate($obj->delivery_date); + $commandestatic->delivery_date = $this->db->jdate($obj->delivery_date); $commandestatic->date_commande = $this->db->jdate($obj->date_commande); $commandestatic->statut = $obj->fk_statut; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 600e60265d5..5ff7da8a9f0 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1146,6 +1146,7 @@ if (empty($reshook)) $object->note_private = GETPOST('note_private', 'restricthtml'); $object->note_public = GETPOST('note_public', 'restricthtml'); $object->date_livraison = $datelivraison; + $object->delivery_date = $datelivraison; $object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 066d68b8902..5a5e73a1927 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -258,6 +258,7 @@ if (empty($reshook)) if ($object->fetch(GETPOST('copie_supplier_proposal')) > 0) { $object->ref = GETPOST('ref'); $object->date_livraison = $date_delivery; + $object->delivery_date = $date_delivery; $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); $object->cond_reglement_id = GETPOST('cond_reglement_id'); $object->mode_reglement_id = GETPOST('mode_reglement_id'); @@ -279,6 +280,7 @@ if (empty($reshook)) } else { $object->ref = GETPOST('ref'); $object->date_livraison = $date_delivery; + $object->delivery_date = $date_delivery; $object->demand_reason_id = GETPOST('demand_reason_id'); $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); $object->cond_reglement_id = GETPOST('cond_reglement_id'); diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index e189d149bf7..59305cf7548 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1201,7 +1201,7 @@ class SupplierProposal extends CommonObject $sql .= ", p.total, p.tva, p.localtax1, p.localtax2, p.total_ht"; $sql .= ", p.datec"; $sql .= ", p.date_valid as datev"; - $sql .= ", p.date_livraison as date_livraison"; + $sql .= ", p.date_livraison as delivery_date"; $sql .= ", p.model_pdf, p.extraparams"; $sql .= ", p.note_private, p.note_public"; $sql .= ", p.fk_projet as fk_project, p.fk_statut"; @@ -1256,7 +1256,8 @@ class SupplierProposal extends CommonObject $this->datev = $this->db->jdate($obj->datev); // TODO deprecated $this->date_creation = $this->db->jdate($obj->datec); //Creation date $this->date_validation = $this->db->jdate($obj->datev); //Validation date - $this->date_livraison = $this->db->jdate($obj->date_livraison); + $this->date_livraison = $this->db->jdate($obj->delivery_date); + $this->delivery_date = $this->db->jdate($obj->delivery_date); $this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null; $this->mode_reglement_id = $obj->fk_mode_reglement; diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 03833b9f6d9..62e8dc99d72 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -464,7 +464,7 @@ function getOrder($authentication, $id = '', $ref = '', $ref_ext = '') 'mode_reglement_code' => $order->mode_reglement_code, 'mode_reglement' => $order->mode_reglement, - 'date_livraison' => $order->date_livraison, + 'date_livraison' => $order->delivery_date, 'demand_reason_id' => $order->demand_reason_id, 'demand_reason_code' => $order->demand_reason_code, @@ -621,7 +621,7 @@ function getOrdersForThirdParty($authentication, $idthirdparty) 'mode_reglement' => $order->mode_reglement, 'mode_reglement_code' => $order->mode_reglement_code, - 'date_livraison' => $order->date_livraison, + 'date_livraison' => $order->delivery_date, 'demand_reason_id' => $order->demand_reason_id, 'demand_reason_code' => $order->demand_reason_code, From 03e60bf0845faeacd884a632fa5ab52eabc2b830 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Nov 2020 20:27:21 +0100 Subject: [PATCH 013/124] Fix warning --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d6cdce9f7f5..8518d232115 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5083,7 +5083,7 @@ abstract class CommonObject global $conf, $extrafields; if (empty($rowid)) $rowid = $this->id; - if (empty($rowid)) $rowid = $this->rowid; + if (empty($rowid) && isset($this->rowid)) $rowid = $this->rowid; // deprecated // To avoid SQL errors. Probably not the better solution though if (!$this->table_element) { From 71f09dc2d86a6e9670f1c7fb51bf84ac091e34fe Mon Sep 17 00:00:00 2001 From: "jove@bisquerra.com" Date: Wed, 11 Nov 2020 21:51:32 +0100 Subject: [PATCH 014/124] Update receipt tab in TakePOS --- htdocs/takepos/admin/orderprinters.php | 2 ++ htdocs/takepos/admin/receipt.php | 16 ++++++---------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/htdocs/takepos/admin/orderprinters.php b/htdocs/takepos/admin/orderprinters.php index c7ebbebffb7..3104f907eb2 100644 --- a/htdocs/takepos/admin/orderprinters.php +++ b/htdocs/takepos/admin/orderprinters.php @@ -215,6 +215,8 @@ if ($nbofentries > 0) print ''; print ''; } +print ""; +print ''; //Printer3 print ''; diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index 0427e239792..3399b98b643 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -65,6 +65,8 @@ if (GETPOST('action', 'alpha') == 'set') } elseif (GETPOST('action', 'alpha') == 'setmethod') { dolibarr_set_const($db, "TAKEPOS_PRINT_METHOD", GETPOST('value', 'alpha'), 'chaine', 0, '', $conf->entity); + // TakePOS connector require ReceiptPrinter module + if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector" && !$conf->receiptprinter->enabled) activateModule("modReceiptPrinter"); } @@ -109,7 +111,7 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "browser") print "\n"; // Receipt printer module -if ($conf->global->MAIN_FEATURES_LEVEL >= 1) { +if ($conf->receiptprinter->enabled) { print '\n"; } From 767f07d02e1b6466f0574517426a38c70625c933 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Nov 2020 22:47:06 +0100 Subject: [PATCH 015/124] Debug function to show list of files in ECM module --- htdocs/core/class/html.formfile.class.php | 54 ++++++++++++++++++----- htdocs/core/lib/files.lib.php | 23 ++++++---- 2 files changed, 58 insertions(+), 19 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index c41c61be536..0381a031a7d 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1035,10 +1035,9 @@ class FormFile public function list_of_documents($filearray, $object, $modulepart, $param = '', $forcedownload = 0, $relativepath = '', $permonobject = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $title = '', $url = '', $showrelpart = 0, $permtoeditline = -1, $upload_dir = '', $sortfield = '', $sortorder = 'ASC', $disablemove = 1, $addfilterfields = 0, $disablecrop = -1) { // phpcs:enable - global $user, $conf, $langs, $hookmanager; + global $user, $conf, $langs, $hookmanager, $form; global $sortfield, $sortorder, $maxheightmini; global $dolibarr_main_url_root; - global $form; if ($disablecrop == -1) { @@ -1407,9 +1406,9 @@ class FormFile // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Show list of documents in a directory + * Show list of documents in a directory of ECM module. * - * @param string $upload_dir Directory that was scanned + * @param string $upload_dir Directory that was scanned. This directory will contains files into subdirs REF/files * @param array $filearray Array of files loaded by dol_dir_list function before calling this function * @param string $modulepart Value for modulepart used by download wrapper * @param string $param Parameters on sort links @@ -1427,9 +1426,10 @@ class FormFile public function list_of_autoecmfiles($upload_dir, $filearray, $modulepart, $param, $forcedownload = 0, $relativepath = '', $permissiontodelete = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $url = '', $addfilterfields = 0) { // phpcs:enable - global $user, $conf, $langs, $form; + global $user, $conf, $langs, $hookmanager, $form; global $sortfield, $sortorder; global $search_doc_ref; + global $dolibarr_main_url_root; dol_syslog(get_class($this).'::list_of_autoecmfiles upload_dir='.$upload_dir.' modulepart='.$modulepart); @@ -1547,6 +1547,23 @@ class FormFile $object_instance = new Mo($this->db); } + //var_dump($filearray); + + // Get list of files stored into database for same relative directory + $relativepathfromroot = preg_replace('/'.preg_quote(DOL_DATA_ROOT.'/', '/').'/', '', $upload_dir); + if ($relativepathfromroot) + { + completeFileArrayWithDatabaseInfo($filearray, $relativepathfromroot.'/%'); + + //var_dump($sortfield.' - '.$sortorder); + if ($sortfield && $sortorder) // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name) + { + $filearray = dol_sort_array($filearray, $sortfield, $sortorder); + } + } + + //var_dump($filearray); + foreach ($filearray as $key => $file) { if (!is_dir($file['name']) @@ -1558,7 +1575,7 @@ class FormFile // Define relative path used to store the file $relativefile = preg_replace('/'.preg_quote($upload_dir.'/', '/').'/', '', $file['fullname']); - $id = 0; $ref = ''; $label = ''; + $id = 0; $ref = ''; // To show ref or specific information according to view to show (defined by $module) $reg = array(); @@ -1590,7 +1607,7 @@ class FormFile { $found = 1; } else { - //print 'Fetch '.$id." - ".$ref.'
'; + //print 'Fetch '.$id." - ".$ref.' class='.get_class($object_instance).'
'; if ($id) { $result = $object_instance->fetch($id); @@ -1619,13 +1636,12 @@ class FormFile else print $langs->trans("ObjectDeleted", ($id ? $id : $ref)); //$modulesubdir=dol_sanitizeFileName($ref); - $modulesubdir = dirname($relativefile); + //$modulesubdir = dirname($relativefile); //$filedir=$conf->$modulepart->dir_output . '/' . dol_sanitizeFileName($obj->ref); - $filedir = $file['path']; + //$filedir = $file['path']; //$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; //print $formfile->getDocumentsLink($modulepart, $filename, $filedir); - print ''; // File @@ -1639,12 +1655,30 @@ class FormFile print ''; //print $this->getDocumentsLink($modulepart, $modulesubdir, $filedir, '^'.preg_quote($file['name'],'/').'$'); + print $this->showPreview($file, $modulepart, $file['relativename']); print "\n"; print '
'; print ''; print '\n"; // Receipt printer module +print '\n"; +} else { + print ''; + print $langs->trans("ModuleReceiptPrinterMustBeEnabled"); + print ''; } +print "\n"; // TakePOS Connector print '\n"; - print ''; + + // Size + $sizetoshow = dol_print_size($file['size'], 1, 1); + $sizetoshowbytes = dol_print_size($file['size'], 0, 1); + print ''; + + // Date print ''; + + // Share link print ''; print ''."\n"; } diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index 2f0978ed266..f978c0dcd81 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -25,6 +25,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php'; // Load translation files required by the page $langs->loadLangs(array("install", "other", "admin")); @@ -52,7 +53,7 @@ print load_fiche_titre($langs->trans("Security"), '', 'title_setup'); print ''.$langs->trans("YouMayFindSecurityAdviceHere", 'hhttps://wiki.dolibarr.org/index.php/Security_information').' ('.$langs->trans("Reload").')
'; print '
'; -print load_fiche_titre($langs->trans("PHPSetup"), '', ''); +print load_fiche_titre($langs->trans("PHPSetup"), '', 'folder'); // Get version of PHP $phpversion = version_php(); @@ -77,7 +78,7 @@ else { print '
'; print '
'; -print load_fiche_titre($langs->trans("ConfigFile"), '', ''); +print load_fiche_titre($langs->trans("ConfigFile"), '', 'folder'); print ''.$langs->trans("dolibarr_main_prod").': '.$dolibarr_main_prod; if (empty($dolibarr_main_prod)) { @@ -94,7 +95,7 @@ print '
'; print '
'; print '
'; -print load_fiche_titre($langs->trans("Permissions"), '', ''); +print load_fiche_titre($langs->trans("Permissions"), '', 'folder'); print ''.$langs->trans("PermissionsOnFilesInWebRoot").': '; // TODO Check permission are read only except for custom dir @@ -109,7 +110,7 @@ print '
'; print '
'; print '
'; -print load_fiche_titre($langs->trans("DolibarrModules"), '', ''); +print load_fiche_titre($langs->trans("Modules"), '', 'folder'); // Module log print ''.$langs->trans("Syslog").': '; @@ -133,10 +134,12 @@ print '
'; print '
'; print '
'; -print load_fiche_titre($langs->trans("Menu").' '.$langs->trans("SecuritySetup"), '', ''); +print load_fiche_titre($langs->trans("Menu").' '.$langs->trans("SecuritySetup"), '', 'folder'); //print ''.$langs->trans("PasswordEncryption").': '; -print 'MAIN_SECURITY_HASH_ALGO = '.$conf->global->MAIN_SECURITY_HASH_ALGO."   (Recommanded value: 'password_hash')
"; +print 'MAIN_SECURITY_HASH_ALGO = '.(empty($conf->global->MAIN_SECURITY_HASH_ALGO) ? 'unset' : '')."   "; +print '   If unset: \'md5\' '; +print ' - Recommanded value: \'password_hash\'
'; print 'MAIN_SECURITY_SALT = '.$conf->global->MAIN_SECURITY_SALT.'
'; print '
'; // TODO @@ -153,10 +156,20 @@ print '
'; print '
'; -print ''.$langs->trans("SecurityAudit").': '; -// TODO Disabled or enabled ? -print '
'; +$securityevent = new Events($db); +$eventstolog = $securityevent->eventstolog; +print ''.$langs->trans("LogEvents").': '; +// Loop on each event type +foreach ($eventstolog as $key => $arr) +{ + if ($arr['id']) + { + $key = 'MAIN_LOGEVENTS_'.$arr['id']; + $value = empty($conf->global->$key) ? '' : $conf->global->$key; + if ($value) print $key.', '; + } +} From 7be3a2267e64d1f448d71b7e462f2ca318c79975 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Nov 2020 22:23:21 +0100 Subject: [PATCH 040/124] Add missing vat rates --- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index d52257c4157..f308db3525c 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -59,6 +59,10 @@ ALTER TABLE llx_mrp_mo_extrafields ADD INDEX idx_mrp_mo_fk_object(fk_object); -- For v13 +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (111,11, '0','0','No Sales Tax',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (112,11, '4','0','Sales Tax 4%',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (113,11, '6','0','Sales Tax 6%',1); + ALTER TABLE llx_bom_bom ADD COLUMN bomtype integer DEFAULT 0; UPDATE llx_emailcollector_emailcollector SET ref = 'Collect_Ticket_Requests' WHERE ref = 'Collect_Ticket_Requets'; From a5ffac1935c3a6cb882b2a9417b89a6f97535024 Mon Sep 17 00:00:00 2001 From: "jove@bisquerra.com" Date: Thu, 12 Nov 2020 22:31:32 +0100 Subject: [PATCH 041/124] Compatibility with new TakePOS connector --- htdocs/takepos/admin/terminal.php | 4 +- htdocs/takepos/invoice.php | 81 +++++++++++++++++++++++-------- 2 files changed, 64 insertions(+), 21 deletions(-) diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index 8ae37c2b8f7..870feb71778 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -41,7 +41,7 @@ if (!empty($_REQUEST['CASHDESK_ID_THIRDPARTY'.$terminal.'_id'])) // Security check if (!$user->admin) accessforbidden(); -$langs->loadLangs(array("admin", "cashdesk", "printing")); +$langs->loadLangs(array("admin", "cashdesk", "printing", "receiptprinter")); global $db; @@ -255,7 +255,7 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" || $conf->global->TA foreach ($printer->listprinterstemplates as $key => $value) { $templates[$value['rowid']] = $value['name']; } - print ''; + print ''; print ''; diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index fc1e690e263..1254a5ecf7c 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -672,7 +672,7 @@ if ($action == "updatereduction") if ($action == "order" and $placeid != 0) { include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; - if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") { + if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" || $conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") { require_once DOL_DOCUMENT_ROOT.'/core/class/dolreceiptprinter.class.php'; $printer = new dolReceiptPrinter($db); } @@ -703,10 +703,13 @@ if ($action == "order" and $placeid != 0) $order_receipt_printer1 .= ''; } } - if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" && $linestoprint > 0) { + if (($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" || $conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") && $linestoprint > 0) { $invoice->fetch($placeid); //Reload object before send to printer $printer->orderprinter = 1; + echo ""; } $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='4' where special_code='1' and fk_facture=".$invoice->id; // Set as printed $db->query($sql); @@ -731,10 +734,13 @@ if ($action == "order" and $placeid != 0) $order_receipt_printer2 .= ''; } } - if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" && $linestoprint > 0) { + if (($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" || $conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") && $linestoprint > 0) { $invoice->fetch($placeid); //Reload object before send to printer $printer->orderprinter = 2; + echo ""; } $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='4' where special_code='2' and fk_facture=".$invoice->id; // Set as printed $db->query($sql); @@ -759,10 +765,13 @@ if ($action == "order" and $placeid != 0) $order_receipt_printer3 .= ''; } } - if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" && $linestoprint > 0) { + if (($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" || $conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") && $linestoprint > 0) { $invoice->fetch($placeid); //Reload object before send to printer $printer->orderprinter = 3; + echo ""; } $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='4' where special_code='3' and fk_facture=".$invoice->id; // Set as printed $db->query($sql); @@ -841,25 +850,59 @@ $(document).ready(function() { - $.ajax({ - type: "POST", - url: 'http://global->TAKEPOS_PRINT_SERVER; ?>:8111/print', - data: '' - }); - global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true){ + ?> + $.ajax({ + type: "POST", + url: 'global->TAKEPOS_PRINT_SERVER; ?>/printer/index.php', + data: 'invoice='+orderprinter1esc + }); + + $.ajax({ + type: "POST", + url: 'http://global->TAKEPOS_PRINT_SERVER; ?>:8111/print', + data: '' + }); + - $.ajax({ - type: "POST", - url: 'http://global->TAKEPOS_PRINT_SERVER; ?>:8111/print2', - data: '' - }); + if (filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true){ + ?> + $.ajax({ + type: "POST", + url: 'global->TAKEPOS_PRINT_SERVER; ?>/printer/index.php?printer=2', + data: 'invoice='+orderprinter2esc + }); + + $.ajax({ + type: "POST", + url: 'http://global->TAKEPOS_PRINT_SERVER; ?>:8111/print2', + data: '' + }); global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true){ + ?> + $.ajax({ + type: "POST", + url: 'global->TAKEPOS_PRINT_SERVER; ?>/printer/index.php?printer=3', + data: 'invoice='+orderprinter3esc + }); + Date: Thu, 12 Nov 2020 22:50:46 +0100 Subject: [PATCH 042/124] Fix travis --- htdocs/takepos/invoice.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 1254a5ecf7c..9c4a5320c58 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -859,7 +859,7 @@ if ($action == "order" and $order_receipt_printer1 != "") { }); $.ajax({ type: "POST", @@ -881,7 +881,7 @@ if ($action == "order" and $order_receipt_printer2 != "") { }); $.ajax({ type: "POST", @@ -889,7 +889,7 @@ if ($action == "order" and $order_receipt_printer2 != "") { data: '' }); - Date: Fri, 13 Nov 2020 00:25:12 +0100 Subject: [PATCH 043/124] Fix ticket/index.php Warning: mysqli_result::free_result(): Couldn't fetch mysqli_result in /var/www/html/core/db/mysqli.class.php on line 390 --- htdocs/ticket/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/index.php b/htdocs/ticket/index.php index ed304c43976..52e10f78454 100644 --- a/htdocs/ticket/index.php +++ b/htdocs/ticket/index.php @@ -387,7 +387,7 @@ if ($result) { $i++; } - $db->free(); + $db->free($result); } else { print ''; } From 283645ae129ee5ff60320cbcaefb185adf592e33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien?= Date: Fri, 13 Nov 2020 00:27:57 +0100 Subject: [PATCH 044/124] Fix ticket/list.php Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/core/tpl/extrafields_list_array_fields.tpl.php:3) in /var/www/html/main.inc.php on line 1152 --- htdocs/core/tpl/extrafields_list_array_fields.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/extrafields_list_array_fields.tpl.php b/htdocs/core/tpl/extrafields_list_array_fields.tpl.php index 54cb8cbc93b..1e98952ae71 100644 --- a/htdocs/core/tpl/extrafields_list_array_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_array_fields.tpl.php @@ -1,6 +1,6 @@ '."\n"; +// print ''."\n"; // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) From d9d32524f7712300c9e943b933cf1f221234b8fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien?= Date: Fri, 13 Nov 2020 00:36:25 +0100 Subject: [PATCH 045/124] Fix #14460 --- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 2 ++ htdocs/install/mysql/tables/llx_c_ticket_severity.sql | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index d52257c4157..e7e3378a5af 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -362,6 +362,8 @@ ALTER TABLE llx_facturedet ADD COLUMN ref_ext varchar(255) AFTER multicurrency_t ALTER TABLE llx_c_ticket_category ADD COLUMN fk_parent integer DEFAULT 0 NOT NULL; ALTER TABLE llx_c_ticket_category ADD COLUMN force_severity varchar(32) NULL; +ALTER TABLE llx_c_ticket_severity CHANGE color color VARCHAR(10) NULL; + ALTER TABLE llx_expensereport ADD COLUMN fk_user_creat integer NULL; ALTER TABLE llx_expensereport_ik ADD COLUMN ikoffset double DEFAULT 0 NOT NULL; diff --git a/htdocs/install/mysql/tables/llx_c_ticket_severity.sql b/htdocs/install/mysql/tables/llx_c_ticket_severity.sql index bb8a75abaa9..b9f565c4395 100644 --- a/htdocs/install/mysql/tables/llx_c_ticket_severity.sql +++ b/htdocs/install/mysql/tables/llx_c_ticket_severity.sql @@ -22,7 +22,7 @@ create table llx_c_ticket_severity code varchar(32) NOT NULL, pos varchar(32) NOT NULL, label varchar(128) NOT NULL, - color varchar(10) NOT NULL, + color varchar(10) NULL, active integer DEFAULT 1, use_default integer DEFAULT 1, description varchar(255) From 6d4d3c618d286d00ccb55b0db30d35e49112d2ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Nov 2020 09:55:53 +0100 Subject: [PATCH 046/124] FIX #15369 and standardize permission "readall" --- htdocs/core/lib/usergroups.lib.php | 2 +- htdocs/core/menus/standard/eldy.lib.php | 2 +- .../core/modules/facture/doc/pdf_crabe.modules.php | 2 +- htdocs/core/modules/modHoliday.class.php | 8 ++++---- htdocs/core/modules/modSalaries.class.php | 10 +++++++++- htdocs/holiday/card.php | 2 +- htdocs/holiday/class/holiday.class.php | 2 +- htdocs/holiday/define_holiday.php | 4 ++-- htdocs/holiday/list.php | 10 +++++----- htdocs/holiday/view_log.php | 2 +- htdocs/hrm/index.php | 2 +- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 1 + htdocs/langs/en_US/admin.lang | 5 +++-- htdocs/salaries/list.php | 13 ++++++++----- htdocs/user/bank.php | 4 ++-- 15 files changed, 41 insertions(+), 28 deletions(-) diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index c464d36c5c1..9277ebbd81b 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -137,7 +137,7 @@ function user_prepare_head($object) if ((!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read)) || (!empty($conf->hrm->enabled) && !empty($user->rights->hrm->employee->read)) || (!empty($conf->expensereport->enabled) && !empty($user->rights->expensereport->lire) && ($user->id == $object->id || $user->rights->expensereport->readall)) - || (!empty($conf->holiday->enabled) && !empty($user->rights->holiday->read) && ($user->id == $object->id || $user->rights->holiday->read_all)) + || (!empty($conf->holiday->enabled) && !empty($user->rights->holiday->read) && ($user->id == $object->id || $user->rights->holiday->readall)) ) { // Bank $head[$h][0] = DOL_URL_ROOT.'/user/bank.php?id='.$object->id; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 8f7501e3fce..ab6c072b1be 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1800,7 +1800,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/holiday/list.php?search_statut=5&mainmenu=hrm&leftmenu=hrm", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read); } $newmenu->add("/holiday/define_holiday.php?mainmenu=hrm&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->read); - $newmenu->add("/holiday/month_report.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->read_all); + $newmenu->add("/holiday/month_report.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->readall); $newmenu->add("/holiday/view_log.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday); } diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index d82e711e7e6..8323400d16c 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -322,7 +322,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetAutoPageBreak(1, 0); $heightforinfotot = 50 + (4 * $nbpayments); // Height reserved to output the info and total part and payment part - if($heightforinfotot > 220) $heightforinfotot = 220; + if ($heightforinfotot > 220) $heightforinfotot = 220; $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 (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index a146a855ccb..6c6eaba69e0 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -140,14 +140,14 @@ class modHoliday extends DolibarrModules $r = 0; $this->rights[$r][0] = 20001; // Permission id (must not be already used) - $this->rights[$r][1] = 'Read your own leave requests'; // Permission label + $this->rights[$r][1] = 'Read leave requests (yours and your subordinates)'; // Permission label $this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $r++; $this->rights[$r][0] = 20002; // Permission id (must not be already used) - $this->rights[$r][1] = 'Create/modify your own leave requests'; // Permission label + $this->rights[$r][1] = 'Create/modify leave requests'; // Permission label $this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) @@ -170,7 +170,7 @@ class modHoliday extends DolibarrModules $this->rights[$r][0] = 20004; // Permission id (must not be already used) $this->rights[$r][1] = 'Read leave requests for everybody'; // Permission label $this->rights[$r][3] = 0; // Permission by default for new user (0/1) - $this->rights[$r][4] = 'read_all'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $this->rights[$r][4] = 'readall'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $r++; @@ -201,7 +201,7 @@ class modHoliday extends DolibarrModules $this->export_code[$r] = 'leaverequest_'.$r; $this->export_label[$r] = 'ListeCP'; $this->export_icon[$r] = 'holiday'; - $this->export_permission[$r] = array(array("holiday", "read_all")); + $this->export_permission[$r] = array(array("holiday", "readall")); $this->export_fields_array[$r] = array( 'd.rowid'=>"LeaveId", 'd.fk_type'=>'TypeOfLeaveId', 't.code'=>'TypeOfLeaveCode', 't.label'=>'TypeOfLeaveLabel', 'd.fk_user'=>'UserID', 'u.lastname'=>'Lastname', 'u.firstname'=>'Firstname', 'u.login'=>"Login", 'd.date_debut'=>'DateStart', 'd.date_fin'=>'DateEnd', 'd.halfday'=>'HalfDay', 'none.num_open_days'=>'NbUseDaysCP', diff --git a/htdocs/core/modules/modSalaries.class.php b/htdocs/core/modules/modSalaries.class.php index 7159ca634d5..23c892333d8 100644 --- a/htdocs/core/modules/modSalaries.class.php +++ b/htdocs/core/modules/modSalaries.class.php @@ -101,7 +101,7 @@ class modSalaries extends DolibarrModules $r++; $this->rights[$r][0] = 511; - $this->rights[$r][1] = 'Read payments of employee salaries'; + $this->rights[$r][1] = 'Read payments of employee salaries (yours and your subordinates)'; $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'read'; @@ -125,6 +125,13 @@ class modSalaries extends DolibarrModules $r++; $this->rights[$r][0] = 517; + $this->rights[$r][1] = 'Read payments of salariests of every employee'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'readall'; + + $r++; + $this->rights[$r][0] = 519; $this->rights[$r][1] = 'Export payments of employee salaries'; $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 0; @@ -132,6 +139,7 @@ class modSalaries extends DolibarrModules $this->rights[$r][5] = ''; + // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 2f2c9145beb..53a22f83eee 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -73,7 +73,7 @@ if (($id > 0) || $ref) // Check current user can read this leave request $canread = 0; - if (!empty($user->rights->holiday->read_all)) $canread = 1; + if (!empty($user->rights->holiday->readall)) $canread = 1; if (!empty($user->rights->holiday->read) && in_array($object->fk_user, $childids)) $canread = 1; if (!$canread) { diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 262185df4c5..0677cd2f601 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -2116,7 +2116,7 @@ class Holiday extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX."holiday as h"; $sql .= " WHERE h.statut > 1"; $sql .= " AND h.entity IN (".getEntity('holiday').")"; - if (empty($user->rights->expensereport->read_all)) + if (empty($user->rights->expensereport->readall)) { $userchildids = $user->getAllChildIds(1); $sql .= " AND (h.fk_user IN (".join(',', $userchildids).")"; diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 47f6eeda550..585c80e3e6d 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -206,7 +206,7 @@ $filters = ''; // Filter on array of ids of all childs $userchilds = array(); -if (empty($user->rights->holiday->read_all)) +if (empty($user->rights->holiday->readall)) { $userchilds = $user->getAllChildIds(1); $filters .= ' AND u.rowid IN ('.join(', ', $userchilds).')'; @@ -293,7 +293,7 @@ if (count($typeleaves) == 0) foreach ($listUsers as $users) { // If user has not permission to edit/read all, we must see only subordinates - if (empty($user->rights->holiday->read_all)) + if (empty($user->rights->holiday->readall)) { if (($users['rowid'] != $user->id) && (!in_array($users['rowid'], $userchilds))) continue; // This user is not into hierarchy of current user, we hide it. } diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 615ab6cfa44..bfdef939be3 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -70,7 +70,7 @@ if ($id > 0) { $canread = 0; if ($id == $user->id) $canread = 1; - if (!empty($user->rights->holiday->read_all)) $canread = 1; + if (!empty($user->rights->holiday->readall)) $canread = 1; if (!empty($user->rights->holiday->read) && in_array($id, $childids)) $canread = 1; if (!$canread) { @@ -318,7 +318,7 @@ if (!empty($search_status) && $search_status != -1) { $sql .= " AND cp.statut = '".$db->escape($search_status)."'\n"; } -if (empty($user->rights->holiday->read_all)) $sql .= ' AND cp.fk_user IN ('.join(',', $childids).')'; +if (empty($user->rights->holiday->readall)) $sql .= ' AND cp.fk_user IN ('.join(',', $childids).')'; if ($id > 0) $sql .= " AND cp.fk_user IN (".$id.")"; // Add where from extra fields @@ -469,7 +469,7 @@ if ($resql) $include = ''; - if (empty($user->rights->holiday->read_all)) $include = 'hierarchyme'; // Can see only its hierarchyl + if (empty($user->rights->holiday->readall)) $include = 'hierarchyme'; // Can see only its hierarchyl print '
'; print '
'; print $langs->trans('DolibarrReceiptPrinter'); print ''; @@ -117,16 +119,10 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 1) { print '
'; print ''.$langs->trans("Setup").''; print '
'; - if ($conf->receiptprinter->enabled) { - if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") { - print img_picto($langs->trans("Activated"), 'switch_on'); - } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; - } + if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") { + print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; - print $langs->trans("ModuleReceiptPrinterMustBeEnabled"); - print ''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print "
'.dol_print_size($file['size'], 1, 1).''.dol_print_date($file['date'], "dayhour").''; + if ($file['share']) { + // 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 + //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + + //print ''.$langs->trans("Hash").' : '.$file['share'].''; + $forcedownload = 0; + $paramlink = ''; + if (!empty($file['share'])) $paramlink .= ($paramlink ? '&' : '').'hashp='.$file['share']; // Hash for public share + if ($forcedownload) $paramlink .= ($paramlink ? '&' : '').'attachment=1'; + + $fulllink = $urlwithroot.'/document.php'.($paramlink ? '?'.$paramlink : ''); + + print img_picto($langs->trans("FileSharedViaALink"), 'globe').' '; + print ''; + } //if (! empty($useinecm) && $useinecm != 6) print ''; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index dd74ce70a64..0be1cfbc3bc 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -228,8 +228,12 @@ function dol_dir_list_in_database($path, $filter = "", $excludefilter = null, $s $sql .= " date_c, tms as date_m, fk_user_c, fk_user_m, acl, position, share"; if ($mode) $sql .= ", description"; $sql .= " FROM ".MAIN_DB_PREFIX."ecm_files"; - $sql .= " WHERE filepath = '".$db->escape($path)."'"; - $sql .= " AND entity = ".$conf->entity; + $sql .= " WHERE entity = ".$conf->entity; + if (preg_match('/%$/', $path)) { + $sql .= " AND filepath LIKE '".$db->escape($path)."'"; + } else { + $sql .= " AND filepath = '".$db->escape($path)."'"; + } $resql = $db->query($sql); if ($resql) @@ -242,6 +246,7 @@ function dol_dir_list_in_database($path, $filter = "", $excludefilter = null, $s $obj = $db->fetch_object($resql); if ($obj) { + $reg = array(); preg_match('/([^\/]+)\/[^\/]+$/', DOL_DATA_ROOT.'/'.$obj->filepath.'/'.$obj->filename, $reg); $level1name = (isset($reg[1]) ? $reg[1] : ''); $file_list[] = array( @@ -289,7 +294,7 @@ function dol_dir_list_in_database($path, $filter = "", $excludefilter = null, $s * Complete $filearray with data from database. * This will call doldir_list_indatabase to complate filearray. * - * @param array $filearray Array of files get using dol_dir_list + * @param array $filearray Array of files obtained using dol_dir_list * @param string $relativedir Relative dir from DOL_DATA_ROOT * @return void */ @@ -315,19 +320,19 @@ function completeFileArrayWithDatabaseInfo(&$filearray, $relativedir) } } - //var_dump($filearray); - //var_dump($filearrayindatabase); + /*var_dump($relativedir); + var_dump($filearray); + var_dump($filearrayindatabase);*/ // Complete filearray with properties found into $filearrayindatabase foreach ($filearray as $key => $val) { $tmpfilename = preg_replace('/\.noexe$/', '', $filearray[$key]['name']); - $found = 0; // Search if it exists into $filearrayindatabase foreach ($filearrayindatabase as $key2 => $val2) { - if ($filearrayindatabase[$key2]['name'] == $tmpfilename) + if (($filearrayindatabase[$key2]['path'] == $filearray[$key]['path']) && ($filearrayindatabase[$key2]['name'] == $tmpfilename)) { $filearray[$key]['position_name'] = ($filearrayindatabase[$key2]['position'] ? $filearrayindatabase[$key2]['position'] : '0').'_'.$filearrayindatabase[$key2]['name']; $filearray[$key]['position'] = $filearrayindatabase[$key2]['position']; @@ -348,6 +353,7 @@ function completeFileArrayWithDatabaseInfo(&$filearray, $relativedir) $filearray[$key]['acl'] = ''; $rel_filename = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filearray[$key]['fullname']); + if (!preg_match('/([\\/]temp[\\/]|[\\/]thumbs|\.meta$)/', $rel_filename)) // If not a tmp file { dol_syslog("list_of_documents We found a file called '".$filearray[$key]['name']."' not indexed into database. We add it"); @@ -379,8 +385,7 @@ function completeFileArrayWithDatabaseInfo(&$filearray, $relativedir) } } } - - /*var_dump($filearray);*/ + //var_dump($filearray); var_dump($relativedir.' - tmpfilename='.$tmpfilename.' - found='.$found); } From f3756403504462e0987a325d01c54c5e616a8a6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Nov 2020 23:24:09 +0100 Subject: [PATCH 016/124] Update cactioncomm.class.php --- .../comm/action/class/cactioncomm.class.php | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 01afdb8a49c..3b932b2f59c 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -43,16 +43,36 @@ class CActionComm */ public $id; + /** + * @var string code + */ public $code; + + /** + * @var string type + */ public $type; - public $libelle; // deprecated + + /** + * @var string label + * @deprecated + * @see $label + */ + public $libelle; /** * @var string Type of agenda event label */ public $label; + /** + * @var int active + */ public $active; + + /** + * @var string color hex + */ public $color; /** @@ -60,6 +80,9 @@ class CActionComm */ public $picto; + /** + * @var array array of type_actions + */ public $type_actions = array(); @@ -76,14 +99,14 @@ class CActionComm /** * Load action type from database * - * @param int $id id or code of action type to read - * @return int 1=ok, 0=not found, -1=error + * @param int|string $id id or code of action type to read + * @return int 1=ok, 0=not found, -1=error */ public function fetch($id) { $sql = "SELECT id, code, type, libelle as label, color, active, picto"; $sql .= " FROM ".MAIN_DB_PREFIX."c_actioncomm"; - if (is_numeric($id)) $sql .= " WHERE id=".$id; + if (is_numeric($id)) $sql .= " WHERE id=".(int) $id; else $sql .= " WHERE code='".$this->db->escape($id)."'"; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); @@ -138,7 +161,9 @@ class CActionComm $sql = "SELECT id, code, libelle as label, module, type, color, picto"; $sql .= " FROM ".MAIN_DB_PREFIX."c_actioncomm"; $sql .= " WHERE 1=1"; - if ($active != '') $sql .= " AND active=".$active; + if ($active != '') { + $sql .= " AND active=".(int) $active; + } if (!empty($excludetype)) $sql .= " AND type <> '".$this->db->escape($excludetype)."'"; if ($morefilter) $sql .= " AND ".$morefilter; $sql .= " ORDER BY module, position, type"; From 576e1e1de8e64522fa10877293eb428cf138772d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Nov 2020 23:42:24 +0100 Subject: [PATCH 017/124] Fix pdf crabe --- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 82149032c86..ebf4051708a 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -276,9 +276,9 @@ class pdf_crabe extends ModelePDFFactures { $object->fetch_thirdparty(); - $deja_regle = $object->getSommePaiement(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0); - $amount_credit_notes_included = $object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0); - $amount_deposits_included = $object->getSumDepositsUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0); + $deja_regle = $object->getSommePaiement((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0); + $amount_credit_notes_included = $object->getSumCreditNotesUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0); + $amount_deposits_included = $object->getSumDepositsUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0); // Definition of $dir and $file if ($object->specimen) From ec283dc04fa178bb5a9ea7348a3f16db1c4d522c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Nov 2020 23:50:46 +0100 Subject: [PATCH 018/124] Removed duplicated translation keys --- htdocs/ecm/index_auto.php | 34 +++++++++++++++++----------------- htdocs/ecm/search.php | 25 +++++++++++++++++-------- htdocs/langs/en_US/ecm.lang | 14 +------------- 3 files changed, 35 insertions(+), 38 deletions(-) diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index 94ddecc48ba..452f06efb0a 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -310,23 +310,23 @@ $sectionauto = array(); if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) { if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { $langs->load("products"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'product', 'test'=>(!empty($conf->product->enabled) || !empty($conf->service->enabled)), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); } - if (!empty($conf->societe->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsByThirdParties")); } - if (!empty($conf->propal->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Proposals"), 'desc'=>$langs->trans("ECMDocsByProposals")); } - if (!empty($conf->contrat->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'contract', 'test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsByContracts")); } - if (!empty($conf->commande->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled, 'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } - if (!empty($conf->facture->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); } - if (!empty($conf->supplier_proposal->enabled)) { $langs->load("supplier_proposal"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'supplier_proposal', 'test'=>$conf->supplier_proposal->enabled, 'label'=>$langs->trans("SupplierProposals"), 'desc'=>$langs->trans("ECMDocsBySupplierProposals")); } - if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } - if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); } - if (!empty($conf->tax->enabled)) { $langs->load("compta"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBySocialContributions")); } - if (!empty($conf->projet->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsByProjects")); } - if (!empty($conf->ficheinter->enabled)) { $langs->load("interventions"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsByInterventions")); } - if (!empty($conf->expensereport->enabled)) { $langs->load("trips"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'expensereport', 'test'=>$conf->expensereport->enabled, 'label'=>$langs->trans("ExpenseReports"), 'desc'=>$langs->trans("ECMDocsByExpenseReports")); } - if (!empty($conf->holiday->enabled)) { $langs->load("holiday"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'holiday', 'test'=>$conf->holiday->enabled, 'label'=>$langs->trans("Holidays"), 'desc'=>$langs->trans("ECMDocsByHolidays")); } - if (!empty($conf->banque->enabled)) { $langs->load("banks"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'banque', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("BankAccount"), 'desc'=>$langs->trans("ECMDocsByBankAccount")); } - if (!empty($conf->mrp->enabled)) { $langs->load("mrp"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'mrp-mo', 'test'=>$conf->mrp->enabled, 'label'=>$langs->trans("MOs"), 'desc'=>$langs->trans("ECMDocsByMO")); } - if (!empty($conf->recruitment->enabled)) { $langs->load("recruitment"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'recruitment-recruitmentcandidature', 'test'=>$conf->recruitment->enabled, 'label'=>$langs->trans("Candidatures"), 'desc'=>$langs->trans("ECMDocsByCandidature")); } - $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'user', 'test'=>1, 'label'=>$langs->trans("Users"), 'desc'=>$langs->trans("ECMDocsByUsers")); + if (!empty($conf->societe->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ThirdParties"))); } + if (!empty($conf->propal->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Proposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Proposals"))); } + if (!empty($conf->contrat->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'contract', 'test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Contracts"))); } + if (!empty($conf->commande->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled, 'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Orders"))); } + if (!empty($conf->facture->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Invoices"))); } + if (!empty($conf->supplier_proposal->enabled)) { $langs->load("supplier_proposal"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'supplier_proposal', 'test'=>$conf->supplier_proposal->enabled, 'label'=>$langs->trans("SupplierProposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierProposals"))); } + if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("PurchaseOrders"))); } + if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierInvoices"))); } + if (!empty($conf->tax->enabled)) { $langs->load("compta"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SocialContributions"))); } + if (!empty($conf->projet->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects"))); } + if (!empty($conf->ficheinter->enabled)) { $langs->load("interventions"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Interventions"))); } + if (!empty($conf->expensereport->enabled)) { $langs->load("trips"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'expensereport', 'test'=>$conf->expensereport->enabled, 'label'=>$langs->trans("ExpenseReports"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ExpenseReports"))); } + if (!empty($conf->holiday->enabled)) { $langs->load("holiday"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'holiday', 'test'=>$conf->holiday->enabled, 'label'=>$langs->trans("Holidays"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Holidays"))); } + if (!empty($conf->banque->enabled)) { $langs->load("banks"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'banque', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("BankAccount"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("BankAccount"))); } + if (!empty($conf->mrp->enabled)) { $langs->load("mrp"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'mrp-mo', 'test'=>$conf->mrp->enabled, 'label'=>$langs->trans("MOs"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ManufacturingOrders"))); } + if (!empty($conf->recruitment->enabled)) { $langs->load("recruitment"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'recruitment-recruitmentcandidature', 'test'=>$conf->recruitment->enabled, 'label'=>$langs->trans("Candidatures"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("JobApplications"))); } + $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'user', 'test'=>1, 'label'=>$langs->trans("Users"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Users"))); } $head = ecm_prepare_dasboard_head(''); diff --git a/htdocs/ecm/search.php b/htdocs/ecm/search.php index 6f9f264994b..a3c242cb787 100644 --- a/htdocs/ecm/search.php +++ b/htdocs/ecm/search.php @@ -97,14 +97,23 @@ $userstatic = new User($db); // Ajout rubriques automatiques $rowspan = 0; $sectionauto = array(); -if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'product', 'test'=>$conf->product->enabled, 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); } -if (!empty($conf->societe->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsByThirdParties")); } -if (!empty($conf->propal->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Proposals"), 'desc'=>$langs->trans("ECMDocsByProposals")); } -if (!empty($conf->contrat->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'contract', 'test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsByContracts")); } -if (!empty($conf->commande->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled, 'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } -if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsByOrders")); } -if (!empty($conf->facture->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); } -if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } +if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { $langs->load("products"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'product', 'test'=>(!empty($conf->product->enabled) || !empty($conf->service->enabled)), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); } +if (!empty($conf->societe->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ThirdParties"))); } +if (!empty($conf->propal->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Proposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Proposals"))); } +if (!empty($conf->contrat->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'contract', 'test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Contracts"))); } +if (!empty($conf->commande->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled, 'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Orders"))); } +if (!empty($conf->facture->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Invoices"))); } +if (!empty($conf->supplier_proposal->enabled)) { $langs->load("supplier_proposal"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'supplier_proposal', 'test'=>$conf->supplier_proposal->enabled, 'label'=>$langs->trans("SupplierProposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierProposals"))); } +if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("PurchaseOrders"))); } +if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierInvoices"))); } +if (!empty($conf->tax->enabled)) { $langs->load("compta"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SocialContributions"))); } +if (!empty($conf->projet->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects"))); } +if (!empty($conf->ficheinter->enabled)) { $langs->load("interventions"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Interventions"))); } +if (!empty($conf->expensereport->enabled)) { $langs->load("trips"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'expensereport', 'test'=>$conf->expensereport->enabled, 'label'=>$langs->trans("ExpenseReports"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ExpenseReports"))); } +if (!empty($conf->holiday->enabled)) { $langs->load("holiday"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'holiday', 'test'=>$conf->holiday->enabled, 'label'=>$langs->trans("Holidays"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Holidays"))); } +if (!empty($conf->banque->enabled)) { $langs->load("banks"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'banque', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("BankAccount"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("BankAccount"))); } +if (!empty($conf->mrp->enabled)) { $langs->load("mrp"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'mrp-mo', 'test'=>$conf->mrp->enabled, 'label'=>$langs->trans("MOs"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ManufacturingOrders"))); } +if (!empty($conf->recruitment->enabled)) { $langs->load("recruitment"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'recruitment-recruitmentcandidature', 'test'=>$conf->recruitment->enabled, 'label'=>$langs->trans("Candidatures"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("JobApplications"))); } //*********************** diff --git a/htdocs/langs/en_US/ecm.lang b/htdocs/langs/en_US/ecm.lang index aaf81b0f346..71df60734fb 100644 --- a/htdocs/langs/en_US/ecm.lang +++ b/htdocs/langs/en_US/ecm.lang @@ -23,19 +23,7 @@ ECMSearchByKeywords=Search by keywords ECMSearchByEntity=Search by object ECMSectionOfDocuments=Directories of documents ECMTypeAuto=Automatic -ECMDocsBySocialContributions=Documents linked to social or fiscal taxes -ECMDocsByThirdParties=Documents linked to third parties -ECMDocsByProposals=Documents linked to proposals -ECMDocsByOrders=Documents linked to customers orders -ECMDocsByContracts=Documents linked to contracts -ECMDocsByInvoices=Documents linked to customers invoices -ECMDocsByProducts=Documents linked to products -ECMDocsByProjects=Documents linked to projects -ECMDocsByUsers=Documents linked to users -ECMDocsByInterventions=Documents linked to interventions -ECMDocsByExpenseReports=Documents linked to expense reports -ECMDocsByHolidays=Documents linked to holidays -ECMDocsBySupplierProposals=Documents linked to vendor proposals +ECMDocsBy=Documents linked to %s ECMNoDirectoryYet=No directory created ShowECMSection=Show directory DeleteSection=Remove directory From ad05451427d77f11ab7d4ee72eacb606585da4ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 12 Nov 2020 11:23:03 +0100 Subject: [PATCH 019/124] Fix missing getpost for scandir odt path --- htdocs/admin/user.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php index 56602502715..e71088da27a 100644 --- a/htdocs/admin/user.php +++ b/htdocs/admin/user.php @@ -6,6 +6,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2015 Juanjo Menent + * Copyright (C) 2020 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -42,6 +43,8 @@ $action = GETPOST('action', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); $value = GETPOST('value', 'alpha'); +$label = GETPOST('label', 'alpha'); +$scandir = GETPOST('scandir', 'alpha'); $type = 'user'; From 31fcf12643252dead94ae650254930e3809ad3c7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Nov 2020 12:03:43 +0100 Subject: [PATCH 020/124] Add script reset-invalid-emails.php --- scripts/emailings/mailing-send.php | 4 +- scripts/emailings/reset-invalid-emails.php | 96 ++++++++++++++++++++++ 2 files changed, 98 insertions(+), 2 deletions(-) create mode 100755 scripts/emailings/reset-invalid-emails.php diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index 6719fb2164f..d4c915c3b72 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -21,9 +21,9 @@ */ /** - * \file scripts/emailings/mailing-send.php + * \file scripts/emailings/mailing-send.php * \ingroup mailing - * \brief Script d'envoi d'un mailing prepare et valide + * \brief Script to send a prepared and validated emaling from command line */ if (!defined('NOSESSION')) define('NOSESSION', '1'); diff --git a/scripts/emailings/reset-invalid-emails.php b/scripts/emailings/reset-invalid-emails.php new file mode 100755 index 00000000000..1b27130b8a6 --- /dev/null +++ b/scripts/emailings/reset-invalid-emails.php @@ -0,0 +1,96 @@ +#!/usr/bin/env php + + * + * 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 scripts/emailings/reset-invalid-emails.php + * \ingroup mailing + * \brief Script to reset (set email to empty) from a list of email + */ + +if (!defined('NOSESSION')) define('NOSESSION', '1'); + +$sapi_type = php_sapi_name(); +$script_file = basename(__FILE__); +$path = __DIR__.'/'; + +// Test if batch mode +if (substr($sapi_type, 0, 3) == 'cgi') { + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; + exit(-1); +} + +if (!isset($argv[2]) || !$argv[2]) { + print "Usage: ".$script_file." inputfile-with-invalid-emails type\n"; + print "- inputfile-with-invalid-emails is a file with list of invalid email\n"; + print "- type can be 'all' or 'thirdparties', 'contacts', 'members', 'users'\n"; + exit(-1); +} +$id = $argv[1]; +$type = $argv[2]; + +require_once $path."../../htdocs/master.inc.php"; +require_once DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php"; +require_once DOL_DOCUMENT_ROOT."/comm/mailing/class/mailing.class.php"; + +// Global variables +$version = DOL_VERSION; +$error = 0; + +/* + * Main + */ + +@set_time_limit(0); +print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; + + +$user = new User($db); +// for signature, we use user send as parameter +if (!empty($login)) + $user->fetch('', $login); + + +$db->begin(); + +// Loop on the entry file to get the 100 first entries + +$groupofemails = array(); + + + // For each groupofemail, we update tables to set email field to empty + if (empty($type) || $type == 'thirdparty') + { + // Loop on each thirdparty and update the email to null if email into $groupofemails + // TODO + } + + if (empty($type) || $type == 'contact') + { + // Loop on each thirdparty and update the email to null if email into $groupofemails + // TODO + } + + + +if (!$error) { + $db->commit(); +} else { + $db->rollback(); +} + +exit($error); From d9beced0e393a020ef9076b2bb4a8032377771b1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Nov 2020 12:09:36 +0100 Subject: [PATCH 021/124] Add skeleton of script to clean email database --- scripts/emailings/reset-invalid-emails.php | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/scripts/emailings/reset-invalid-emails.php b/scripts/emailings/reset-invalid-emails.php index 1b27130b8a6..de6b180e208 100755 --- a/scripts/emailings/reset-invalid-emails.php +++ b/scripts/emailings/reset-invalid-emails.php @@ -67,24 +67,36 @@ if (!empty($login)) $db->begin(); -// Loop on the entry file to get the 100 first entries + +// TODO Loop on the entry file to get the 100 first entries $groupofemails = array(); // For each groupofemail, we update tables to set email field to empty - if (empty($type) || $type == 'thirdparty') + if ($type == 'all' || $type == 'thirdparty') { - // Loop on each thirdparty and update the email to null if email into $groupofemails + // Loop on each record and update the email to null if email into $groupofemails // TODO } - if (empty($type) || $type == 'contact') + if ($type == 'all' || $type == 'contact') { - // Loop on each thirdparty and update the email to null if email into $groupofemails + // Loop on each record and update the email to null if email into $groupofemails // TODO } + if ($type == 'all' || $type == 'user') + { + // Loop on each record and update the email to null if email into $groupofemails + // TODO + } + + if ($type == 'all' || $type == 'member') + { + // Loop on each record and update the email to null if email into $groupofemails + // TODO + } if (!$error) { From a168c3fbb141adff1a2cc0212f55e6fcb8c73ea9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Nov 2020 12:33:29 +0100 Subject: [PATCH 022/124] Remove warnings --- htdocs/admin/pdf.php | 42 +++++++++---------- .../core/modules/bank/doc/pdf_ban.modules.php | 4 +- .../bank/doc/pdf_sepamandate.modules.php | 4 +- .../modules/cheque/doc/pdf_blochet.class.php | 5 +-- .../commande/doc/pdf_einstein.modules.php | 4 +- .../commande/doc/pdf_eratosthene.modules.php | 2 +- .../contract/doc/pdf_strato.modules.php | 4 +- .../delivery/doc/pdf_storm.modules.php | 4 +- .../delivery/doc/pdf_typhon.modules.php | 4 +- .../expedition/doc/pdf_espadon.modules.php | 4 +- .../expedition/doc/pdf_merou.modules.php | 2 +- .../expedition/doc/pdf_rouget.modules.php | 4 +- .../doc/pdf_standard.modules.php | 4 +- .../modules/facture/doc/pdf_crabe.modules.php | 4 +- .../facture/doc/pdf_sponge.modules.php | 2 +- .../fichinter/doc/pdf_soleil.modules.php | 4 +- .../movement/doc/pdf_standard.modules.php | 2 +- .../product/doc/pdf_standard.modules.php | 4 +- .../project/doc/pdf_baleine.modules.php | 4 +- .../project/doc/pdf_beluga.modules.php | 4 +- .../project/doc/pdf_timespent.modules.php | 2 +- .../modules/propale/doc/pdf_azur.modules.php | 4 +- .../modules/propale/doc/pdf_cyan.modules.php | 2 +- .../reception/doc/pdf_squille.modules.php | 2 +- .../stock/doc/pdf_standard.modules.php | 2 +- .../doc/pdf_canelle.modules.php | 4 +- .../supplier_order/doc/pdf_cornas.modules.php | 4 +- .../doc/pdf_muscadet.modules.php | 4 +- .../doc/pdf_standard.modules.php | 4 +- .../doc/pdf_aurore.modules.php | 4 +- .../doc/pdf_standard_myobject.modules.php | 2 +- ...tandard_recruitmentjobposition.modules.php | 2 +- 32 files changed, 72 insertions(+), 75 deletions(-) diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 75681ad36c0..4008fad141d 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -51,35 +51,33 @@ if ($cancel) { if ($action == 'update') { - dolibarr_set_const($db, "MAIN_PDF_FORMAT", $_POST["MAIN_PDF_FORMAT"], 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PDF_FORMAT", GETPOST("MAIN_PDF_FORMAT"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PDF_MARGIN_LEFT", $_POST["MAIN_PDF_MARGIN_LEFT"], 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PDF_MARGIN_RIGHT", $_POST["MAIN_PDF_MARGIN_RIGHT"], 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PDF_MARGIN_TOP", $_POST["MAIN_PDF_MARGIN_TOP"], 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PDF_MARGIN_BOTTOM", $_POST["MAIN_PDF_MARGIN_BOTTOM"], 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PDF_MARGIN_LEFT", GETPOST("MAIN_PDF_MARGIN_LEFT"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PDF_MARGIN_RIGHT", GETPOST("MAIN_PDF_MARGIN_TOP"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PDF_MARGIN_BOTTOM", GETPOST("MAIN_PDF_MARGIN_BOTTOM"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", GETPOST("MAIN_PROFID1_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", GETPOST("MAIN_PROFID2_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", GETPOST("MAIN_PROFID3_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", GETPOST("MAIN_PROFID4_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PROFID5_IN_ADDRESS", GETPOST("MAIN_PROFID5_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PROFID6_IN_ADDRESS", GETPOST("MAIN_PROFID6_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", GETPOST("MAIN_PROFID1_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", GETPOST("MAIN_PROFID2_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", GETPOST("MAIN_PROFID3_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", GETPOST("MAIN_PROFID4_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PROFID5_IN_ADDRESS", GETPOST("MAIN_PROFID5_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PROFID6_IN_ADDRESS", GETPOST("MAIN_PROFID6_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", $_POST["MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"], 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", GETPOST("MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", $_POST["MAIN_TVAINTRA_NOT_IN_ADDRESS"], 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"], 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DESC"], 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_REF"], 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", GETPOST("MAIN_TVAINTRA_NOT_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_DESC"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_REF"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_DOCUMENTS_LOGO_HEIGHT", GETPOST("MAIN_DOCUMENTS_LOGO_HEIGHT", 'int'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_INVERT_SENDER_RECIPIENT", $_POST["MAIN_INVERT_SENDER_RECIPIENT"], 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", $_POST["MAIN_PDF_USE_ISO_LOCATION"], 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"], 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_INVERT_SENDER_RECIPIENT", GETPOST("MAIN_INVERT_SENDER_RECIPIENT"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", GETPOST("MAIN_PDF_USE_ISO_LOCATION"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", GETPOST("MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"), 'chaine', 0, '', $conf->entity); - - dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", $_POST["MAIN_PDF_MAIN_HIDE_SECOND_TAX"], 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", $_POST["MAIN_PDF_MAIN_HIDE_THIRD_TAX"], 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", GETPOST("MAIN_PDF_MAIN_HIDE_SECOND_TAX"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", GETPOST("MAIN_PDF_MAIN_HIDE_THIRD_TAX"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "PDF_USE_ALSO_LANGUAGE_CODE", GETPOST('PDF_USE_ALSO_LANGUAGE_CODE', 'alpha'), 'chaine', 0, '', $conf->entity); diff --git a/htdocs/core/modules/bank/doc/pdf_ban.modules.php b/htdocs/core/modules/bank/doc/pdf_ban.modules.php index 56c538af8a6..8182c6f5ea7 100644 --- a/htdocs/core/modules/bank/doc/pdf_ban.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_ban.modules.php @@ -151,7 +151,7 @@ class pdf_ban extends ModeleBankAccountDoc $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; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -388,7 +388,7 @@ class pdf_ban extends ModeleBankAccountDoc // phpcs:enable global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; //return pdf_pagefoot($pdf,$outputlangs,'BANK_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } } diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php index 2b8987958f4..3c9a1b60b52 100644 --- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php @@ -157,7 +157,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc $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; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -628,7 +628,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc // phpcs:enable global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'PAYMENTORDER_FREE_TEXT', null, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php index 17ae82145df..f3ea817fa73 100644 --- a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php @@ -132,7 +132,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts $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; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -399,9 +399,8 @@ class BordereauChequeBlochet extends ModeleChequeReceipts protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $default_font_size = pdf_getPDFFontSize($outputlangs); - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; // Line of free text $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object); diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index da95eeabb19..922a6248394 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -280,7 +280,7 @@ class pdf_einstein extends ModelePDFCommandes $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 (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; if (class_exists('TCPDF')) { @@ -1504,7 +1504,7 @@ class pdf_einstein extends ModelePDFCommandes { // phpcs:enable global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $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 73410935540..992f877d23f 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -1667,7 +1667,7 @@ class pdf_eratosthene extends ModelePDFCommandes { // phpcs:enable global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $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/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 264d48449e2..92542fd9f3e 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -226,7 +226,7 @@ class pdf_strato extends ModelePDFContract $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; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -764,7 +764,7 @@ class pdf_strato extends ModelePDFContract protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'CONTRACT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php index 08c354562c8..10e3fa364d5 100644 --- a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php @@ -285,7 +285,7 @@ class pdf_storm extends ModelePDFDeliveryOrder $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; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -915,7 +915,7 @@ class pdf_storm extends ModelePDFDeliveryOrder protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $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/delivery/doc/pdf_typhon.modules.php b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php index 2239745d407..dbeab0a11d2 100644 --- a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php @@ -240,7 +240,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $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; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -905,7 +905,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 = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $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/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index ac960635576..15f425ba422 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -270,7 +270,7 @@ class pdf_espadon extends ModelePdfExpedition $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; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -1074,7 +1074,7 @@ class pdf_espadon extends ModelePdfExpedition protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'SHIPPING_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index fa243b57626..e02463c51f3 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -227,7 +227,7 @@ class pdf_merou extends ModelePdfExpedition $heightforinfotot = 0; // 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 (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index e570a506eca..3a2d9a170eb 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -291,7 +291,7 @@ class pdf_rouget extends ModelePdfExpedition $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; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -1109,7 +1109,7 @@ class pdf_rouget extends ModelePdfExpedition protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'SHIPPING_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 003e134faba..38f43a50910 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -260,7 +260,7 @@ class pdf_standard extends ModeleExpenseReport $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 + 12; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); @@ -1102,7 +1102,7 @@ class pdf_standard extends ModeleExpenseReport protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'EXPENSEREPORT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index ebf4051708a..51180681a25 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -324,7 +324,7 @@ class pdf_crabe extends ModelePDFFactures $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 + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; if (class_exists('TCPDF')) { @@ -1898,7 +1898,7 @@ class pdf_crabe extends ModelePDFFactures protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 61e5007e6c8..26f4127570b 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -2158,7 +2158,7 @@ class pdf_sponge extends ModelePDFFactures protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index d76c0969761..951e953da25 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -222,7 +222,7 @@ class pdf_soleil extends ModelePDFFicheinter $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; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -718,7 +718,7 @@ class pdf_soleil extends ModelePDFFicheinter protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'FICHINTER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/movement/doc/pdf_standard.modules.php b/htdocs/core/modules/movement/doc/pdf_standard.modules.php index c37e0cc60a7..5917cb85042 100644 --- a/htdocs/core/modules/movement/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/movement/doc/pdf_standard.modules.php @@ -1156,7 +1156,7 @@ class pdf_stdandard extends ModelePDFMovement protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'PRODUCT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php index 9ac05a98561..b38de420b97 100644 --- a/htdocs/core/modules/product/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php @@ -221,7 +221,7 @@ class pdf_standard extends ModelePDFProduct $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 (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; if (class_exists('TCPDF')) { @@ -845,7 +845,7 @@ class pdf_standard extends ModelePDFProduct protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'PRODUCT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/project/doc/pdf_baleine.modules.php b/htdocs/core/modules/project/doc/pdf_baleine.modules.php index 84cc5829571..e6d63801b01 100644 --- a/htdocs/core/modules/project/doc/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/doc/pdf_baleine.modules.php @@ -224,7 +224,7 @@ class pdf_baleine extends ModelePDFProjects $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 (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; if (class_exists('TCPDF')) { @@ -667,7 +667,7 @@ class pdf_baleine extends ModelePDFProjects protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'PROJECT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index 1309f329e30..aa7b280aa1a 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -196,7 +196,7 @@ class pdf_beluga extends ModelePDFProjects $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 (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; if (class_exists('TCPDF')) { @@ -818,7 +818,7 @@ class pdf_beluga extends ModelePDFProjects protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'PROJECT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/project/doc/pdf_timespent.modules.php b/htdocs/core/modules/project/doc/pdf_timespent.modules.php index 3f30391117b..34de2458f3b 100644 --- a/htdocs/core/modules/project/doc/pdf_timespent.modules.php +++ b/htdocs/core/modules/project/doc/pdf_timespent.modules.php @@ -598,7 +598,7 @@ class pdf_timespent extends ModelePDFProjects protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'PROJECT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index a74286e4cdc..5892870809d 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -383,7 +383,7 @@ class pdf_azur extends ModelePDFPropales $heightforsignature = empty($conf->global->PROPAL_DISABLE_SIGNATURE) ? (pdfGetHeightForHtmlContent($pdf, $outputlangs->transnoentities("ProposalCustomerSignature")) + 10) : 0; $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 (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; //print $heightforinfotot + $heightforsignature + $heightforfreetext + $heightforfooter;exit; $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs); @@ -1674,7 +1674,7 @@ class pdf_azur extends ModelePDFPropales protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'PROPOSAL_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 324f52c1ca0..e93648a86af 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -1770,7 +1770,7 @@ class pdf_cyan extends ModelePDFPropales protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'PROPOSAL_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index a95d7594458..6c7c5f3a2a5 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -1012,7 +1012,7 @@ class pdf_squille extends ModelePdfReception protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'RECEPTION_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/stock/doc/pdf_standard.modules.php b/htdocs/core/modules/stock/doc/pdf_standard.modules.php index 4b4be2de5b3..55923d68a79 100644 --- a/htdocs/core/modules/stock/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_standard.modules.php @@ -912,7 +912,7 @@ class pdf_standard extends ModelePDFStock protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'PRODUCT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php index 83733dc1d33..6b50925a304 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -275,7 +275,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $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 + 8; // Height reserved to output the footer (value include bottom margin) - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; if (class_exists('TCPDF')) { @@ -1263,7 +1263,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $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_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index c0b849fad67..b9efff8303b 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -292,7 +292,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $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; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -1425,7 +1425,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $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_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index f6e27499dc2..c41771d33c8 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -308,7 +308,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $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; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -1338,7 +1338,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 = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $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 388ee06f7a9..19e78eb4ff9 100644 --- a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php @@ -267,7 +267,7 @@ class pdf_standard extends ModelePDFSuppliersPayments $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; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -798,7 +798,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 = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $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 06bdb462b18..f6dc1d789f0 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -297,7 +297,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $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; + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) @@ -1469,7 +1469,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 = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $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/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php index ea9eeed797d..60a7b8315a9 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php @@ -1148,7 +1148,7 @@ class pdf_standard_myobject extends ModelePDFMyObject protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } diff --git a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php index ee0f63f6c4f..378376ea799 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php @@ -1060,7 +1060,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; return pdf_pagefoot($pdf, $outputlangs, 'INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } From 026d73d9f960aad29df608527e6fc45f2144c73f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Nov 2020 12:39:56 +0100 Subject: [PATCH 023/124] Update thirdparty_lettering_supplier.php --- .../accountancy/bookkeeping/thirdparty_lettering_supplier.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php index 3759c45c32a..b5620f3ec25 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php @@ -41,7 +41,7 @@ $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); -$socid = GETPOST('socid', 'int') ? (int) GETPOST('socid', 'int') : (int) GETPOST('id', 'int'); +$socid = GETPOST('socid', 'int') ? ((int) GETPOST('socid', 'int')) : ((int) GETPOST('id', 'int')); $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); From e68284871bc350ed0c9974080d12af7944a92404 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Nov 2020 12:44:34 +0100 Subject: [PATCH 024/124] Update receipt.php --- htdocs/takepos/admin/receipt.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index 3399b98b643..00086bef5ca 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -111,21 +111,25 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "browser") print "
'; +print $langs->trans('DolibarrReceiptPrinter'); +print ''; +print $langs->trans('ReceiptPrinterMethodDescription'); +print '
'; +print ''.$langs->trans("Setup").''; +print '
'; if ($conf->receiptprinter->enabled) { - print '
'; - print $langs->trans('DolibarrReceiptPrinter'); - print ''; - print $langs->trans('ReceiptPrinterMethodDescription'); - print '
'; - print ''.$langs->trans("Setup").''; - 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 "
'; From 84cc0ef19bdcf2e23e16ee9a67a9f8270a7e575a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Nov 2020 12:55:09 +0100 Subject: [PATCH 025/124] Add a protection to avoid infinite loop when we will trigger ACTION_ --- .../triggers/interface_50_modAgenda_ActionsAuto.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 25816cd591e..ff4d2892436 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -84,6 +84,10 @@ class InterfaceActionsAuto extends DolibarrTriggers if (empty($conf->global->$key)) { return 0; } + // Do not log events when trigger is for creating event (infinite loop) + if (preg_match('/^ACTION_/', $action)) { + return 0; + } $langs->load("agenda"); From 0b6123328d599959d2e0494f9e9d108a84df2736 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Nov 2020 13:12:38 +0100 Subject: [PATCH 026/124] Removed rule with +99% of false positives --- .github/workflows/exakat.yml | 2 +- .../interface_50_modAgenda_ActionsAuto.class.php | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/exakat.yml b/.github/workflows/exakat.yml index 861f6ccd4b0..1998683b852 100644 --- a/.github/workflows/exakat.yml +++ b/.github/workflows/exakat.yml @@ -13,5 +13,5 @@ jobs: - name: Exakat uses: docker://exakat/exakat-ga with: - ignore_rules: 'Classes/UseInstanceof,Performances/PrePostIncrement,Functions/WrongNumberOfArguments,Variables/UndefinedVariable,Classes/DontUnsetProperties,Classes/NonPpp,Classes/StaticMethodsCalledFromObject,Classes/UseClassOperator,Functions/UsesDefaultArguments,Php/NoClassInGlobal,Php/ShouldUseCoalesce,Structures/MergeIfThen,Structures/ElseIfElseif,Structures/RepeatedPrint,Structures/UselessParenthesis,Structures/SwitchWithoutDefault,Structures/ShouldMakeTernary,Structures/UseConstant' + ignore_rules: 'Classes/UseInstanceof,Performances/PrePostIncrement,Functions/UndefinedFunctions,Functions/WrongNumberOfArguments,Variables/UndefinedVariable,Classes/DontUnsetProperties,Classes/NonPpp,Classes/StaticMethodsCalledFromObject,Classes/UseClassOperator,Functions/UsesDefaultArguments,Php/NoClassInGlobal,Php/ShouldUseCoalesce,Php/WrongTypeForNativeFunction,Structures/MergeIfThen,Structures/ElseIfElseif,Structures/RepeatedPrint,Structures/UselessParenthesis,Structures/SwitchWithoutDefault,Structures/ShouldMakeTernary,Structures/UseConstant' ignore_dirs: '/htdocs/includes,/htdocs/build,/htdocs/dev,/htdocs/doc,/htdocs/scripts,/htdocs/test' \ No newline at end of file diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index ff4d2892436..fd082884ce2 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -77,6 +77,11 @@ class InterfaceActionsAuto extends DolibarrTriggers { if (empty($conf->agenda->enabled)) return 0; // Module not active, we do nothing + // Do not log events when trigger is for creating event (infinite loop) + if (preg_match('/^ACTION_/', $action)) { + return 0; + } + $key = 'MAIN_AGENDA_ACTIONAUTO_'.$action; //var_dump($action.' - '.$conf->global->$key);exit; @@ -84,10 +89,6 @@ class InterfaceActionsAuto extends DolibarrTriggers if (empty($conf->global->$key)) { return 0; } - // Do not log events when trigger is for creating event (infinite loop) - if (preg_match('/^ACTION_/', $action)) { - return 0; - } $langs->load("agenda"); From 0cc1cfbede3e2ec43d50278ccf0f9b0235fe1eff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Nov 2020 13:15:49 +0100 Subject: [PATCH 027/124] Remove rule with +99% of false positive --- .github/workflows/exakat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/exakat.yml b/.github/workflows/exakat.yml index 1998683b852..3d31236ab81 100644 --- a/.github/workflows/exakat.yml +++ b/.github/workflows/exakat.yml @@ -13,5 +13,5 @@ jobs: - name: Exakat uses: docker://exakat/exakat-ga with: - ignore_rules: 'Classes/UseInstanceof,Performances/PrePostIncrement,Functions/UndefinedFunctions,Functions/WrongNumberOfArguments,Variables/UndefinedVariable,Classes/DontUnsetProperties,Classes/NonPpp,Classes/StaticMethodsCalledFromObject,Classes/UseClassOperator,Functions/UsesDefaultArguments,Php/NoClassInGlobal,Php/ShouldUseCoalesce,Php/WrongTypeForNativeFunction,Structures/MergeIfThen,Structures/ElseIfElseif,Structures/RepeatedPrint,Structures/UselessParenthesis,Structures/SwitchWithoutDefault,Structures/ShouldMakeTernary,Structures/UseConstant' + ignore_rules: 'Classes/UseInstanceof,Performances/PrePostIncrement,Functions/UndefinedFunctions,Functions/WrongNumberOfArguments,Variables/UndefinedVariable,Classes/DontUnsetProperties,Classes/NonPpp,Classes/StaticMethodsCalledFromObject,Classes/UseClassOperator,Functions/UsesDefaultArguments,Php/NoClassInGlobal,Php/ShouldUseCoalesce,Php/WrongTypeForNativeFunction,Structures/MergeIfThen,Structures/ElseIfElseif,Structures/RepeatedPrint,Structures/SameConditions,Structures/SwitchWithoutDefault,Structures/ShouldMakeTernary,Structures/UselessParenthesis,Structures/UseConstant' ignore_dirs: '/htdocs/includes,/htdocs/build,/htdocs/dev,/htdocs/doc,/htdocs/scripts,/htdocs/test' \ No newline at end of file From 5c672cca1d17956779c49c042a79cd103065dba2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Nov 2020 13:16:55 +0100 Subject: [PATCH 028/124] Fix exclude of dirs --- .github/workflows/exakat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/exakat.yml b/.github/workflows/exakat.yml index 3d31236ab81..c2f571fce7f 100644 --- a/.github/workflows/exakat.yml +++ b/.github/workflows/exakat.yml @@ -14,4 +14,4 @@ jobs: uses: docker://exakat/exakat-ga with: ignore_rules: 'Classes/UseInstanceof,Performances/PrePostIncrement,Functions/UndefinedFunctions,Functions/WrongNumberOfArguments,Variables/UndefinedVariable,Classes/DontUnsetProperties,Classes/NonPpp,Classes/StaticMethodsCalledFromObject,Classes/UseClassOperator,Functions/UsesDefaultArguments,Php/NoClassInGlobal,Php/ShouldUseCoalesce,Php/WrongTypeForNativeFunction,Structures/MergeIfThen,Structures/ElseIfElseif,Structures/RepeatedPrint,Structures/SameConditions,Structures/SwitchWithoutDefault,Structures/ShouldMakeTernary,Structures/UselessParenthesis,Structures/UseConstant' - ignore_dirs: '/htdocs/includes,/htdocs/build,/htdocs/dev,/htdocs/doc,/htdocs/scripts,/htdocs/test' \ No newline at end of file + ignore_dirs: '/htdocs/includes,/build,/dev,/doc,/scripts,/test' \ No newline at end of file From c3000e50987ff7332d473e3dc7806d2fd9232098 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Nov 2020 13:20:39 +0100 Subject: [PATCH 029/124] Remove rule with +99% of false positive --- .github/workflows/exakat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/exakat.yml b/.github/workflows/exakat.yml index c2f571fce7f..3cfc4f8ba23 100644 --- a/.github/workflows/exakat.yml +++ b/.github/workflows/exakat.yml @@ -13,5 +13,5 @@ jobs: - name: Exakat uses: docker://exakat/exakat-ga with: - ignore_rules: 'Classes/UseInstanceof,Performances/PrePostIncrement,Functions/UndefinedFunctions,Functions/WrongNumberOfArguments,Variables/UndefinedVariable,Classes/DontUnsetProperties,Classes/NonPpp,Classes/StaticMethodsCalledFromObject,Classes/UseClassOperator,Functions/UsesDefaultArguments,Php/NoClassInGlobal,Php/ShouldUseCoalesce,Php/WrongTypeForNativeFunction,Structures/MergeIfThen,Structures/ElseIfElseif,Structures/RepeatedPrint,Structures/SameConditions,Structures/SwitchWithoutDefault,Structures/ShouldMakeTernary,Structures/UselessParenthesis,Structures/UseConstant' + ignore_rules: 'Classes/UseInstanceof,Performances/PrePostIncrement,Functions/UndefinedFunctions,Functions/WrongNumberOfArguments,Functions/WrongTypeWithCall,Variables/UndefinedVariable,Classes/DontUnsetProperties,Classes/NonPpp,Classes/StaticMethodsCalledFromObject,Classes/UseClassOperator,Functions/UsesDefaultArguments,Php/NoClassInGlobal,Php/ShouldUseCoalesce,Php/WrongTypeForNativeFunction,Structures/MergeIfThen,Structures/ElseIfElseif,Structures/RepeatedPrint,Structures/SameConditions,Structures/SwitchWithoutDefault,Structures/ShouldMakeTernary,Structures/UselessParenthesis,Structures/UseConstant' ignore_dirs: '/htdocs/includes,/build,/dev,/doc,/scripts,/test' \ No newline at end of file From 1dbc91e3431a7059a7b9fa0af30d4e9423171b91 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Nov 2020 13:44:57 +0100 Subject: [PATCH 030/124] Clean code --- htdocs/core/class/html.formfile.class.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 0381a031a7d..380b7a1ad17 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1221,7 +1221,6 @@ class FormFile // Size $sizetoshow = dol_print_size($file['size'], 1, 1); $sizetoshowbytes = dol_print_size($file['size'], 0, 1); - print ''; if ($sizetoshow == $sizetoshowbytes) print $sizetoshow; else { @@ -1659,8 +1658,21 @@ class FormFile print $this->showPreview($file, $modulepart, $file['relativename']); print "'.dol_print_size($file['size'], 1, 1).''; + if ($sizetoshow == $sizetoshowbytes) print $sizetoshow; + else { + print $form->textwithpicto($sizetoshow, $sizetoshowbytes, -1); + } + print ''.dol_print_date($file['date'], "dayhour").''; if ($file['share']) { // Define $urlwithroot From 1502b254ebbe974d22d4f7a1e66fc25de1715f64 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Thu, 12 Nov 2020 13:58:59 +0100 Subject: [PATCH 031/124] fix not able to delete time entry from task --- htdocs/projet/tasks/time.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 28bb941c687..7329c18cdd8 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1471,7 +1471,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) print ''; print ' '; - print 'rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; + print 'rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; print img_delete('default', 'class="pictodelete paddingleft"'); print ''; From 2061d0f85863c92893aa62a60bb3c59794a55330 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Thu, 12 Nov 2020 14:03:18 +0100 Subject: [PATCH 032/124] fix new company in contacts template file --- htdocs/core/tpl/contacts.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 012c39c126d..98be97ac5bb 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -145,7 +145,7 @@ if ($permission) $newcardbutton = ''; if (!empty($object->socid) && $object->socid > 1 && $user->rights->societe->creer) { - $newcardbutton .= ''; + $newcardbutton .= ''; } print $newcardbutton; ?> From 02158928cc4603949b5f216a35ab62fb3ac86938 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Nov 2020 14:11:59 +0100 Subject: [PATCH 033/124] FIX #15365 export of extrafields for user and resources --- htdocs/core/modules/modResource.class.php | 4 ++-- htdocs/core/modules/modUser.class.php | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/modResource.class.php b/htdocs/core/modules/modResource.class.php index 0e96b8d4c11..0d1353076ec 100644 --- a/htdocs/core/modules/modResource.class.php +++ b/htdocs/core/modules/modResource.class.php @@ -246,9 +246,9 @@ class modResource extends DolibarrModules $this->export_dependencies_array[$r] = array('resource'=>array('r.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them. $this->export_sql_start[$r] = 'SELECT DISTINCT '; - $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'resource as r '; + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'resource as r'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_resource as c ON c.rowid=r.fk_code_type_resource'; - $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'resource_extrafields as extra ON extra.fk_object = c.rowid'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'resource_extrafields as extra ON extra.fk_object = r.rowid'; $this->export_sql_end[$r] .= ' AND r.entity IN ('.getEntity('resource').')'; diff --git a/htdocs/core/modules/modUser.class.php b/htdocs/core/modules/modUser.class.php index c2ce0fec86f..e5ba3289d05 100644 --- a/htdocs/core/modules/modUser.class.php +++ b/htdocs/core/modules/modUser.class.php @@ -255,13 +255,16 @@ class modUser extends DolibarrModules 'u.admin'=>"user", 'u.statut'=>'user', 'u.datelastlogin'=>'user', 'u.datepreviouslogin'=>'user', 'u.fk_socpeople'=>"contact", 'u.fk_soc'=>"company", 'u.fk_member'=>"member" ); - if (empty($conf->adherent->enabled)) + $keyforselect = 'user'; $keyforelement = 'user'; $keyforaliasextra = 'extra'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + if (empty($conf->adherent->enabled)) { unset($this->export_fields_array[$r]['u.fk_member']); unset($this->export_entities_array[$r]['u.fk_member']); } $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'user as u'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user_extrafields as extra ON u.rowid = extra.fk_object'; $this->export_sql_end[$r] .= ' WHERE u.entity IN ('.getEntity('user').')'; // Imports From 2da8fb75a8da2e65ce3b95214ca6a5f1a7fc2f60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Lukas?= Date: Thu, 12 Nov 2020 15:59:42 +0100 Subject: [PATCH 034/124] Fix #15371 Extrafields from type "select" depending on other fields not working in Safari & jquery select2 #15371 --- htdocs/core/class/commonobject.class.php | 55 +++++++++++++----------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 8518d232115..d8b5a9eff7a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6976,34 +6976,37 @@ abstract class CommonObject if (!empty($conf->use_javascript_ajax)) { $out .= ' '."\n"; } From 9e59a9aa8cbf2228d704f13ee9b2823bc6c3c7d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 12 Nov 2020 18:39:50 +0100 Subject: [PATCH 035/124] Create index.html --- htdocs/admin/dolistore/index.html | 1 + 1 file changed, 1 insertion(+) create mode 100644 htdocs/admin/dolistore/index.html diff --git a/htdocs/admin/dolistore/index.html b/htdocs/admin/dolistore/index.html new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/htdocs/admin/dolistore/index.html @@ -0,0 +1 @@ + From 9c7d698cc729f1792da00a8630e34ae2427092aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 12 Nov 2020 18:40:34 +0100 Subject: [PATCH 036/124] Create index.html --- htdocs/admin/dolistore/class/index.html | 1 + 1 file changed, 1 insertion(+) create mode 100644 htdocs/admin/dolistore/class/index.html diff --git a/htdocs/admin/dolistore/class/index.html b/htdocs/admin/dolistore/class/index.html new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/htdocs/admin/dolistore/class/index.html @@ -0,0 +1 @@ + From caa82a1e2f6e5ba7db9217ee43cf56c8e9ac873d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 12 Nov 2020 18:43:52 +0100 Subject: [PATCH 037/124] Update PSWebServiceLibrary.class.php --- .../dolistore/class/PSWebServiceLibrary.class.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php index 00e8672f6d5..abbb3bbc4ed 100644 --- a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php +++ b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php @@ -221,7 +221,9 @@ class PrestaShopWebservice * Load XML from string. Can throw exception * * @param string $response String from a CURL response - * @return SimpleXMLElement status_code, response + * @return SimpleXMLElement|boolean status_code, response + * + * @throw PrestaShopWebserviceException */ protected function parseXML($response) { @@ -251,6 +253,8 @@ class PrestaShopWebservice * * @param array $options Options * @return SimpleXMLElement status_code, response + * + * @throw PrestaShopWebserviceException */ public function add($options) { @@ -300,7 +304,9 @@ class PrestaShopWebservice * ?> * * @param array $options Array representing resource to get. - * @return SimpleXMLElement status_code, response + * @return SimpleXMLElement|boolean status_code, response + * + * @throw PrestaShopWebserviceException */ public function get($options) { @@ -336,6 +342,8 @@ class PrestaShopWebservice * * @param array $options Array representing resource for head request. * @return SimpleXMLElement status_code, response + * + * @throw PrestaShopWebserviceException */ public function head($options) { @@ -372,6 +380,8 @@ class PrestaShopWebservice * * @param array $options Array representing resource to edit. * @return SimpleXMLElement status_code, response + * + * @throw PrestaShopWebserviceException */ public function edit($options) { From 64c48a246a8327186a1a1f90051aec11ba00dc68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 12 Nov 2020 18:53:26 +0100 Subject: [PATCH 038/124] The method PrestaShopWebservice::... is not static, but was called statically --- .../class/PSWebServiceLibrary.class.php | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php index abbb3bbc4ed..201191d1262 100644 --- a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php +++ b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php @@ -272,10 +272,10 @@ class PrestaShopWebservice } else { throw new PrestaShopWebserviceException('Bad parameters given'); } - $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $xml)); + $request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $xml)); - self::checkStatusCode($request['status_code']); - return self::parseXML($request['response']); + $this->checkStatusCode($request['status_code']); + return $this->parseXML($request['response']); } /** @@ -332,9 +332,9 @@ class PrestaShopWebservice throw new PrestaShopWebserviceException('Bad parameters given '); } - $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'GET')); - self::checkStatusCode($request['status_code']); // check the response validity - return self::parseXML($request['response']); + $request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'GET')); + $this->checkStatusCode($request['status_code']); // check the response validity + return $this->parseXML($request['response']); } /** @@ -366,8 +366,8 @@ class PrestaShopWebservice } else { throw new PrestaShopWebserviceException('Bad parameters given'); } - $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'HEAD', CURLOPT_NOBODY => true)); - self::checkStatusCode($request['status_code']); // check the response validity + $request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'HEAD', CURLOPT_NOBODY => true)); + $this->checkStatusCode($request['status_code']); // check the response validity return $request['header']; } /** @@ -400,9 +400,9 @@ class PrestaShopWebservice throw new PrestaShopWebserviceException('Bad parameters given'); } - $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => $xml)); - self::checkStatusCode($request['status_code']); // check the response validity - return self::parseXML($request['response']); + $request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => $xml)); + $this->checkStatusCode($request['status_code']); // check the response validity + return $this->parseXML($request['response']); } } From 350d6941815949340f896e15a25c1e826a6ef32c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Nov 2020 19:15:44 +0100 Subject: [PATCH 039/124] Fix security page --- htdocs/admin/events.php | 2 +- htdocs/admin/system/security.php | 31 ++++++++++++++++++++++--------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/htdocs/admin/events.php b/htdocs/admin/events.php index b75606f739c..7af8d547a0c 100644 --- a/htdocs/admin/events.php +++ b/htdocs/admin/events.php @@ -118,7 +118,7 @@ foreach ($eventstolog as $key => $arr) print ''.$arr['id'].''; $key = 'MAIN_LOGEVENTS_'.$arr['id']; - $value = $conf->global->$key; + $value = empty($conf->global->$key) ? '' : $conf->global->$key; print ''; print '
'.$langs->trans("MainTemplateToUse").'
'.$langs->trans("MainTemplateToUse").' ('.$langs->trans("SetupReceiptTemplate").')'; print $form->selectarray('TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal, $templates, (empty($conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal}) ? '0' : $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal}), 1); print '
'.$langs->trans('NoUnreadTicketsFound').'
'."\n"; @@ -507,7 +507,7 @@ if ($resql) // Approver if (!empty($arrayfields['cp.fk_validator']['checked'])) { - if ($user->rights->holiday->read_all) + if ($user->rights->holiday->readall) { print ''; $result = 0; diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index 669bb9aa32f..54049a201ea 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -69,7 +69,7 @@ if (!$sortfield) $sortfield = "cpl.rowid"; if (!$sortorder) $sortorder = "DESC"; // Si l'utilisateur n'a pas le droit de lire cette page -if (!$user->rights->holiday->read_all) accessforbidden(); +if (!$user->rights->holiday->readall) accessforbidden(); // Load translation files required by the page $langs->load('users'); diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index a713ec86100..3ec2a3b898f 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -180,7 +180,7 @@ if (!empty($conf->holiday->enabled) && $user->rights->holiday->read) $sql .= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE u.rowid = x.fk_user"; $sql .= " AND x.entity = ".$conf->entity; - if (empty($user->rights->holiday->read_all)) $sql .= ' AND x.fk_user IN ('.join(',', $childids).')'; + if (empty($user->rights->holiday->readall)) $sql .= ' AND x.fk_user IN ('.join(',', $childids).')'; //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND x.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; //if (!empty($socid)) $sql.= " AND x.fk_soc = ".$socid; $sql .= $db->order("x.tms", "DESC"); diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index f308db3525c..33b8ea01f8b 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -410,6 +410,7 @@ ALTER TABLE llx_projet_task_time MODIFY COLUMN datec datetime; DELETE FROM llx_user_rights WHERE fk_id IN (SELECT id FROM llx_rights_def where module = 'holiday' and perms = 'lire_tous'); DELETE FROM llx_rights_def where module = 'holiday' and perms = 'lire_tous'; +UPDATE llx_rights_def set perms = 'readall' WHERE perms = 'read_all' and module = 'holiday'; CREATE TABLE llx_c_product_nature ( rowid integer AUTO_INCREMENT PRIMARY KEY, diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 3da5c3aff62..9e715bd08d2 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -836,10 +836,11 @@ Permission402=Create/modify discounts Permission403=Validate discounts Permission404=Delete discounts Permission430=Use Debug Bar -Permission511=Read payments of salaries +Permission511=Read payments of salaries (yours and subordinates) Permission512=Create/modify payments of salaries Permission514=Delete payments of salaries -Permission517=Export salaries +Permission517=Read payments of salaries of everybody +Permission519=Export salaries Permission520=Read Loans Permission522=Create/modify loans Permission524=Delete loans diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 8f6f636c4b2..3ef6531e6fd 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -31,11 +31,6 @@ if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/account // Load translation files required by the page $langs->loadLangs(array("compta", "salaries", "bills", "hrm")); -// Security check -$socid = GETPOST("socid", "int"); -if ($user->socid) $socid = $user->socid; -$result = restrictedArea($user, 'salaries', '', '', ''); - $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $search_ref = GETPOST('search_ref', 'int'); $search_user = GETPOST('search_user', 'alpha'); @@ -71,6 +66,13 @@ if (!GETPOST('typeid', 'int')) $typeid = GETPOST('typeid', 'int'); } +$childids = $user->getAllChildIds(1); + +// Security check +$socid = GETPOST("socid", "int"); +if ($user->socid) $socid = $user->socid; +$result = restrictedArea($user, 'salaries', '', '', ''); + /* @@ -112,6 +114,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.ro $sql .= " ".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE u.rowid = s.fk_user"; $sql .= " AND s.entity = ".$conf->entity; +if (empty($user->rights->salaries->readall)) $sql .= " AND s.fk_user IN (".join(',', $childids).")"; // Search criteria if ($search_ref) $sql .= " AND s.rowid=".$search_ref; diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index b1f0b7d4785..8b177518d25 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -388,7 +388,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco * Last holidays */ if (!empty($conf->holiday->enabled) && - ($user->rights->holiday->read_all || ($user->rights->holiday->read && $object->id == $user->id)) + ($user->rights->holiday->readall || ($user->rights->holiday->read && $object->id == $user->id)) ) { $holiday = new Holiday($db); @@ -396,7 +396,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco $sql = "SELECT h.rowid, h.statut as status, h.fk_type, h.date_debut, h.date_fin, h.halfday"; $sql .= " FROM ".MAIN_DB_PREFIX."holiday as h"; $sql .= " WHERE h.fk_user = ".$object->id; - $sql .= " AND h.entity = ".$conf->entity; + $sql .= " AND h.entity IN (".getEntity('holiday').")"; $sql .= " ORDER BY h.date_debut DESC"; $resql = $db->query($sql); From b8e8ba0c97db13c58a67c744e4335bad73e2238b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Nov 2020 09:58:47 +0100 Subject: [PATCH 047/124] Update extrafields_list_array_fields.tpl.php --- htdocs/core/tpl/extrafields_list_array_fields.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/extrafields_list_array_fields.tpl.php b/htdocs/core/tpl/extrafields_list_array_fields.tpl.php index 1e98952ae71..54cb8cbc93b 100644 --- a/htdocs/core/tpl/extrafields_list_array_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_array_fields.tpl.php @@ -1,6 +1,6 @@ '."\n"; +print ''."\n"; // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) From 5498800ad607a162d8c15476a8032622a2ee6f32 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Nov 2020 10:02:34 +0100 Subject: [PATCH 048/124] Update commonobject.class.php --- htdocs/core/class/commonobject.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d8b5a9eff7a..221c69b659a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6995,12 +6995,12 @@ abstract class CommonObject jQuery("select option[parent]").parent().each(function() { var orig_select = {}; var child_list = $(this).attr("name"); - orig_select [child_list] = $(this).clone(); + orig_select[child_list] = $(this).clone(); var parent = $(this).find("option[parent]:first").attr("parent"); var infos = parent.split(":"); var parent_list = infos[0]; $("select[name=\""+parent_list+"\"]").change(function() { - showOptions(child_list, parent_list, orig_select [child_list]); + showOptions(child_list, parent_list, orig_select[child_list]); }); }); } From d9f66e95b5f81b17891dbc615a30819b22b6bf01 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Nov 2020 10:26:16 +0100 Subject: [PATCH 049/124] Fix missing field --- htdocs/bom/class/bom.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index b838aac8cd9..192acc22d83 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -92,8 +92,10 @@ class BOM extends CommonObject 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'autofocusoncreate'=>1), - 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), + //'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassembly')), + 'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')), 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'), + 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), 'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'), //'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLossForProductProduced'), 'duration' => array('type'=>'duration', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'), @@ -113,6 +115,7 @@ class BOM extends CommonObject public $rowid; public $ref; public $label; + public $bomtype; public $description; public $note_public; public $note_private; From 24d582d1537e7db870618a933aceffd4a82f94fe Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Fri, 13 Nov 2020 10:38:19 +0100 Subject: [PATCH 050/124] Update README-DE --- doc/install/README-DE | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/doc/install/README-DE b/doc/install/README-DE index c7ece3891f3..047e1915d18 100644 --- a/doc/install/README-DE +++ b/doc/install/README-DE @@ -1,33 +1,45 @@ README (deutsch / german / allemand) --------------------------------- +------------------------------------ --------------------------------- +------------------------------------ Download / Herunterladen --------------------------------- +------------------------------------ * Dolibarr ERP/CRM kann man über die offizielle Dolibarr Website + https://www.dolibarr.org/downloads - oder direkt von Sourceforge + + oder direkt bei Sourceforge + https://sourceforge.net/projects/dolibarr/files/ + herunterladen. - - -* Die meisten externen Module/Themens sind über den DoliStore verfügbar: - https://www.dolistore.com/de/ --------------------------------- -Installation --------------------------------- -* Für eine kurze Einleitung, schau auf die README Datei im Hauptverzeichnis. +------------------------------------ +Installation / Hilfe +------------------------------------ + +* Für eine kurze Einleitung schau in die README Datei im Hauptverzeichnis. * Umfangreiche Dokumentationen sind im Dolibarr Wiki zu finden: https://wiki.dolibarr.org/index.php/Hauptseite * eine Deutsche Community bietet der Dolibarr e.V. unter https://www.dolibarr.de/ + + + + +------------------------------------ +Zusatzmodule +------------------------------------ + +* Die meisten externen Module/Themen sind über den offiziellen DoliStore verfügbar: + + https://www.dolistore.com/de/ - + From a98d025f5a08dc345a4094a62332d3b285fcc114 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Nov 2020 11:06:51 +0100 Subject: [PATCH 051/124] Clean option for replenishment on real stock. --- htdocs/admin/stock.php | 8 +-- htdocs/langs/en_US/stocks.lang | 5 +- htdocs/product/stock/replenish.php | 87 +++++++++++++----------------- 3 files changed, 44 insertions(+), 56 deletions(-) diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 6fc37f45734..134aeb663b4 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -483,13 +483,15 @@ if ($virtualdiffersfromphysical) print ''."\n"; print ''; - print ''; + print ''; print '\n"; print "\n"; diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index ac97c24085c..b0507c69071 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -122,8 +122,9 @@ DesiredStockDesc=This stock amount will be the value used to fill the stock by r StockToBuy=To order Replenishment=Replenishment ReplenishmentOrders=Replenishment orders -VirtualDiffersFromPhysical=According to increase/decrease stock options, physical stock and virtual stock (physical + current orders) may differ -UseVirtualStockByDefault=Use virtual stock by default, instead of physical stock, for replenishment feature +VirtualDiffersFromPhysical=According to increase/decrease stock options, physical stock and virtual stock (physical stock + open orders) may differ +UseRealStockByDefault=Use real stock, instead of virtual stock, for replenishment feature +ReplenishmentCalculation=Amount to order will be (desired quantity - real stock) instead of (desired quantity - virtual stock) UseVirtualStock=Use virtual stock UsePhysicalStock=Use physical stock CurentSelectionMode=Current selection mode diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 0fd5a658a0b..96b9d62c3fb 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -80,7 +80,6 @@ if (!$sortorder) { $sortorder = 'ASC'; } -// Define virtualdiffersfromphysical $virtualdiffersfromphysical = 0; if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) @@ -92,7 +91,11 @@ if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) $virtualdiffersfromphysical = 1; // According to increase/decrease stock options, virtual and physical stock may differs. } -$usevirtualstock = !empty($conf->global->STOCK_USE_VIRTUAL_STOCK); +if ($virtualdiffersfromphysical) { + $usevirtualstock = empty($conf->global->STOCK_USE_REAL_STOCK_BY_DEFAULT_FOR_REPLENISHMENT) ? 1 : 0; +} else { + $usevirtualstock = 0; +} if ($mode == 'physical') $usevirtualstock = 0; if ($mode == 'virtual') $usevirtualstock = 1; @@ -526,22 +529,23 @@ print load_fiche_titre($langs->trans('Replenishment'), '', 'stock'); print dol_get_fiche_head($head, 'replenish', '', -1, ''); -print ''.$langs->trans("ReplenishmentStatusDesc").'
'."\n"; +print ''.$langs->trans("ReplenishmentStatusDesc").''."\n"; if (empty($fk_warhouse) && !empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) { print ''.$langs->trans("ReplenishmentStatusDescPerWarehouse").''."
\n"; } +print '
'; if ($usevirtualstock == 1) { print $langs->trans("CurentSelectionMode").': '; - print $langs->trans("CurentlyUsingVirtualStock"); - print ' ('.$langs->trans("UsePhysicalStock").')'; + print ''.$langs->trans("UseVirtualStock").''; + print ' '.$langs->trans("UsePhysicalStock").''; print '
'; } if ($usevirtualstock == 0) { print $langs->trans("CurentSelectionMode").': '; - print $langs->trans("CurentlyUsingPhysicalStock"); - print ' ('.$langs->trans("UseVirtualStock").')'; + print ''.$langs->trans("UseVirtualStock").''; + print ' '.$langs->trans("UsePhysicalStock").''; print '
'; } print '
'."\n"; @@ -591,54 +595,33 @@ print ''; if ($search_ref || $search_label || $sall || $salert || $draftorder || GETPOST('search', 'alpha')) { - $filters = '&search_ref='.$search_ref.'&search_label='.$search_label; - $filters .= '&sall='.$sall; - $filters .= '&salert='.$salert; - $filters .= '&draftorder='.$draftorder; - $filters .= '&mode='.$mode; - $filters .= '&fk_supplier='.$fk_supplier; - $filters .= '&fk_entrepot='.$fk_entrepot; - print_barre_liste( - $texte, - $page, - 'replenish.php', - $filters, - $sortfield, - $sortorder, - '', - $num - ); + $filters = '&search_ref='.urlencode($search_ref).'&search_label='.urlencode($search_label); + $filters .= '&sall='.urlencode($sall); + $filters .= '&salert='.urlencode($salert); + $filters .= '&draftorder='.urlencode($draftorder); + $filters .= '&mode='.urlencode($mode); + $filters .= '&fk_supplier='.urlencode($fk_supplier); + $filters .= '&fk_entrepot='.urlencode($fk_entrepot); } else { - $filters = '&search_ref='.$search_ref.'&search_label='.$search_label; - $filters .= '&fourn_id='.$fourn_id; - $filters .= (isset($type) ? '&type='.$type : ''); - $filters .= '&='.$salert; - $filters .= '&draftorder='.$draftorder; - $filters .= '&mode='.$mode; - $filters .= '&fk_supplier='.$fk_supplier; - $filters .= '&fk_entrepot='.$fk_entrepot; - print_barre_liste( - $texte, - $page, - 'replenish.php', - $filters, - $sortfield, - $sortorder, - '', - $num - ); + $filters = '&search_ref='.urlencode($search_ref).'&search_label='.urlencode($search_label); + $filters .= '&fourn_id='.urlencode($fourn_id); + $filters .= (isset($type) ? '&type='.urlencode($type) : ''); + $filters .= '&='.urlencode($salert); + $filters .= '&draftorder='.urlencode($draftorder); + $filters .= '&mode='.urlencode($mode); + $filters .= '&fk_supplier='.urlencode($fk_supplier); + $filters .= '&fk_entrepot='.urlencode($fk_entrepot); } - if ($limit > 0 && $limit != $conf->liste_limit) { $filters .= '&limit='.urlencode($limit); } -$param = (isset($type) ? '&type='.$type : ''); -$param .= '&fourn_id='.$fourn_id.'&search_label='.$search_label.'&includeproductswithoutdesiredqty='.$includeproductswithoutdesiredqty.'&salert='.$salert.'&draftorder='.$draftorder; -$param .= '&search_ref='.$search_ref; -$param .= '&mode='.$mode; -$param .= '&fk_supplier='.$fk_supplier; -$param .= '&fk_entrepot='.$fk_entrepot; +$param = (isset($type) ? '&type='.urlencode($type) : ''); +$param .= '&fourn_id='.urlencode($fourn_id).'&search_label='.urlencode($search_label).'&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty).'&salert='.urlencode($salert).'&draftorder='.urlencode($draftorder); +$param .= '&search_ref='.urlencode($search_ref); +$param .= '&mode='.urlencode($mode); +$param .= '&fk_supplier='.urlencode($fk_supplier); +$param .= '&fk_entrepot='.urlencode($fk_entrepot); $stocklabel = $langs->trans('Stock'); $stocklabelbis = $langs->trans('Stock'); @@ -651,6 +634,8 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entre } $texte = $langs->trans('Replenishment'); +print '
'; + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table if (!empty($conf->global->REPLENISH_ALLOW_VARIABLESIZELIST)) { @@ -664,7 +649,7 @@ if (!empty($conf->global->REPLENISH_ALLOW_VARIABLESIZELIST)) { '', $num, $nbtotalofrecords, - 'object_stock.png', + '', 0, '', '', @@ -681,7 +666,7 @@ if (!empty($conf->global->REPLENISH_ALLOW_VARIABLESIZELIST)) { '', $num, $nbtotalofrecords, - 'object_stock.png' + '' ); } From 1f8a8459faa2563dfc869d8eb7ba04e0075fb1cc Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Fri, 13 Nov 2020 11:25:58 +0100 Subject: [PATCH 052/124] Update llx_c_currencies.sql --- .../install/mysql/data/llx_c_currencies.sql | 277 +++++++++--------- 1 file changed, 142 insertions(+), 135 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_currencies.sql b/htdocs/install/mysql/data/llx_c_currencies.sql index caa76d491cd..41cb07416bb 100644 --- a/htdocs/install/mysql/data/llx_c_currencies.sql +++ b/htdocs/install/mysql/data/llx_c_currencies.sql @@ -1,11 +1,12 @@ --- Copyright (C) 2001-2004 Rodolphe Quiedeville --- Copyright (C) 2003 Jean-Louis Bergamo --- Copyright (C) 2004-2012 Laurent Destailleur --- Copyright (C) 2004 Benoit Mortier --- Copyright (C) 2004 Guillaume Delecourt --- Copyright (C) 2005-2012 Regis Houssin --- Copyright (C) 2007 Patrick Raguin --- Copyright (C) 2011 Juanjo Menent +-- Copyright (C) 2001-2004 Rodolphe Quiedeville +-- Copyright (C) 2003 Jean-Louis Bergamo +-- Copyright (C) 2004-2012 Laurent Destailleur +-- Copyright (C) 2004 Benoit Mortier +-- Copyright (C) 2004 Guillaume Delecourt +-- Copyright (C) 2005-2012 Regis Houssin +-- Copyright (C) 2007 Patrick Raguin +-- Copyright (C) 2011 Juanjo Menent +-- Copyright (C) 2020 Udo Tamm -- -- 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 @@ -20,8 +21,11 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- --- +----------------------------------------------------------------------------- +-- +-- Do not place a comment at the end of the line, this file is parsed when +-- of the install and all the acronyms '--' are removed. -- -- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors -- de l'install et tous les sigles '--' sont supprimés. @@ -31,149 +35,152 @@ -- Currencies (primary code - code ISO4217 - libelle us) -- -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ALL', '[76,101,107]', 1, 'Albania Lek'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'DZD', NULL, 1, 'Algeria Dinar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AFN', '[1547]', 1, 'Afghanistan Afghani'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ARS', '[36]', 1, 'Argentino Peso'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AWG', '[402]', 1, 'Aruba Guilder'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AUD', '[36]', 1, 'Australia Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AZN', '[1084,1072,1085]', 1, 'Azerbaijan New Manat'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BHD', NULL, 1, 'Bahrain'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BSD', '[36]', 1, 'Bahamas Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BBD', '[36]', 1, 'Barbados Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ALL', '[76,101,107]', 1, 'Albania Lek'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'DZD', NULL, 1, 'Algeria Dinar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AFN', '[1547]', 1, 'Afghanistan Afghani'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ARS', '[36]', 1, 'Argentino Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AWG', '[402]', 1, 'Aruba Guilder'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AUD', '[36]', 1, 'Australia Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AZN', '[1084,1072,1085]', 1, 'Azerbaijan New Manat'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BHD', NULL, 1, 'Bahrain'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BSD', '[36]', 1, 'Bahamas Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BBD', '[36]', 1, 'Barbados Dollar'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BDT', '[2547]', 1, 'Bangladeshi Taka'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BYR', '[112,46]', 1, 'Belarus Ruble'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BYR', '[112,46]', 1, 'Belarus Ruble'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BZD', '[66,90,36]', 1, 'Belize Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BMD', '[36]', 1, 'Bermuda Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BOB', '[36,98]', 1, 'Bolivia Boliviano'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BAM', '[75,77]', 1, 'Bosnia and Herzegovina Convertible Marka'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BWP', '[80]', 1, 'Botswana Pula'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BMD', '[36]', 1, 'Bermuda Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BOB', '[36,98]', 1, 'Bolivia Boliviano'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BAM', '[75,77]', 1, 'Bosnia and Herzegovina Convertible Marka'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BWP', '[80]', 1, 'Botswana Pula'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BGN', '[1083,1074]', 1, 'Bulgaria Lev'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BRL', '[82,36]', 1, 'Brazil Real'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BND', '[36]', 1, 'Brunei Darussalam Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KHR', '[6107]', 1, 'Cambodia Riel'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CAD', '[36]', 1, 'Canada Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KYD', '[36]', 1, 'Cayman Islands Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CLP', '[36]', 1, 'Chile Peso'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CNY', '[165]', 1, 'China Yuan Renminbi'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'COP', '[36]', 1, 'Colombia Peso'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CRC', '[8353]', 1, 'Costa Rica Colon'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'HRK', '[107,110]', 1, 'Croatia Kuna'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CUP', '[8369]', 1, 'Cuba Peso'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CZK', '[75,269]', 1, 'Czech Republic Koruna'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'DKK', '[107,114]', 1, 'Denmark Krone'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BRL', '[82,36]', 1, 'Brazil Real'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BND', '[36]', 1, 'Brunei Darussalam Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KHR', '[6107]', 1, 'Cambodia Riel'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CAD', '[36]', 1, 'Canada Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CVE', '[4217]', 1, 'Cap Verde Escudo'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KYD', '[36]', 1, 'Cayman Islands Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CLP', '[36]', 1, 'Chile Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CNY', '[165]', 1, 'China Yuan Renminbi'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'COP', '[36]', 1, 'Colombia Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CRC', '[8353]', 1, 'Costa Rica Colon'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'HRK', '[107,110]', 1, 'Croatia Kuna'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CUP', '[8369]', 1, 'Cuba Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CZK', '[75,269]', 1, 'Czech Republic Koruna'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'DKK', '[107,114]', 1, 'Denmark Krone'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'DOP', '[82,68,36]', 1, 'Dominican Republic Peso'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XCD', '[36]', 1, 'East Caribbean Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'EGP', '[163]', 1, 'Egypt Pound'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SVC', '[36]', 1, 'El Salvador Colon'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'EEK', '[107,114]', 1, 'Estonia Kroon'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'EUR', '[8364]', 1, 'Euro Member Countries'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FKP', '[163]', 1, 'Falkland Islands (Malvinas) Pound'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FJD', '[36]', 1, 'Fiji Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GHC', '[162]', 1, 'Ghana Cedis'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GNF', '[70,71]', 1, 'Franc Guinéen'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GIP', '[163]', 1, 'Gibraltar Pound'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GTQ', '[81]', 1, 'Guatemala Quetzal'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GGP', '[163]', 1, 'Guernsey Pound'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GYD', '[36]', 1, 'Guyana Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'HNL', '[76]', 1, 'Honduras Lempira'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'HKD', '[36]', 1, 'Hong Kong Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'HUF', '[70,116]', 1, 'Hungary Forint'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ISK', '[107,114]', 1, 'Iceland Krona'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'INR', '[8377]', 1, 'India Rupee'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'IDR', '[82,112]', 1, 'Indonesia Rupiah'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'IRR', '[65020]', 1, 'Iran Rial'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'IMP', '[163]', 1, 'Isle of Man Pound'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ILS', '[8362]', 1, 'Israel Shekel'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'JMD', '[74,36]', 1, 'Jamaica Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'JPY', '[165]', 1, 'Japan Yen'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'JEP', '[163]', 1, 'Jersey Pound'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KES', NULL, 1, 'Kenya Shilling'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XCD', '[36]', 1, 'East Caribbean Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'EGP', '[163]', 1, 'Egypt Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SVC', '[36]', 1, 'El Salvador Colon'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'EEK', '[107,114]', 1, 'Estonia Kroon'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'EUR', '[8364]', 1, 'Euro Member Countries'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FKP', '[163]', 1, 'Falkland Islands (Malvinas) Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FJD', '[36]', 1, 'Fiji Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GHC', '[162]', 1, 'Ghana Cedis'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GNF', '[70,71]', 1, 'Guinea Franc'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GIP', '[163]', 1, 'Gibraltar Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GTQ', '[81]', 1, 'Guatemala Quetzal'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GGP', '[163]', 1, 'Guernsey Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GYD', '[36]', 1, 'Guyana Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'HNL', '[76]', 1, 'Honduras Lempira'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'HKD', '[36]', 1, 'Hong Kong Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'HUF', '[70,116]', 1, 'Hungary Forint'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ISK', '[107,114]', 1, 'Iceland Krona'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'INR', '[8377]', 1, 'India Rupee'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'IDR', '[82,112]', 1, 'Indonesia Rupiah'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'IRR', '[65020]', 1, 'Iran Rial'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'IMP', '[163]', 1, 'Isle of Man Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ILS', '[8362]', 1, 'Israel Shekel'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'JMD', '[74,36]', 1, 'Jamaica Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'JPY', '[165]', 1, 'Japan Yen'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'JEP', '[163]', 1, 'Jersey Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KES', NULL, 1, 'Kenya Shilling'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KZT', '[1083,1074]', 1, 'Kazakhstan Tenge'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KPW', '[8361]', 1, 'Korea (North) Won'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KRW', '[8361]', 1, 'Korea (South) Won'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KPW', '[8361]', 1, 'Korea (North) Won'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KRW', '[8361]', 1, 'Korea (South) Won'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KGS', '[1083,1074]', 1, 'Kyrgyzstan Som'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LAK', '[8365]', 1, 'Laos Kip'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LVL', '[76,115]', 1, 'Latvia Lat'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LBP', '[163]', 1, 'Lebanon Pound'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LRD', '[36]', 1, 'Liberia Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LTL', '[76,116]', 1, 'Lithuania Litas'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MGA', NULL, 1, 'Ariary'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LAK', '[8365]', 1, 'Laos Kip'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LVL', '[76,115]', 1, 'Latvia Lat'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LBP', '[163]', 1, 'Lebanon Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LRD', '[36]', 1, 'Liberia Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LTL', '[76,116]', 1, 'Lithuania Litas'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MGA', NULL, 1, 'Ariary'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MKD', '[1076,1077,1085]', 1, 'Macedonia Denar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MYR', '[82,77]', 1, 'Malaysia Ringgit'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MRO', NULL, 1, 'Mauritania Ouguiya'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MUR', '[8360]', 1, 'Mauritius Rupee'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MXN', '[36]', 1, 'Mexico Peso'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MNT', '[8366]', 1, 'Mongolia Tughrik'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MAD', NULL, 1, 'Morocco Dirham'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MZN', '[77,84]', 1, 'Mozambique Metical'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NAD', '[36]', 1, 'Namibia Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NPR', '[8360]', 1, 'Nepal Rupee'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ANG', '[402]', 1, 'Netherlands Antilles Guilder'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NZD', '[36]', 1, 'New Zealand Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NIO', '[67,36]', 1, 'Nicaragua Cordoba'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NGN', '[8358]', 1, 'Nigeria Naira'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NOK', '[107,114]', 1, 'Norway Krone'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'OMR', '[65020]', 1, 'Oman Rial'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PKR', '[8360]', 1, 'Pakistan Rupee'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MYR', '[82,77]', 1, 'Malaysia Ringgit'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MRO', NULL, 1, 'Mauritania Ouguiya'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MUR', '[8360]', 1, 'Mauritius Rupee'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MXN', '[36]', 1, 'Mexico Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MDL', NULL, 1, 'Moldova Leu'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MNT', '[8366]', 1, 'Mongolia Tughrik'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MAD', NULL, 1, 'Morocco Dirham'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MZN', '[77,84]', 1, 'Mozambique Metical'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NAD', '[36]', 1, 'Namibia Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NPR', '[8360]', 1, 'Nepal Rupee'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ANG', '[402]', 1, 'Netherlands Antilles Guilder'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NZD', '[36]', 1, 'New Zealand Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NIO', '[67,36]', 1, 'Nicaragua Cordoba'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NGN', '[8358]', 1, 'Nigeria Naira'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NOK', '[107,114]', 1, 'Norway Krone'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'OMR', '[65020]', 1, 'Oman Rial'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PKR', '[8360]', 1, 'Pakistan Rupee'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PAB', '[66,47,46]', 1, 'Panama Balboa'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PYG', '[71,115]', 1, 'Paraguay Guarani'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PYG', '[71,115]', 1, 'Paraguay Guarani'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PEN', '[83,47,46]', 1, 'Peru Nuevo Sol'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PHP', '[8369]', 1, 'Philippines Peso'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PLN', '[122,322]', 1, 'Poland Zloty'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'QAR', '[65020]', 1, 'Qatar Riyal'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PHP', '[8369]', 1, 'Philippines Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PLN', '[122,322]', 1, 'Poland Zloty'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'QAR', '[65020]', 1, 'Qatar Riyal'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'RON', '[108,101,105]', 1, 'Romania New Leu'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'RUB', '[1088,1091,1073]', 1, 'Russia Ruble'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SHP', '[163]', 1, 'Saint Helena Pound'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SAR', '[65020]', 1, 'Saudi Arabia Riyal'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'RUB', '[1088,1091,1073]', 1, 'Russia Ruble'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SHP', '[163]', 1, 'Saint Helena Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SAR', '[65020]', 1, 'Saudi Arabia Riyal'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'RSD', '[1044,1080,1085,46]', 1, 'Serbia Dinar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SCR', '[8360]', 1, 'Seychelles Rupee'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SGD', '[36]', 1, 'Singapore Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SBD', '[36]', 1, 'Solomon Islands Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SOS', '[83]', 1, 'Somalia Shilling'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ZAR', '[82]', 1, 'South Africa Rand'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LKR', '[8360]', 1, 'Sri Lanka Rupee'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SEK', '[107,114]', 1, 'Sweden Krona'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SCR', '[8360]', 1, 'Seychelles Rupee'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SGD', '[36]', 1, 'Singapore Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SBD', '[36]', 1, 'Solomon Islands Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SOS', '[83]', 1, 'Somalia Shilling'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ZAR', '[82]', 1, 'South Africa Rand'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LKR', '[8360]', 1, 'Sri Lanka Rupee'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SEK', '[107,114]', 1, 'Sweden Krona'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CHF', '[67,72,70]', 1, 'Switzerland Franc'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SRD', '[36]', 1, 'Suriname Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SYP', '[163]', 1, 'Syria Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SRD', '[36]', 1, 'Suriname Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SYP', '[163]', 1, 'Syria Pound'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TWD', '[78,84,36]', 1, 'Taiwan New Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'THB', '[3647]', 1, 'Thailand Baht'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'THB', '[3647]', 1, 'Thailand Baht'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TTD', '[84,84,36]', 1, 'Trinidad and Tobago Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TND', NULL, 1, 'Tunisia Dinar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TRL', '[84,76]', 1, 'Turkey Lira'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TRY', '[8356]', 1, 'Turkey Lira'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TVD', '[36]', 1, 'Tuvalu Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'UAH', '[8372]', 1, 'Ukraine Hryvna'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AED', NULL, 1, 'United Arab Emirates Dirham'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GBP', '[163]', 1, 'United Kingdom Pound'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'USD', '[36]', 1, 'United States Dollar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'UYU', '[36,85]', 1, 'Uruguay Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TND', NULL, 1, 'Tunisia Dinar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TRY', '[8356]', 1, 'Turkey Lira'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TVD', '[36]', 1, 'Tuvalu Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'UAH', '[8372]', 1, 'Ukraine Hryvna'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AED', NULL, 1, 'United Arab Emirates Dirham'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GBP', '[163]', 1, 'United Kingdom Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'USD', '[36]', 1, 'United States Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'UYU', '[36,85]', 1, 'Uruguay Peso'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'UZS', '[1083,1074]', 1, 'Uzbekistan Som'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'VEF', '[66,115]', 1, 'Venezuela Bolivar Fuerte'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'VND', '[8363]', 1, 'Viet Nam Dong'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XAF', NULL, 1, 'Communaute Financiere Africaine (BEAC) CFA Franc'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XOF', NULL, 1, 'Communaute Financiere Africaine (BCEAO) Franc'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XPF', '[70]', 1, 'Franc CFP'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'YER', '[65020]', 1, 'Yemen Rial'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ZWD', '[90,36]', 1, 'Zimbabwe Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'VEF', '[66,115]', 1, 'Venezuela Bolivar Fuerte'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'VND', '[8363]', 1, 'Viet Nam Dong'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XAF', NULL, 1, 'Communaute Financiere Africaine (BEAC) CFA Franc'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XOF', NULL, 1, 'Communaute Financiere Africaine (BCEAO) Franc'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XPF', '[70]', 1, 'Franc CFP'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'YER', '[65020]', 1, 'Yemen Rial'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ZWD', '[90,36]', 1, 'Zimbabwe Dollar'); -- obsolete -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ATS', NULL, 0, 'Shiliing autrichiens'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BEF', NULL, 0, 'Francs belges'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'DEM', NULL, 0, 'Deutsch mark'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ESP', NULL, 0, 'Pesete'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FIM', NULL, 0, 'Mark finlandais'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FRF', NULL, 0, 'Francs francais'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GRD', NULL, 0, 'Drachme (grece)'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'IEP', NULL, 0, 'Livres irlandaises'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ITL', NULL, 0, 'Lires'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LUF', NULL, 0, 'Francs luxembourgeois'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NLG', NULL, 0, 'Florins'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PTE', NULL, 0, 'Escudos'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SKK', NULL, 0, 'Couronnes slovaques'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SUR', NULL, 0, 'Rouble'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XEU', NULL, 0, 'Ecus'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ATS', NULL, 0, 'Shiliing autrichiens'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BEF', NULL, 0, 'Francs belges'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'DEM', NULL, 0, 'Deutsche Mark'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ESP', NULL, 0, 'Pesete'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FIM', NULL, 0, 'Mark finlandais'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FRF', NULL, 0, 'Francs francais'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GRD', NULL, 0, 'Drachme (grece)'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'IEP', NULL, 0, 'Livres irlandaises'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ITL', NULL, 0, 'Lires'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LUF', NULL, 0, 'Francs luxembourgeois'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NLG', NULL, 0, 'Florins'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PTE', NULL, 0, 'Escudos'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SKK', NULL, 0, 'Couronnes slovaques'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SUR', NULL, 0, 'Rouble'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XEU', NULL, 0, 'Ecus'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TRL', '[84,76]', 0, 'Turkey Lira'); + -- invalid (for compatibility) INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ARP', NULL, 0, 'Pesos argentins'); From 8aaee7fa5e921e08364dfc052e0b84ed84386a27 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Nov 2020 11:28:02 +0100 Subject: [PATCH 053/124] Fix replenishment must exclude parent of variants. --- htdocs/langs/en_US/stocks.lang | 2 +- htdocs/product/stock/replenish.php | 123 ++++++++++++++--------------- 2 files changed, 62 insertions(+), 63 deletions(-) diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index b0507c69071..d2c1b2cb382 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -34,7 +34,7 @@ StockMovementForId=Movement ID %d ListMouvementStockProject=List of stock movements associated to project StocksArea=Warehouses area AllWarehouses=All warehouses -IncludeEmptyDesiredStock=Include also undefined desired stock +IncludeEmptyDesiredStock=Include also negative stock with undefined desired stock IncludeAlsoDraftOrders=Include also draft orders Location=Location LocationSummary=Short name location diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 96b9d62c3fb..4fb8e24370c 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -352,7 +352,9 @@ if (dol_strlen($type)) { if ($search_ref) $sql .= natural_search('p.ref', $search_ref); if ($search_label) $sql .= natural_search('p.label', $search_label); $sql .= ' AND p.tobuy = 1'; -if (!empty($canvas)) $sql .= ' AND p.canvas = "'.$db->escape($canvas).'"'; +if (empty($conf->global->VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT)) { // Add test to exclude products that has variants + $sql .= ' AND p.rowid NOT IN (SELECT pac.fk_product_parent FROM '.MAIN_DB_PREFIX.'product_attribute_combination as pac WHERE pac.entity IN ('.getEntity('product').'))'; +} $sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price'; $sql .= ', p.price_ttc, p.price_base_type,p.fk_product_type, p.tms'; $sql .= ', p.duration, p.tobuy'; @@ -538,13 +540,13 @@ if ($usevirtualstock == 1) { print $langs->trans("CurentSelectionMode").': '; print ''.$langs->trans("UseVirtualStock").''; - print ' '.$langs->trans("UsePhysicalStock").''; + print ' 0 ? '&fk_supplier='.$fk_supplier : '').($fk_entrepot > 0 ? '&fk_entrepot='.$fk_entrepot : '').'">'.$langs->trans("UsePhysicalStock").''; print '
'; } if ($usevirtualstock == 0) { print $langs->trans("CurentSelectionMode").': '; - print ''.$langs->trans("UseVirtualStock").''; + print ' 0 ? '&fk_supplier='.$fk_supplier : '').($fk_entrepot > 0 ? '&fk_entrepot='.$fk_entrepot : '').'">'.$langs->trans("UseVirtualStock").''; print ' '.$langs->trans("UsePhysicalStock").''; print '
'; } @@ -600,8 +602,8 @@ if ($search_ref || $search_label || $sall || $salert || $draftorder || GETPOST(' $filters .= '&salert='.urlencode($salert); $filters .= '&draftorder='.urlencode($draftorder); $filters .= '&mode='.urlencode($mode); - $filters .= '&fk_supplier='.urlencode($fk_supplier); - $filters .= '&fk_entrepot='.urlencode($fk_entrepot); + if ($fk_supplier > 0) $filters .= '&fk_supplier='.urlencode($fk_supplier); + if ($fk_entrepot > 0) $filters .= '&fk_entrepot='.urlencode($fk_entrepot); } else { $filters = '&search_ref='.urlencode($search_ref).'&search_label='.urlencode($search_label); $filters .= '&fourn_id='.urlencode($fourn_id); @@ -609,8 +611,8 @@ if ($search_ref || $search_label || $sall || $salert || $draftorder || GETPOST(' $filters .= '&='.urlencode($salert); $filters .= '&draftorder='.urlencode($draftorder); $filters .= '&mode='.urlencode($mode); - $filters .= '&fk_supplier='.urlencode($fk_supplier); - $filters .= '&fk_entrepot='.urlencode($fk_entrepot); + if ($fk_supplier > 0) $filters .= '&fk_supplier='.urlencode($fk_supplier); + if ($fk_entrepot > 0) $filters .= '&fk_entrepot='.urlencode($fk_entrepot); } if ($limit > 0 && $limit != $conf->liste_limit) { $filters .= '&limit='.urlencode($limit); @@ -815,67 +817,64 @@ while ($i < ($limit ? min($num, $limit) : $num)) $picto = img_picto($langs->trans("NoPendingReceptionOnSupplierOrder"), 'help'); } - $variants = $prod->hasVariants(); - if (!$variants || !empty($conf->global->VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT)) { - print '
'; + print ''; - // Select field - print ''; + // Select field + print ''; - print ''; + print ''; - print ''; + print ''; - if (!empty($conf->service->enabled) && $type == 1) - { - $regs = array(); - if (preg_match('/([0-9]+)y/i', $objp->duration, $regs)) { - $duration = $regs[1].' '.$langs->trans('DurationYear'); - } elseif (preg_match('/([0-9]+)m/i', $objp->duration, $regs)) { - $duration = $regs[1].' '.$langs->trans('DurationMonth'); - } elseif (preg_match('/([0-9]+)d/i', $objp->duration, $regs)) { - $duration = $regs[1].' '.$langs->trans('DurationDay'); - } else { - $duration = $objp->duration; - } - print ''; + if (!empty($conf->service->enabled) && $type == 1) + { + $regs = array(); + if (preg_match('/([0-9]+)y/i', $objp->duration, $regs)) { + $duration = $regs[1].' '.$langs->trans('DurationYear'); + } elseif (preg_match('/([0-9]+)m/i', $objp->duration, $regs)) { + $duration = $regs[1].' '.$langs->trans('DurationMonth'); + } elseif (preg_match('/([0-9]+)d/i', $objp->duration, $regs)) { + $duration = $regs[1].' '.$langs->trans('DurationDay'); + } else { + $duration = $objp->duration; } - - // Desired stock - print ''; - - // Limit stock for alert - print ''; - - // Current stock (all warehouses) - print ''; - - // Current stock (warehouse selected only) - if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) - { - print ''; - } - - // Already ordered - print ''; - - // To order - print ''; - - // Supplier - print ''; - - // Fields from hook - $parameters = array('objp'=>$objp); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - print ''; + print ''; } + + // Desired stock + print ''; + + // Limit stock for alert + print ''; + + // Current stock (all warehouses) + print ''; + + // Current stock (warehouse selected only) + if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) + { + print ''; + } + + // Already ordered + print ''; + + // To order + print ''; + + // Supplier + print ''; + + // Fields from hook + $parameters = array('objp'=>$objp); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + print ''; } $i++; } From f92b5e87dc6bb3b4695d3b512dc0bbb5f18fa22c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Nov 2020 14:35:04 +0100 Subject: [PATCH 054/124] doxygen --- htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php index 201191d1262..0bd03301389 100644 --- a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php +++ b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php @@ -252,7 +252,7 @@ class PrestaShopWebservice * Examples are given in the tutorial

* * @param array $options Options - * @return SimpleXMLElement status_code, response + * @return SimpleXMLElement|boolean status_code, response * * @throw PrestaShopWebserviceException */ @@ -379,7 +379,7 @@ class PrestaShopWebservice * Examples are given in the tutorial

* * @param array $options Array representing resource to edit. - * @return SimpleXMLElement status_code, response + * @return SimpleXMLElement|boolean status_code, response * * @throw PrestaShopWebserviceException */ From 86481d16d0ca4f2f80929f4802bdc8597eb2d792 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Nov 2020 15:02:49 +0100 Subject: [PATCH 055/124] Clean code --- .../project/doc/pdf_baleine.modules.php | 76 +++---------------- .../project/doc/pdf_beluga.modules.php | 4 +- .../project/doc/pdf_timespent.modules.php | 65 ++++++++++------ .../core/modules/project/modules_project.php | 55 ++++++++++++++ 4 files changed, 110 insertions(+), 90 deletions(-) diff --git a/htdocs/core/modules/project/doc/pdf_baleine.modules.php b/htdocs/core/modules/project/doc/pdf_baleine.modules.php index e6d63801b01..6baf416ed64 100644 --- a/htdocs/core/modules/project/doc/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/doc/pdf_baleine.modules.php @@ -38,26 +38,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; class pdf_baleine extends ModelePDFProjects { - /** - * @var DoliDb Database handler - */ - public $db; - - /** - * @var string model name - */ - public $name; - - /** - * @var string model description (short text) - */ - public $description; - - /** - * @var string document type - */ - public $type; - /** * @var array Minimum version of PHP required by module. * e.g.: PHP ≥ 5.6 = array(5, 6) @@ -70,44 +50,9 @@ class pdf_baleine extends ModelePDFProjects */ public $version = 'dolibarr'; - /** - * @var int page_largeur - */ - public $page_largeur; - - /** - * @var int page_hauteur - */ - public $page_hauteur; - - /** - * @var array format - */ - public $format; - - /** - * @var int marge_gauche - */ - public $marge_gauche; - - /** - * @var int marge_droite - */ - public $marge_droite; - - /** - * @var int marge_haute - */ - public $marge_haute; - - /** - * @var int marge_basse - */ - public $marge_basse; - /** * Issuer - * @var Societe object that emits + * @var Societe Object that emits */ public $emetteur; @@ -149,10 +94,10 @@ class pdf_baleine extends ModelePDFProjects // Define position of columns $this->posxref = $this->marge_gauche + 1; $this->posxlabel = $this->marge_gauche + 25; - $this->posxworkload = $this->marge_gauche + 120; - $this->posxprogress = $this->marge_gauche + 140; - $this->posxdatestart = $this->marge_gauche + 152; - $this->posxdateend = $this->marge_gauche + 170; + $this->posxworkload = $this->marge_gauche + 117; + $this->posxprogress = $this->marge_gauche + 137; + $this->posxdatestart = $this->marge_gauche + 147; + $this->posxdateend = $this->marge_gauche + 169; if ($this->page_largeur < 210) // To work with US executive format { $this->posxref -= 20; @@ -420,7 +365,8 @@ class pdf_baleine extends ModelePDFProjects // Progress $pdf->SetXY($this->posxprogress, $curY); $pdf->MultiCell($this->posxdatestart - $this->posxprogress, 3, $progress, 0, 'R'); - // Date + + // Date start and end $pdf->SetXY($this->posxdatestart, $curY); $pdf->MultiCell($this->posxdateend - $this->posxdatestart, 3, $datestart, 0, 'C'); $pdf->SetXY($this->posxdateend, $curY); @@ -538,7 +484,7 @@ class pdf_baleine extends ModelePDFProjects // Draw rect of all tab (title + lines). 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); - // line takes a position y in 3rd parameter + // Line takes a position y in 3rd parameter $pdf->line($this->marge_gauche, $tab_top + $heightoftitleline, $this->page_largeur - $this->marge_droite, $tab_top + $heightoftitleline); $pdf->SetTextColor(0, 0, 0); @@ -556,11 +502,13 @@ class pdf_baleine extends ModelePDFProjects $pdf->SetXY($this->posxprogress, $tab_top + 1); $pdf->MultiCell($this->posxdatestart - $this->posxprogress, 3, '%', 0, 'R'); + // Date start $pdf->SetXY($this->posxdatestart, $tab_top + 1); - $pdf->MultiCell($this->posxdateend - $this->posxdatestart, 3, '', 0, 'C'); + $pdf->MultiCell($this->posxdateend - $this->posxdatestart, 3, $outputlangs->trans("Start"), 0, 'C'); + // Date end $pdf->SetXY($this->posxdateend, $tab_top + 1); - $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdatestart, 3, '', 0, 'C'); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdateend, 3, $outputlangs->trans("End"), 0, 'C'); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index aa7b280aa1a..0f877428052 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -111,14 +111,14 @@ class pdf_beluga extends ModelePDFProjects if ($this->orientation == 'L' || $this->orientation == 'Landscape') { $this->posxref = $this->marge_gauche + 1; $this->posxdate = $this->marge_gauche + 105; - $this->posxsociety = $this->marge_gauche + 125; + $this->posxsociety = $this->marge_gauche + 126; $this->posxamountht = $this->marge_gauche + 190; $this->posxamountttc = $this->marge_gauche + 215; $this->posxstatut = $this->marge_gauche + 245; } else { $this->posxref = $this->marge_gauche + 1; $this->posxdate = $this->marge_gauche + 25; - $this->posxsociety = $this->marge_gauche + 45; + $this->posxsociety = $this->marge_gauche + 46; $this->posxamountht = $this->marge_gauche + 110; $this->posxamountttc = $this->marge_gauche + 135; $this->posxstatut = $this->marge_gauche + 165; diff --git a/htdocs/core/modules/project/doc/pdf_timespent.modules.php b/htdocs/core/modules/project/doc/pdf_timespent.modules.php index 34de2458f3b..5426e076d33 100644 --- a/htdocs/core/modules/project/doc/pdf_timespent.modules.php +++ b/htdocs/core/modules/project/doc/pdf_timespent.modules.php @@ -37,9 +37,21 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; class pdf_timespent extends ModelePDFProjects { + /** + * @var array Minimum version of PHP required by module. + * e.g.: PHP ≥ 5.6 = array(5, 6) + */ + public $phpmin = array(5, 6); + + /** + * Dolibarr version of the loaded document + * @var string + */ + public $version = 'dolibarr'; + /** * Issuer - * @var Societe + * @var Societe Object that emits */ public $emetteur; @@ -81,25 +93,26 @@ class pdf_timespent extends ModelePDFProjects // Define position of columns $this->posxref = $this->marge_gauche + 1; $this->posxlabel = $this->marge_gauche + 25; + $this->posxworkload = $this->marge_gauche + 100; $this->posxtimespent = $this->marge_gauche + 120; //$this->posxprogress=$this->marge_gauche+140; - $this->posxdatestart = $this->marge_gauche + 152; - $this->posxdateend = $this->marge_gauche + 170; + $this->posxuser = $this->marge_gauche + 147; + //$this->posxdateend = $this->marge_gauche + 169; if ($this->page_largeur < 210) // To work with US executive format { $this->posxref -= 20; $this->posxlabel -= 20; $this->posxtimespent -= 20; //$this->posxprogress-=20; - $this->posxdatestart -= 20; - $this->posxdateend -= 20; + $this->posxuser -= 20; + //$this->posxdateend -= 20; } } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Fonction generant le projet sur le disque + * Function to build pdf project onto disk * * @param Project $object Object project a generer * @param Translate $outputlangs Lang output object @@ -156,6 +169,7 @@ class pdf_timespent extends ModelePDFProjects $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 (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; if (class_exists('TCPDF')) { @@ -227,7 +241,7 @@ class pdf_timespent extends ModelePDFProjects // 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 - 2, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 2); $tab_height = $tab_height - $height_note; $tab_top = $nexY + 6; @@ -240,6 +254,10 @@ class pdf_timespent extends ModelePDFProjects $curY = $tab_top + $heightoftitleline + 1; $nexY = $tab_top + $heightoftitleline + 1; + $tmpuser = new User($this->db); + + // TODO We should loop on record of times spent grouped by user instead of lines of tasks + // Loop on each lines for ($i = 0; $i < $nblines; $i++) { @@ -340,22 +358,24 @@ class pdf_timespent extends ModelePDFProjects $pdf->setPage($pageposafter); $curY = $tab_top_newpage + $heightoftitleline + 1; } - $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut + $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font // Ref of task $pdf->SetXY($this->posxref, $curY); $pdf->MultiCell($this->posxlabel - $this->posxref, 3, $outputlangs->convToOutputCharset($ref), 0, 'L'); // timespent $pdf->SetXY($this->posxtimespent, $curY); - $pdf->MultiCell($this->posxdatestart - $this->posxtimespent, 3, $duration ? $duration : '', 0, 'R'); + $pdf->MultiCell($this->posxuser - $this->posxtimespent, 3, $duration ? $duration : '', 0, 'R'); // Progress //$pdf->SetXY($this->posxprogress, $curY); - //$pdf->MultiCell($this->posxdatestart-$this->posxprogress, 3, $progress, 0, 'R'); - // Date - $pdf->SetXY($this->posxdatestart, $curY); - $pdf->MultiCell($this->posxdateend - $this->posxdatestart, 3, $datestart, 0, 'C'); - $pdf->SetXY($this->posxdateend, $curY); - $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdateend, 3, $dateend, 0, 'C'); + //$pdf->MultiCell($this->posxuser-$this->posxprogress, 3, $progress, 0, 'R'); + + // User spending time + /*var_dump($object->lines[$i]);exit; + $tmpuser->fetch($object->lines[$i]->fk_user); + $pdf->SetXY($this->posxuser, $curY); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxuser, 3, $tmpuser->getFullName($outputlangs, 0, -1, 20), 0, 'C'); + */ // Add line if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) @@ -408,7 +428,7 @@ class pdf_timespent extends ModelePDFProjects 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; - // Pied de page + // Footer of the page $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); @@ -469,7 +489,7 @@ class pdf_timespent extends ModelePDFProjects // Draw rect of all tab (title + lines). 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); - // line prend une position y en 3eme param + // Line takes a position y in 3rd parameter $pdf->line($this->marge_gauche, $tab_top + $heightoftitleline, $this->page_largeur - $this->marge_droite, $tab_top + $heightoftitleline); $pdf->SetTextColor(0, 0, 0); @@ -482,16 +502,13 @@ class pdf_timespent extends ModelePDFProjects $pdf->MultiCell($this->posxtimespent - $this->posxlabel, 3, $outputlangs->transnoentities("Description"), 0, 'L'); $pdf->SetXY($this->posxtimespent, $tab_top + 1); - $pdf->MultiCell($this->posxdatestart - $this->posxtimespent, 3, $outputlangs->transnoentities("TimeSpent"), 0, 'R'); + $pdf->MultiCell($this->posxuser - $this->posxtimespent, 3, $outputlangs->transnoentities("TimeSpent"), 0, 'R'); //$pdf->SetXY($this->posxprogress, $tab_top+1); - //$pdf->MultiCell($this->posxdatestart-$this->posxprogress, 3, '%', 0, 'R'); + //$pdf->MultiCell($this->posxuser - $this->posxprogress, 3, '%', 0, 'R'); - $pdf->SetXY($this->posxdatestart, $tab_top + 1); - $pdf->MultiCell($this->posxdateend - $this->posxdatestart, 3, $outputlangs->transnoentities("Date"), 0, 'C'); - - $pdf->SetXY($this->posxdateend, $tab_top + 1); - $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdatestart, 3, '', 0, 'C'); + $pdf->SetXY($this->posxuser, $tab_top + 1); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxuser, 3, '', 0, 'C'); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore diff --git a/htdocs/core/modules/project/modules_project.php b/htdocs/core/modules/project/modules_project.php index 72a86ba7ca4..6f174a27d7a 100644 --- a/htdocs/core/modules/project/modules_project.php +++ b/htdocs/core/modules/project/modules_project.php @@ -31,6 +31,61 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; */ abstract class ModelePDFProjects extends CommonDocGenerator { + /** + * @var DoliDb Database handler + */ + public $db; + + /** + * @var string model name + */ + public $name; + + /** + * @var string model description (short text) + */ + public $description; + + /** + * @var string document type + */ + public $type; + + /** + * @var int page_largeur + */ + public $page_largeur; + + /** + * @var int page_hauteur + */ + public $page_hauteur; + + /** + * @var array format + */ + public $format; + + /** + * @var int marge_gauche + */ + public $marge_gauche; + + /** + * @var int marge_droite + */ + public $marge_droite; + + /** + * @var int marge_haute + */ + public $marge_haute; + + /** + * @var int marge_basse + */ + public $marge_basse; + /** * @var string Error code (or message) */ From 283a42c086403d297b08e9825c4cf4ca17ac8eec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Nov 2020 19:38:44 +0100 Subject: [PATCH 056/124] Fix bad key --- htdocs/user/class/user.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index db63b2a3e8d..12e1a63a3ce 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -3000,7 +3000,8 @@ class User extends CommonObject $this->office_fax = $ldapuser->{$conf->global->LDAP_FIELD_FAX}; $this->email = $ldapuser->{$conf->global->LDAP_FIELD_MAIL}; foreach ($socialnetworks as $key => $value) { - $this->socialnetworks[$value['label']] = $ldapuser{$conf->global->{'LDAP_FIELD_'.strtoupper($value['label'])}}; + $tmpkey = 'LDAP_FIELD_'.strtoupper($value['label']); + $this->socialnetworks[$value['label']] = $ldapuser->{$conf->global->$tmpkey}; } $this->ldap_sid = $ldapuser->{$conf->global->LDAP_FIELD_SID}; From 1f69f4ed5dc7fb06c9a320a5177e4ef06858156b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Nov 2020 19:39:59 +0100 Subject: [PATCH 057/124] Fix deprecated --- htdocs/user/class/user.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 12e1a63a3ce..41e1d55ea7c 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -3006,7 +3006,7 @@ class User extends CommonObject $this->ldap_sid = $ldapuser->{$conf->global->LDAP_FIELD_SID}; $this->job = $ldapuser->{$conf->global->LDAP_FIELD_TITLE}; - $this->note = $ldapuser->{$conf->global->LDAP_FIELD_DESCRIPTION}; + $this->note_public = $ldapuser->{$conf->global->LDAP_FIELD_DESCRIPTION}; $result = $this->update($user); From 42ddf7e27be41eddff756a67cfb4c686a14f7678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Nov 2020 20:45:03 +0100 Subject: [PATCH 058/124] doxygen --- htdocs/core/class/openid.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/openid.class.php b/htdocs/core/class/openid.class.php index 0d382a78589..b2a265c47d5 100644 --- a/htdocs/core/class/openid.class.php +++ b/htdocs/core/class/openid.class.php @@ -101,7 +101,7 @@ class SimpleOpenID /** * SetRequiredFields * - * @param string $a Server + * @param string|array $a Server * @return void */ public function SetRequiredFields($a) @@ -118,7 +118,7 @@ class SimpleOpenID /** * SetOptionalFields * - * @param string $a Server + * @param string|array $a Server * @return void */ public function SetOptionalFields($a) From 2f3ff6628db3489d1cfed8f462a5a74145801df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Nov 2020 20:51:48 +0100 Subject: [PATCH 059/124] The variable $obj does not seem to be defined The variable $obj does not seem to be defined for all execution paths leading up to this point. --- htdocs/core/modules/printing/printipp.modules.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/printing/printipp.modules.php b/htdocs/core/modules/printing/printipp.modules.php index 0a9cb1210ee..5d840cb5ca3 100644 --- a/htdocs/core/modules/printing/printipp.modules.php +++ b/htdocs/core/modules/printing/printipp.modules.php @@ -1,6 +1,6 @@ + * Copyright (C) 2014-2020 Frederic 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 @@ -141,6 +141,8 @@ class printing_printipp extends PrintingDriver $ipp->setPort($this->port); $ipp->setJobName($file, true); $ipp->setUserName($this->userid); + // Set default number of copy + $ipp->setCopies(1); if (!empty($this->user)) $ipp->setAuthentication($this->user, $this->password); // select printer uri for module order, propal,... @@ -148,10 +150,11 @@ class printing_printipp extends PrintingDriver $result = $this->db->query($sql); if ($result) { $obj = $this->db->fetch_object($result); - if ($obj) - { + if ($obj) { dol_syslog("Found a default printer for user ".$user->id." = ".$obj->printer_id); $ipp->setPrinterURI($obj->printer_id); + // Set number of copy + $ipp->setCopies($obj->copy); } else { if (!empty($conf->global->PRINTIPP_URI_DEFAULT)) { @@ -167,8 +170,6 @@ class printing_printipp extends PrintingDriver dol_print_error($this->db); } - // Set number of copy - $ipp->setCopies($obj->copy); $fileprint = $conf->{$module}->dir_output; if ($subdir != '') $fileprint .= '/'.$subdir; $fileprint .= '/'.$file; From c4b13b154e314cbd1583cf651781fa54854bee78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Nov 2020 21:00:23 +0100 Subject: [PATCH 060/124] doxygen --- htdocs/user/clicktodial.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php index 339cb794c12..a97d011a2e2 100644 --- a/htdocs/user/clicktodial.php +++ b/htdocs/user/clicktodial.php @@ -28,8 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; // Load translation files required by page $langs->loadLangs(array('users', 'admin')); -$action = GETPOST('action', 'aZ09'); -$id = GETPOST('id', 'int'); +$action = (string) GETPOST('action', 'aZ09'); +$id = (int) GETPOST('id', 'int'); // Security check $socid = 0; @@ -54,14 +54,13 @@ if (empty($reshook)) { $edituser = new User($db); $edituser->fetch($id); - $edituser->clicktodial_url = GETPOST("url"); - $edituser->clicktodial_login = GETPOST("login"); - $edituser->clicktodial_password = GETPOST("password"); - $edituser->clicktodial_poste = GETPOST("poste"); + $edituser->clicktodial_url = (string) GETPOST("url", "alpha"); + $edituser->clicktodial_login = (string) GETPOST("login", "alpha"); + $edituser->clicktodial_password = (string) GETPOST("password", "alpha"); + $edituser->clicktodial_poste = (string) GETPOST("poste", "alpha"); $result = $edituser->update_clicktodial(); - if ($result < 0) - { + if ($result < 0) { setEventMessages($edituser->error, $edituser->errors, 'errors'); } } From 0448a76df560faf65a3c7e3b3bca0fa82388ad4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Nov 2020 21:13:00 +0100 Subject: [PATCH 061/124] doxygen --- .../class/opensurveysondage.class.php | 70 +++++++++++-------- 1 file changed, 42 insertions(+), 28 deletions(-) diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index f8f6cb0f885..4b8ac089591 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2014 Marcos García + * Copyright (C) 2020 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -60,7 +61,14 @@ class Opensurveysondage extends CommonObject */ public $description; + /** + * @var string email admin + */ public $mail_admin; + + /** + * @var admin name + */ public $nom_admin; /** @@ -75,10 +83,21 @@ class Opensurveysondage extends CommonObject public $title; public $date_fin = ''; + + /** + * @var int status + */ public $status = 1; public $format; + + /** + * @var int mailsonde + */ public $mailsonde; + /** + * @var string subject + */ public $sujet; /** @@ -133,8 +152,7 @@ class Opensurveysondage extends CommonObject $this->cleanParameters(); // Check parameters - if (!$this->date_fin > 0) - { + if (!$this->date_fin > 0) { $this->error = 'BadValueForEndDate'; dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); return -1; @@ -156,10 +174,10 @@ class Opensurveysondage extends CommonObject $sql .= ") VALUES ("; $sql .= "'".$this->db->escape($this->id_sondage)."',"; $sql .= " ".(empty($this->description) ? 'NULL' : "'".$this->db->escape($this->description)."'").","; - $sql .= " ".$user->id.","; + $sql .= " ".(int) $user->id.","; $sql .= " '".$this->db->escape($this->title)."',"; $sql .= " '".$this->db->idate($this->date_fin)."',"; - $sql .= " ".$this->status.","; + $sql .= " ".(int) $this->status.","; $sql .= " '".$this->db->escape($this->format)."',"; $sql .= " ".$this->db->escape($this->mailsonde).","; $sql .= " ".$this->db->escape($this->allow_comments).","; @@ -173,17 +191,13 @@ class Opensurveysondage extends CommonObject $resql = $this->db->query($sql); if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } - if (!$error) - { - if (!$notrigger) - { - global $langs, $conf; + if (!$error && !$notrigger) + global $langs, $conf; - // Call trigger - $result = $this->call_trigger('OPENSURVEY_CREATE', $user); - if ($result < 0) $error++; - // End call triggers - } + // Call trigger + $result = $this->call_trigger('OPENSURVEY_CREATE', $user); + if ($result < 0) $error++; + // End call triggers } // Commit or rollback @@ -310,10 +324,12 @@ class Opensurveysondage extends CommonObject dol_syslog(get_class($this)."::update", 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 && !$notrigger) - { + if (!$error && !$notrigger) { // Call trigger $result = $this->call_trigger('OPENSURVEY_MODIFY', $user); if ($result < 0) $error++; @@ -356,15 +372,11 @@ class Opensurveysondage extends CommonObject $this->db->begin(); - if (!$error) - { - if (!$notrigger) - { - // Call trigger - $result = $this->call_trigger('OPENSURVEY_DELETE', $user); - if ($result < 0) $error++; - // End call triggers - } + if (!$error && !$notrigger) { + // Call trigger + $result = $this->call_trigger('OPENSURVEY_DELETE', $user); + if ($result < 0) $error++; + // End call triggers } if (!$error) @@ -441,7 +453,9 @@ class Opensurveysondage extends CommonObject } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else { + $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } $linkstart = ''; @@ -591,7 +605,7 @@ class Opensurveysondage extends CommonObject $this->mail_admin = trim($this->mail_admin); $this->nom_admin = trim($this->nom_admin); $this->title = trim($this->title); - $this->status = trim($this->status); + $this->status = (int) $this->status; $this->format = trim($this->format); $this->mailsonde = ($this->mailsonde ? 1 : 0); $this->allow_comments = ($this->allow_comments ? 1 : 0); From fd14ce4ea47df324c0f4ab2314b91085c03761ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Nov 2020 21:16:58 +0100 Subject: [PATCH 062/124] Update opensurveysondage.class.php --- htdocs/opensurvey/class/opensurveysondage.class.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 4b8ac089591..27179a20ac3 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -50,7 +50,6 @@ class Opensurveysondage extends CommonObject */ public $picto = 'poll'; - /** * @var string ID survey */ @@ -88,6 +87,10 @@ class Opensurveysondage extends CommonObject * @var int status */ public $status = 1; + + /** + * @var string format of survey + */ public $format; /** @@ -201,10 +204,8 @@ class Opensurveysondage extends CommonObject } // Commit or rollback - if ($error) - { - foreach ($this->errors as $errmsg) - { + if ($error) { + foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); $this->error .= ($this->error ? ', '.$errmsg : $errmsg); } From 894f1e8215857bcb5dedab0118dad6707538b278 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Nov 2020 21:20:17 +0100 Subject: [PATCH 063/124] Update card.php --- htdocs/opensurvey/card.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index 96bcd2af739..92d0f7a3eb5 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2014 Marcos García - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -41,14 +41,13 @@ $cancel = GETPOST('cancel', 'alpha'); $numsondage = ''; if (GETPOST('id')) { - $numsondage = GETPOST('id', 'alpha'); + $numsondage = (string) GETPOST('id', 'alpha'); } $object = new Opensurveysondage($db); $result = $object->fetch(0, $numsondage); -if ($result <= 0) -{ +if ($result <= 0) { dol_print_error($db, $object->error); exit; } @@ -112,17 +111,16 @@ if (empty($reshook)) if (!$error) { - $object->title = GETPOST('nouveautitre', 'nohtml'); - $object->description = GETPOST('nouveauxcommentaires', 'restricthtml'); - $object->mail_admin = GETPOST('nouvelleadresse', 'alpha'); + $object->title = (string) GETPOST('nouveautitre', 'nohtml'); + $object->description = (string) GETPOST('nouveauxcommentaires', 'restricthtml'); + $object->mail_admin = (string) GETPOST('nouvelleadresse', 'alpha'); $object->date_fin = $expiredate; $object->allow_comments = GETPOST('cancomment', 'alpha') == 'on' ? 1 : 0; $object->allow_spy = GETPOST('canseeothersvote', 'alpha') == 'on' ? 1 : 0; $object->mailsonde = GETPOST('mailsonde', 'alpha') == 'on' ? true : false; $res = $object->update($user); - if ($res < 0) - { + if ($res < 0) { setEventMessages($object->error, $object->errors, 'errors'); $action = 'edit'; } From 10bdb1f787f39a1d061155e9dfb3284c29fa3304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Nov 2020 21:21:48 +0100 Subject: [PATCH 064/124] Update opensurveysondage.class.php --- htdocs/opensurvey/class/opensurveysondage.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 27179a20ac3..595270b78ad 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -194,7 +194,7 @@ class Opensurveysondage extends CommonObject $resql = $this->db->query($sql); if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } - if (!$error && !$notrigger) + if (!$error && !$notrigger) { global $langs, $conf; // Call trigger From dd2ab6f36006028f498f3a5033fd2930cbf24e55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Nov 2020 21:56:17 +0100 Subject: [PATCH 065/124] Update card.php --- htdocs/adherents/card.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index bd3ad481cd8..fe6f27ef8b6 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -6,7 +6,7 @@ * Copyright (C) 2012 Marcos García * Copyright (C) 2012-2020 Philippe Grand * Copyright (C) 2015-2018 Alexandre Spangaro - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1564,7 +1564,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', ''); } else { if ($object->user_id) { - $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'none'); + $linkeduser = new User($db); + $linkeduser->fetch($object->user_id); + print $linkeduser->getNomUrl(-1); } else { print $langs->trans("NoDolibarrAccess"); } From 5c159c6344cdcc2e3c97dbdb5ad197dc9fd966c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Nov 2020 21:57:46 +0100 Subject: [PATCH 066/124] Update card.php --- htdocs/user/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 6a928e0bfee..cd6eb0991d9 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -13,7 +13,7 @@ * Copyright (C) 2015 Ari Elbaz (elarifr) * Copyright (C) 2015-2018 Charlene Benke * Copyright (C) 2016 Raphaël Doursenaud - * Copyright (C) 2018-2019 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * Copyright (C) 2018 David Beniamine * * This program is free software; you can redistribute it and/or modify @@ -1781,7 +1781,7 @@ if ($action == 'create' || $action == 'adduserldap') $adh = new Adherent($db); $adh->fetch($object->fk_member); $adh->ref = $adh->getFullname($langs); // Force to show login instead of id - print $adh->getNomUrl(1); + print $adh->getNomUrl(-1); } else { print $langs->trans("UserNotLinkedToMember"); } From cce6afbeea6bc596c5ed86748d140bd8c19342af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Nov 2020 22:22:51 +0100 Subject: [PATCH 067/124] fix member status in box --- htdocs/core/boxes/box_members.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php index 72bc088ae6c..2d0ad45a266 100644 --- a/htdocs/core/boxes/box_members.php +++ b/htdocs/core/boxes/box_members.php @@ -2,7 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2015 Frederic France + * Copyright (C) 2015-2020 Frederic 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 @@ -116,6 +116,7 @@ class box_members extends ModeleBoxes $memberstatic->email = $objp->email; $memberstatic->morphy = $objp->morphy; $memberstatic->company = $objp->company; + $memberstatic->statut = $objp->status; if (!empty($objp->fk_soc)) { $memberstatic->socid = $objp->fk_soc; From 70f1ed53f8b6b264e6802c02f159e4f895fee579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Nov 2020 22:51:10 +0100 Subject: [PATCH 068/124] can upload odt model for user --- .../user/doc/doc_generic_user_odt.modules.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index 2f534f86813..771231e6041 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -1,7 +1,7 @@ * Copyright (C) 2012 Juanjo Menent - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -114,7 +114,7 @@ class doc_generic_user_odt extends ModelePDFUser $form = new Form($this->db); $texte = $this->description.".
\n"; - $texte .= '
'; + $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; @@ -187,7 +187,17 @@ class doc_generic_user_odt extends ModelePDFUser $texte .= ""; $texte .= '
'; $validator = new UserGroup($db); @@ -631,7 +631,7 @@ if ($resql) // If we ask a dedicated card and not allow to see it, we force on user. - if ($id && empty($user->rights->holiday->read_all) && !in_array($id, $childids)) { + if ($id && empty($user->rights->holiday->readall) && !in_array($id, $childids)) { $langs->load("errors"); print '
'.$langs->trans("NotEnoughPermissions").'
'.$langs->trans("UseVirtualStockByDefault").''; + print $form->textwithpicto($langs->trans("UseRealStockByDefault"), $langs->trans("ReplenishmentCalculation")); + print ''; if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_USE_VIRTUAL_STOCK'); + print ajax_constantonoff('STOCK_USE_REAL_STOCK_BY_DEFAULT_FOR_REPLENISHMENT'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_USE_VIRTUAL_STOCK", $arrval, $conf->global->STOCK_USE_VIRTUAL_STOCK); + print $form->selectarray("STOCK_USE_REAL_STOCK_BY_DEFAULT_FOR_REPLENISHMENT", $arrval, $conf->global->STOCK_USE_REAL_STOCK_BY_DEFAULT_FOR_REPLENISHMENT); } print "
'.$prod->getNomUrl(1, 'stock').''.$prod->getNomUrl(1, 'stock').''.$objp->label; - print ''; // TODO Remove this and make a fetch to get description when creating order instead of a GETPOST - print ''.$objp->label; + print ''; // TODO Remove this and make a fetch to get description when creating order instead of a GETPOST + print ''.$duration.''.($fk_entrepot > 0 ? $desiredstockwarehouse : $desiredstock).''.($fk_entrepot > 0 ? $alertstockwarehouse : $alertstock).''.$warning.$stock.''.$warningwarehouse.$stockwarehouse.''.$ordered.' '.$picto.''; - print $form->select_product_fourn_price($prod->id, 'fourn'.$i, $fk_supplier); - print '
'.$duration.''.($fk_entrepot > 0 ? $desiredstockwarehouse : $desiredstock).''.($fk_entrepot > 0 ? $alertstockwarehouse : $alertstock).''.$warning.$stock.''.$warningwarehouse.$stockwarehouse.''.$ordered.' '.$picto.''; + print $form->select_product_fourn_price($prod->id, 'fourn'.$i, $fk_supplier); + print '
'; } + $texte .= ''; } + // Add input to upload a new template file. + $texte .= '
'.$langs->trans("UploadNewTemplate").' '; + $texte .= ''; + $texte .= ''; + $texte .= '
'; $texte .= ''; From 3c5ef18b36999383380273687b47a8bdceef8718 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Nov 2020 00:47:28 +0100 Subject: [PATCH 069/124] FIX #15390 --- htdocs/compta/sociales/class/cchargesociales.class.php | 10 ++++++++-- htdocs/core/class/commonobject.class.php | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/sociales/class/cchargesociales.class.php b/htdocs/compta/sociales/class/cchargesociales.class.php index ab61446c62e..ceace76bba9 100644 --- a/htdocs/compta/sociales/class/cchargesociales.class.php +++ b/htdocs/compta/sociales/class/cchargesociales.class.php @@ -44,7 +44,11 @@ class Cchargesociales */ public $table_element = 'c_chargesociales'; + /** + * @var string Label + */ public $libelle; + public $deductible; public $active; public $code; @@ -54,6 +58,9 @@ class Cchargesociales */ public $fk_pays; + /** + * @var string module + */ public $module; public $accountancy_code; @@ -504,13 +511,12 @@ class Cchargesociales /** * Trim object parameters - * @param string[] $parameters array of parameters to trim * + * @param string[] $parameters array of parameters to trim * @return void */ private function trimParameters($parameters) { - if (!is_array($parameters)) return; foreach ($parameters as $parameter) { if (isset($this->$parameter)) { $this->$parameter = trim($this->$parameter); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 221c69b659a..b2349fa5984 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8373,8 +8373,8 @@ abstract class CommonObject /** * Trim object parameters - * @param string[] $parameters array of parameters to trim * + * @param string[] $parameters array of parameters to trim * @return void */ public function trimParameters($parameters) From 4ca3c0aa957ae25006d3f1b504eb0a2b51cd85e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 14 Nov 2020 00:48:13 +0100 Subject: [PATCH 070/124] Add odt for members --- htdocs/adherents/admin/adherent.php | 189 +++++++- htdocs/core/actions_setmoduleoptions.inc.php | 2 +- .../core/class/commondocgenerator.class.php | 51 ++- htdocs/core/class/commonobject.class.php | 12 +- .../doc/doc_generic_member_odt.class.php | 427 ++++++++++++++++++ .../modules/member/modules_member.class.php | 66 +++ htdocs/core/modules/modAdherent.class.php | 12 +- htdocs/core/modules/user/doc/index.html | 0 8 files changed, 746 insertions(+), 13 deletions(-) create mode 100644 htdocs/core/modules/member/doc/doc_generic_member_odt.class.php create mode 100644 htdocs/core/modules/member/modules_member.class.php create mode 100644 htdocs/core/modules/user/doc/index.html diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index 51577218eb9..8acf1f1b191 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -7,7 +7,8 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent * Copyright (C) 2012 J. Fernando Lagrange - * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2020 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,7 +40,12 @@ $langs->loadLangs(array("admin", "members")); if (!$user->admin) accessforbidden(); -$type = array('yesno', 'texte', 'chaine'); +$choices = array('yesno', 'texte', 'chaine'); + +$value = GETPOST('value', 'alpha'); +$label = GETPOST('label', 'alpha'); +$scandir = GETPOST('scandir', 'alpha'); +$type = 'member'; $action = GETPOST('action', 'aZ09'); @@ -48,8 +54,50 @@ $action = GETPOST('action', 'aZ09'); * Actions */ -// -if ($action == 'updateall') { +include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; + +if ($action == 'set_default') { + $ret = addDocumentModel($value, $type, $label, $scandir); + $res = true; +} elseif ($action == 'del_default') { + $ret = delDocumentModel($value, $type); + if ($ret > 0) { + if ($conf->global->MEMBER_ADDON_PDF_ODT == "$value") { + dolibarr_del_const($db, 'MEMBER_ADDON_PDF_ODT', $conf->entity); + } + } + $res = true; +} elseif ($action == 'setdoc') { + // Set default model + if (dolibarr_set_const($db, "MEMBER_ADDON_PDF_ODT", $value, 'chaine', 0, '', $conf->entity)) { + // La constante qui a ete lue en avant du nouveau set + // on passe donc par une variable pour avoir un affichage coherent + $conf->global->MEMBER_ADDON_PDF_ODT = $value; + } + + // On active le modele + $ret = delDocumentModel($value, $type); + if ($ret > 0) { + $ret = addDocumentModel($value, $type, $label, $scandir); + } + $res = true; +} elseif (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) { + $code = $reg[1]; + if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) { + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } else { + dol_print_error($db); + } +} elseif (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) { + $code = $reg[1]; + if (dolibarr_del_const($db, $code, $conf->entity) > 0) { + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } else { + dol_print_error($db); + } +} elseif ($action == 'updateall') { $db->begin(); $res1 = $res2 = $res3 = $res4 = $res5 = $res6 = 0; $res1 = dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha') ? 0 : 1, 'chaine', 0, '', $conf->entity); @@ -86,7 +134,7 @@ if ($action == 'update' || $action == 'add') { $consttype = GETPOST('consttype', 'alpha'); $constnote = GETPOST('constnote'); - $res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity); + $res = dolibarr_set_const($db, $constname, $constvalue, $choices[$consttype], 0, $constnote, $conf->entity); if (!$res > 0) $error++; @@ -245,6 +293,137 @@ $helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL_ $helptext .= '__YEAR__, __MONTH__, __DAY__'; form_constantes($constantes, 0, $helptext); +$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); + +// Defini tableau def des modeles +$def = array(); +$sql = "SELECT nom"; +$sql .= " FROM ".MAIN_DB_PREFIX."document_model"; +$sql .= " WHERE type = '".$db->escape($type)."'"; +$sql .= " AND entity = ".$conf->entity; +$resql = $db->query($sql); +if ($resql) { + $i = 0; + $num_rows = $db->num_rows($resql); + while ($i < $num_rows) { + $array = $db->fetch_array($resql); + array_push($def, $array[0]); + $i++; + } +} else { + dol_print_error($db); +} + +print load_fiche_titre($langs->trans("MembersDocModules"), '', ''); + +print ''; +print ''; +print ''; +print ''; +print '\n"; +print '\n"; +print ''; +print ''; +print "\n"; + +clearstatcache(); + +foreach ($dirmodels as $reldir) { + foreach (array('', '/doc') as $valdir) { + $dir = dol_buildpath($reldir."core/modules/member".$valdir); + if (is_dir($dir)) { + $handle = opendir($dir); + if (is_resource($handle)) { + while (($file = readdir($handle)) !== false) { + $filelist[] = $file; + } + closedir($handle); + arsort($filelist); + foreach ($filelist as $file) { + if (preg_match('/\.class\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { + if (file_exists($dir.'/'.$file)) { + $name = substr($file, 4, dol_strlen($file) - 14); + $classname = substr($file, 0, dol_strlen($file) - 10); + + 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; + } + + if ($modulequalified) { + print ''; + + // Active + if (in_array($name, $def)) { + print ''; + } else { + print '"; + } + + // Defaut + print ''; + + // Info + $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("FeaturesSupported").':'; + $htmltooltip .= '
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); + $htmltooltip .= '
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); + + + print ''; + + // Preview + print ''; + + print "\n"; + } + } + } + } + } + } + } +} + +print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
'; + print (empty($module->name) ? $name : $module->name); + print "\n"; + if (method_exists($module, 'info')) { + print $module->info($langs); + } else { + print $module->description; + } + print ''."\n"; + print ''; + print img_picto($langs->trans("Enabled"), 'switch_on'); + print ''; + print ''."\n"; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print "'; + if ($conf->global->MEMBER_ADDON_PDF == $name) { + print img_picto($langs->trans("Default"), 'on'); + } else { + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + } + print ''; + print $form->textwithpicto('', $htmltooltip, 1, 0); + print ''; + if ($module->type == 'pdf') + { + print ''.img_object($langs->trans("Preview"), 'contract').''; + } else { + print img_object($langs->trans("PreviewNotAvailable"), 'generic'); + } + print '
'; +print "
"; print dol_get_fiche_end(); diff --git a/htdocs/core/actions_setmoduleoptions.inc.php b/htdocs/core/actions_setmoduleoptions.inc.php index 1cc9a55deb2..24220f79f8c 100644 --- a/htdocs/core/actions_setmoduleoptions.inc.php +++ b/htdocs/core/actions_setmoduleoptions.inc.php @@ -100,7 +100,7 @@ if ($action == 'setModuleOptions') } if ($upload_dir) { - $result = dol_add_file_process($upload_dir, 0, 1, 'uploadfile', ''); + $result = dol_add_file_process($upload_dir, 1, 1, 'uploadfile', ''); if ($result <= 0) $error++; } } diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 6015bbceece..f3b1e7afc81 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -77,11 +77,11 @@ abstract class CommonDocGenerator public function get_substitutionarray_user($user, $outputlangs) { // phpcs:enable - global $conf; + global $conf, $extrafields; $logotouse = $conf->user->dir_output.'/'.get_exdir($user->id, 2, 0, 1, $user, 'user').'/'.$user->photo; - return array( + $array_user = array( 'myuser_lastname'=>$user->lastname, 'myuser_firstname'=>$user->firstname, 'myuser_fullname'=>$user->getFullName($outputlangs, 1), @@ -101,6 +101,53 @@ abstract class CommonDocGenerator 'myuser_job'=>$user->job, 'myuser_web'=>'' // url not exist in $user object ); + // Retrieve extrafields + if (is_array($user->array_options) && count($user->array_options)) { + $array_user = $this->fill_substitutionarray_with_extrafields($user, $array_user, $extrafields, 'myuser', $outputlangs); + } + return $array_user; + } + + + /** + * Define array with couple substitution key => substitution value + * + * @param Adherent $member Member + * @param Translate $outputlangs Language object for output + * @return array Array of substitution key->code + */ + public function getSubstitutionarrayMember($member, $outputlangs) + { + global $conf, $extrafields; + + $logotouse = $conf->adherent->dir_output.'/'.get_exdir($member->id, 2, 0, 1, $member, 'user').'/'.$member->photo; + + $array_member = array( + 'mymember_lastname' => $member->lastname, + 'mymember_firstname' => $member->firstname, + 'mymember_fullname' => $member->getFullName($outputlangs, 1), + 'mymember_login' => $member->login, + 'mymember_address' => $member->address, + 'mymember_zip' => $member->zip, + 'mymember_town' => $member->town, + 'mymember_country_code' => $member->country_code, + 'mymember_country' => $member->country, + 'mymember_state_code' => $member->state_code, + 'mymember_state' => $member->state, + 'mymember_phone_perso' => $member->phone_perso, + 'mymember_phone_pro' => $member->phone, + 'mymember_phone_mobile' => $member->phone_mobile, + 'mymember_email' => $member->email, + 'mymember_logo' => $logotouse, + 'mymember_gender' => $member->gender, + 'mymember_birth_locale' => dol_print_date($member->birth, 'day', 'tzuser', $outputlangs), + 'mymember_birth' => dol_print_date($member->birth, 'day', 'tzuser'), + ); + // Retrieve extrafields + if (is_array($member->array_options) && count($member->array_options)) { + $array_member = $this->fill_substitutionarray_with_extrafields($member, $array_member, $extrafields, 'mymember', $outputlangs); + } + return $array_member; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 221c69b659a..c673896e627 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4570,13 +4570,17 @@ abstract class CommonObject { foreach (array('doc', 'pdf') as $prefix) { - if (in_array(get_class($this), array('Adherent'))) $file = $prefix."_".$modele.".class.php"; // Member module use prefix_module.class.php - else $file = $prefix."_".$modele.".modules.php"; + if (in_array(get_class($this), array('Adherent'))) { + // Member module use prefix_modele.class.php + $file = $prefix."_".$modele.".class.php"; + } else { + // Other module use prefix_modele.modules.php + $file = $prefix."_".$modele.".modules.php"; + } // On verifie l'emplacement du modele $file = dol_buildpath($reldir.$modelspath.$file, 0); - if (file_exists($file)) - { + if (file_exists($file)) { $filefound = $file; $classname = $prefix.'_'.$modele; break; diff --git a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php new file mode 100644 index 00000000000..cfa8c75ec11 --- /dev/null +++ b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php @@ -0,0 +1,427 @@ + + * Copyright (C) 2012 Juanjo Menent + * 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 +* 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 . +* or see https://www.gnu.org/ +*/ + +/** + * \file htdocs/core/modules/member/doc/doc_generic_member_odt.modules.php + * \ingroup societe + * \brief File of class to build ODT documents for members + */ + +require_once DOL_DOCUMENT_ROOT.'/core/modules/member/modules_member.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php'; + + +/** + * Class to build documents using ODF templates generator + */ +class doc_generic_member_odt extends ModelePDFMember +{ + /** + * @var Societe Issuer + */ + public $emetteur; + + /** + * @var array Minimum version of PHP required by module. + * e.g.: PHP ≥ 5.6 = array(5, 6) + */ + public $phpmin = array(5, 6); + + /** + * Dolibarr version of the loaded document + * @var string + */ + public $version = 'dolibarr'; + + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + global $conf, $langs, $mysoc; + + // Load translation files required by the page + $langs->loadLangs(array("main", "companies")); + + $this->db = $db; + $this->name = "ODT templates"; + $this->description = $langs->trans("DocumentModelOdt"); + $this->scandir = 'MEMBER_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan + + // Page size for A4 format + $this->type = 'odt'; + $this->page_largeur = 0; + $this->page_hauteur = 0; + $this->format = array($this->page_largeur, $this->page_hauteur); + $this->marge_gauche = 0; + $this->marge_droite = 0; + $this->marge_haute = 0; + $this->marge_basse = 0; + + $this->option_logo = 1; // Affiche logo + $this->option_tva = 0; // Gere option tva MEMBER_TVAOPTION + $this->option_modereg = 0; // Affiche mode reglement + $this->option_condreg = 0; // Affiche conditions reglement + $this->option_codeproduitservice = 0; // 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 = 0; // Support add of a watermark on drafts + + // Recupere emetteur + $this->emetteur = $mysoc; + if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined + } + + + /** + * Return description of a module + * + * @param Translate $langs Lang object to use for output + * @return string Description + */ + public function info($langs) + { + global $conf, $langs; + + // Load translation files required by the page + $langs->loadLangs(array('companies', 'errors')); + + $form = new Form($this->db); + + $texte = $this->description.".
\n"; + $texte .= ''; + $texte .= ''; + $texte .= ''; + $texte .= ''; + $texte .= ''; + + // List of directories area + $texte .= ''; + + $texte .= ''; + $texte .= ''; + + $texte .= '
'; + $texttitle = $langs->trans("ListOfDirectories"); + $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->MEMBER_ADDON_PDF_ODT_PATH))); + $listoffiles = array(); + foreach ($listofdir as $key=>$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); + else { + $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)'); + if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles); + } + } + $texthelp = $langs->trans("ListOfDirectoriesForModelGenODT"); + // Add list of substitution keys + $texthelp .= '
'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'
'; + $texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it + + $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); + $texte .= '
'; + $texte .= ''; + $texte .= '
'; + $texte .= ''; + $texte .= '
'; + + // Scan directories + if (count($listofdir)) + { + $texte .= $langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; + $texte .= ''; + } + // Add input to upload a new template file. + $texte .= '
'.$langs->trans("UploadNewTemplate").' '; + $texte .= ''; + $texte .= ''; + $texte .= '
'; + $texte .= '
'; + $texte .= $langs->trans("ExampleOfDirectoriesForModelGen"); + $texte .= '
'; + $texte .= ''; + + return $texte; + } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build a document on disk using the generic odt module. + * + * @param Adherent $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param string $mode Tell if doc module is called for 'member', ... + * @param int $nooutput 1=Generate only file on disk and do not return it on response + * @return int 1 if OK, <=0 if KO + */ + public function write_file($object, $outputlangs, $srctemplatepath, $mode = 'member', $nooutput = 0) + { + // phpcs:enable + global $user, $langs, $conf, $mysoc, $hookmanager; + + if (empty($srctemplatepath)) { + dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING); + return -1; + } + + // Add odtgeneration hook + if (!is_object($hookmanager)) + { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($this->db); + } + $hookmanager->initHooks(array('odtgeneration')); + global $action; + + if (!is_object($outputlangs)) $outputlangs = $langs; + $sav_charset_output = $outputlangs->charset_output; + $outputlangs->charset_output = 'UTF-8'; + + // Load translation files required by the page + $outputlangs->loadLangs(array("main", "companies", "bills", "dict")); + + if ($conf->adherent->dir_output) { + // If $object is id instead of object + if (!is_object($object)) { + $id = $object; + $object = new User($this->db); + $result = $object->fetch($id); + if ($result < 0) { + dol_print_error($this->db, $object->error); + return -1; + } + } + + $object->fetch_thirdparty(); + + $dir = $conf->adherent->dir_output; + $objectref = dol_sanitizeFileName($object->ref); + if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; + $file = $dir."/".$objectref.".odt"; + + if (!file_exists($dir)) { + if (dol_mkdir($dir) < 0) { + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); + return -1; + } + } + + if (file_exists($dir)) { + //print "srctemplatepath=".$srctemplatepath; // Src filename + $newfile = basename($srctemplatepath); + $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile); + $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); + $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); + + $newfiletmp = $objectref.'_'.$newfiletmp; + + // Get extension (ods or odt) + $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); + if (!empty($conf->global->MAIN_DOC_USE_TIMING)) { + $format = $conf->global->MAIN_DOC_USE_TIMING; + if ($format == '1') $format = '%Y%m%d%H%M%S'; + $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; + } else { + $filename = $newfiletmp.'.'.$newfileformat; + } + $file = $dir.'/'.$filename; + //print "newdir=".$dir; + //print "newfile=".$newfile; + //print "file=".$file; + //print "conf->adherent->dir_temp=".$conf->adherent->dir_temp; + + dol_mkdir($conf->adherent->dir_temp); + + + // If CUSTOMER contact defined on member, we use it + $usecontact = false; + $arrayidcontact = $object->getIdContact('external', 'CUSTOMER'); + if (count($arrayidcontact) > 0) { + $usecontact = true; + $result = $object->fetch_contact($arrayidcontact[0]); + } + + // Recipient name + if (!empty($usecontact)) { + // On peut utiliser le nom de la societe du contact + if (!empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { + $socobject = $object->contact; + } else { + $socobject = $object->thirdparty; + // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use + $contactobject = $object->contact; + } + } else { + $socobject = $object->thirdparty; + } + + // Open and load template + require_once ODTPHP_PATH.'odf.php'; + try { + $odfHandler = new odf( + $srctemplatepath, + array( + 'PATH_TO_TMP' => $conf->adherent->dir_temp, + 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' + ) + ); + } catch (Exception $e) + { + $this->error = $e->getMessage(); + dol_syslog($e->getMessage(), LOG_WARNING); + return -1; + } + + // Make substitutions into odt + $array_member = $this->getSubstitutionarrayMember($object, $outputlangs); + $array_soc = $this->get_substitutionarray_mysoc($mysoc, $outputlangs); + $array_thirdparty = $this->get_substitutionarray_thirdparty($socobject, $outputlangs); + $array_other = $this->get_substitutionarray_other($outputlangs); + // retrieve contact information for use in object as contact_xxx tags + $array_thirdparty_contact = array(); + if ($usecontact && is_object($contactobject)) $array_thirdparty_contact = $this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact'); + + $tmparray = array_merge($array_member, $array_soc, $array_thirdparty, $array_other, $array_thirdparty_contact); + complete_substitutions_array($tmparray, $outputlangs, $object); + $tags = ''; + foreach ($tmparray as $key => $value) { + $tags .= '{' . $key . '} => ' . $value ."\n"; + } + $tmparray = array_merge($tmparray, array('__ALL_TAGS__' => $tags)); + // Call the ODTSubstitution hook + $parameters = array( + 'file'=>$file, + 'object'=>$object, + 'outputlangs'=>$outputlangs, + 'substitutionarray'=>&$tmparray + ); + $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + foreach ($tmparray as $key=>$value) { + try { + if (preg_match('/logo$/', $key)) { + // Image + if (file_exists($value)) $odfHandler->setImage($key, $value); + else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); + } else { + // Text + $odfHandler->setVars($key, $value, true, 'UTF-8'); + } + } catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_WARNING); + } + } + + // Replace labels translated + $tmparray = $outputlangs->get_translations_for_substitutions(); + foreach ($tmparray as $key=>$value) + { + try { + $odfHandler->setVars($key, $value, true, 'UTF-8'); + } catch (OdfException $e) + { + dol_syslog($e->getMessage(), LOG_WARNING); + } + } + + // Call the beforeODTSave hook + $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); + $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + + // Write new file + if (!empty($conf->global->MAIN_ODT_AS_PDF)) { + try { + $odfHandler->exportAsAttachedPDF($file); + } catch (Exception $e) { + $this->error = $e->getMessage(); + dol_syslog($e->getMessage(), LOG_WARNING); + return -1; + } + } else { + try { + $odfHandler->saveToDisk($file); + } catch (Exception $e) { + $this->error = $e->getMessage(); + dol_syslog($e->getMessage(), LOG_WARNING); + return -1; + } + } + + $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + + if (!empty($conf->global->MAIN_UMASK)) + @chmod($file, octdec($conf->global->MAIN_UMASK)); + + $odfHandler = null; // Destroy object + + $this->result = array('fullpath'=>$file); + + return 1; // Success + } else { + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); + return -1; + } + } + + return -1; + } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * get substitution array for object + * + * @param Adherent $object member + * @param Translate $outputlangs translation object + * @param string $array_key key for array + * @return array array of substitutions + */ + public function get_substitutionarray_object($object, $outputlangs, $array_key = 'object') + { + // phpcs:enable + $array_other = array(); + foreach ($object as $key => $value) { + if (!is_array($value) && !is_object($value)) { + $array_other[$array_key.'_'.$key] = $value; + } + } + return $array_other; + } +} diff --git a/htdocs/core/modules/member/modules_member.class.php b/htdocs/core/modules/member/modules_member.class.php new file mode 100644 index 00000000000..2166fd9ccb7 --- /dev/null +++ b/htdocs/core/modules/member/modules_member.class.php @@ -0,0 +1,66 @@ + + * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005-2012 Regis Houssin + * + * 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 . + * or see https://www.gnu.org/ + */ + + +/** + * \class ModeleProductCode + * \brief Parent class for product code generators + */ + +/** + * \file htdocs/core/modules/member/modules_member.php + * \ingroup members + * \brief File with parent class for generating members to PDF + */ + + require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; + +/** + * Parent class to manage intervention document templates + */ +abstract class ModelePDFMember extends CommonDocGenerator +{ + /** + * @var string Error code (or message) + */ + public $error = ''; + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Return list of active generation modules + * + * @param DoliDB $db Database handler + * @param integer $maxfilenamelength Max length of value to show + * @return array List of templates + */ + public static function liste_modeles($db, $maxfilenamelength = 0) + { + // phpcs:enable + + $type = 'member'; + $list = array(); + + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $list = getListOfModels($db, $type, $maxfilenamelength); + return $list; + } +} diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index d9a4f72465d..1db3e2b7d50 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -60,7 +60,10 @@ class modAdherent extends DolibarrModules $this->picto = 'member'; // Data directories to create when module is enabled - $this->dirs = array("/adherent/temp"); + $this->dirs = array( + "/adherent/temp", + "/doctemplates/members", + ); // Config pages $this->config_page_url = array("adherent.php@adherents"); @@ -178,6 +181,13 @@ class modAdherent extends DolibarrModules $this->const[$r][4] = 0; $r++; + $this->const[$r][0] = "MEMBER_ADDON_PDF_ODT_PATH"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/members"; + $this->const[$r][3] = ""; + $this->const[$r][4] = 0; + $r++; + // Boxes //------- diff --git a/htdocs/core/modules/user/doc/index.html b/htdocs/core/modules/user/doc/index.html new file mode 100644 index 00000000000..e69de29bb2d From 34beb995f23b1103c34f789e67b35e592ec408c1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Nov 2020 00:51:01 +0100 Subject: [PATCH 071/124] Update card.php --- htdocs/opensurvey/card.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index 92d0f7a3eb5..393914f95ba 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -111,13 +111,13 @@ if (empty($reshook)) if (!$error) { - $object->title = (string) GETPOST('nouveautitre', 'nohtml'); + $object->title = (string) GETPOST('nouveautitre', 'alphanohtml'); $object->description = (string) GETPOST('nouveauxcommentaires', 'restricthtml'); $object->mail_admin = (string) GETPOST('nouvelleadresse', 'alpha'); $object->date_fin = $expiredate; - $object->allow_comments = GETPOST('cancomment', 'alpha') == 'on' ? 1 : 0; - $object->allow_spy = GETPOST('canseeothersvote', 'alpha') == 'on' ? 1 : 0; - $object->mailsonde = GETPOST('mailsonde', 'alpha') == 'on' ? true : false; + $object->allow_comments = GETPOST('cancomment', 'aZ09') == 'on' ? 1 : 0; + $object->allow_spy = GETPOST('canseeothersvote', 'aZ09') == 'on' ? 1 : 0; + $object->mailsonde = GETPOST('mailsonde', 'aZ09') == 'on' ? true : false; $res = $object->update($user); if ($res < 0) { From fd50f27d5d70f6d6036ca403e306d2c3198f6bb3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Nov 2020 00:52:13 +0100 Subject: [PATCH 072/124] Removed temporary warning --- scripts/emailings/reset-invalid-emails.php | 42 +++++++++++----------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/scripts/emailings/reset-invalid-emails.php b/scripts/emailings/reset-invalid-emails.php index de6b180e208..12f279ef0d0 100755 --- a/scripts/emailings/reset-invalid-emails.php +++ b/scripts/emailings/reset-invalid-emails.php @@ -73,30 +73,30 @@ $db->begin(); $groupofemails = array(); - // For each groupofemail, we update tables to set email field to empty - if ($type == 'all' || $type == 'thirdparty') - { - // Loop on each record and update the email to null if email into $groupofemails - // TODO - } +// For each groupofemail, we update tables to set email field to empty +if ($type == 'all' || $type == 'thirdparty') +{ + // Loop on each record and update the email to null if email into $groupofemails + // TODO +} - if ($type == 'all' || $type == 'contact') - { - // Loop on each record and update the email to null if email into $groupofemails - // TODO - } +if ($type == 'all' || $type == 'contact') +{ + // Loop on each record and update the email to null if email into $groupofemails + // TODO +} - if ($type == 'all' || $type == 'user') - { - // Loop on each record and update the email to null if email into $groupofemails - // TODO - } +if ($type == 'all' || $type == 'user') +{ + // Loop on each record and update the email to null if email into $groupofemails + // TODO +} - if ($type == 'all' || $type == 'member') - { - // Loop on each record and update the email to null if email into $groupofemails - // TODO - } +if ($type == 'all' || $type == 'member') +{ + // Loop on each record and update the email to null if email into $groupofemails + // TODO +} if (!$error) { From 0c37d31e040e94f46c120a6467857ae21a0a4bee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20MARTIN?= <52456749+BlueGarm@users.noreply.github.com> Date: Sat, 14 Nov 2020 13:01:36 +0100 Subject: [PATCH 073/124] Update box_supplier_orders_awaiting_reception.php --- htdocs/core/boxes/box_supplier_orders_awaiting_reception.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php index 86a2b7b3086..6c3b906cb0f 100644 --- a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php +++ b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php @@ -96,7 +96,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE c.fk_soc = s.rowid"; $sql .= " AND c.entity IN (".getEntity('supplier_order').")"; - $sql .= " AND c.fk_statut = ".CommandeFournisseur::STATUS_ORDERSENT; + $sql .= " AND c.fk_statut IN (".CommandeFournisseur::STATUS_ORDERSENT.", ".CommandeFournisseur::STATUS_RECEIVED_PARTIALLY.")"; 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; if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC "; From 2425cf82d3522771313b16ca3759c0ac1288b040 Mon Sep 17 00:00:00 2001 From: BlueGarm Date: Sat, 14 Nov 2020 13:25:02 +0100 Subject: [PATCH 074/124] Add Partially Received Order and Delay Edit file to allow following order received partially and to upgrade lisibility of delayed orders --- htdocs/fourn/class/fournisseur.commande.class.php | 8 ++++---- htdocs/fourn/commande/card.php | 6 +++--- htdocs/fourn/commande/list.php | 7 +++++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 2b90af268c5..21399b7d674 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2987,7 +2987,7 @@ class CommandeFournisseur extends CommonOrder } $sql .= $clause." c.entity = ".$conf->entity; if ($mode === 'awaiting') { - $sql .= " AND c.fk_statut = ".self::STATUS_ORDERSENT; + $sql .= " AND c.fk_statut IN (".self::STATUS_ORDERSENT.", ".self::STATUS_RECEIVED_PARTIALLY.")"; } else { $sql .= " AND c.fk_statut IN (".self::STATUS_VALIDATED.", ".self::STATUS_ACCEPTED.")"; @@ -3009,7 +3009,7 @@ class CommandeFournisseur extends CommonOrder 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'; + $response->url = DOL_URL_ROOT.'/fourn/commande/list.php?statut=3,4&mainmenu=commercial&leftmenu=orders_suppliers'; } while ($obj = $this->db->fetch_object($resql)) @@ -3175,9 +3175,9 @@ class CommandeFournisseur extends CommonOrder if (empty($this->date_delivery) && !empty($this->date_livraison)) $this->date_delivery = $this->date_livraison; // For backward compatibility $now = dol_now(); - $date_to_test = empty($this->date_delivery) ? $this->date_commande : $this->date_delivery; + $date_to_test = empty($this->date_livraison) ? $this->date_commande : $this->date_livraison; - return ($this->statut > 0 && $this->statut < 4) && $date_to_test && $date_to_test < ($now - $conf->commande->fournisseur->warning_delay); + return ($this->statut > 0 && $this->statut < 5) && $date_to_test && $date_to_test < ($now - $conf->commande->fournisseur->warning_delay); } /** diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 3fb7ae18cbc..846113176c1 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2065,9 +2065,9 @@ elseif (!empty($object->id)) if ($object->methode_commande_id > 0) { print ''.$langs->trans("Date").''; - if ($object->date_commande) - { - print dol_print_date($object->date_commande, "dayhour")."\n"; + print $object->date_commande ? dol_print_date($object->date_commande, $usehourmin) : ' '; + if ($object->hasDelay() && empty($object->date_livraison) && !empty($object->date_commande)) { + print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } print ""; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 417e78023a8..c21e7ee4999 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1001,6 +1001,7 @@ if ($resql) $objectstatic->total_ht = $obj->total_ht; $objectstatic->total_tva = $obj->total_tva; $objectstatic->total_ttc = $obj->total_ttc; + $objectstatic->date_commande = $db->jdate($obj->date_commande); $objectstatic->date_delivery = $db->jdate($obj->date_delivery); $objectstatic->note_public = $obj->note_public; $objectstatic->note_private = $obj->note_private; @@ -1110,8 +1111,10 @@ if ($resql) if (!empty($arrayfields['cf.date_commande']['checked'])) { print ''; - if ($obj->date_commande) print dol_print_date($db->jdate($obj->date_commande), 'day'); - else print ''; + print dol_print_date($db->jdate($obj->date_commande), 'day'); + if ($objectstatic->hasDelay() && empty($objectstatic->date_delivery)) { + print ' '.img_picto($langs->trans("Late").' : '.$objectstatic->showDelay(), "warning"); + } print ''; if (!$i) $totalarray['nbfield']++; } From f209059d82b2c224850bf8f3d0dea5e371f35e42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 14 Nov 2020 16:45:52 +0100 Subject: [PATCH 075/124] Update .travis.yml --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0aa5594790a..4d6ddce37f7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -110,7 +110,8 @@ install: rm $TRAVIS_BUILD_DIR/composer.lock composer self-update # To have composer making parallel downloads - composer global require hirak/prestissimo + # This plugin is for Composer1; Composer2 is very fast on its own. Uninstall this plugin and update the Composer itself. + # composer global require hirak/prestissimo composer -n init composer -n config vendor-dir htdocs/includes echo From 5c72ee47a22507561964295a2cf62c1a886fd304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 14 Nov 2020 17:04:52 +0100 Subject: [PATCH 076/124] doxygen --- htdocs/opensurvey/class/opensurveysondage.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 595270b78ad..83d10d64e07 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -66,7 +66,7 @@ class Opensurveysondage extends CommonObject public $mail_admin; /** - * @var admin name + * @var string admin name */ public $nom_admin; @@ -514,15 +514,15 @@ class Opensurveysondage extends CommonObject { $this->id = 0; - $this->id_sondage = ''; + $this->id_sondage = 'a12d5g'; $this->description = 'Description of the specimen survey'; - $this->mail_admin = ''; - $this->nom_admin = ''; + $this->mail_admin = 'email@email.com'; + $this->nom_admin = 'surveyadmin'; $this->title = 'This is a specimen survey'; $this->date_fin = dol_now() + 3600 * 24 * 10; $this->status = 1; $this->format = 'classic'; - $this->mailsonde = ''; + $this->mailsonde = 0; } /** From f8beca56b8b8aa7b427324fe6e5455e946105df3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 14 Nov 2020 17:08:24 +0100 Subject: [PATCH 077/124] Update card.php --- htdocs/opensurvey/card.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index 393914f95ba..15c52a52539 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -117,7 +117,7 @@ if (empty($reshook)) $object->date_fin = $expiredate; $object->allow_comments = GETPOST('cancomment', 'aZ09') == 'on' ? 1 : 0; $object->allow_spy = GETPOST('canseeothersvote', 'aZ09') == 'on' ? 1 : 0; - $object->mailsonde = GETPOST('mailsonde', 'aZ09') == 'on' ? true : false; + $object->mailsonde = GETPOST('mailsonde', 'aZ09') == 'on' ? 1 : 0; $res = $object->update($user); if ($res < 0) { @@ -132,21 +132,18 @@ if (empty($reshook)) { $error = 0; - if (!GETPOST('comment')) - { + if (!GETPOST('comment')) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Comment")), null, 'errors'); } - if (!GETPOST('commentuser')) - { + if (!GETPOST('commentuser')) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("User")), null, 'errors'); } - if (!$error) - { - $comment = GETPOST("comment"); - $comment_user = GETPOST('commentuser'); + if (!$error) { + $comment = (string) GETPOST("comment", "restricthtml"); + $comment_user = (string) GETPOST('commentuser', "restricthtml"); $resql = $object->addComment($comment, $comment_user); From b3e03c699144385f452773d56f0774e4eaa9ffe4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Nov 2020 18:11:46 +0100 Subject: [PATCH 078/124] Fix css for public pages --- htdocs/core/lib/ticket.lib.php | 2 +- htdocs/opensurvey/fonctions.php | 2 +- htdocs/public/members/new.php | 2 +- htdocs/public/onlinesign/newonlinesign.php | 2 +- htdocs/public/payment/newpayment.php | 2 +- htdocs/public/payment/paymentko.php | 2 +- htdocs/public/payment/paymentok.php | 2 +- htdocs/public/recruitment/view.php | 4 ++-- htdocs/theme/eldy/global.inc.php | 22 +++++++++++++++++++++- 9 files changed, 30 insertions(+), 10 deletions(-) diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index ee2dc1cd095..dc7766dbdfa 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -239,7 +239,7 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $ } print ''; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { - print '
'; + print ''; } print ''; } diff --git a/htdocs/opensurvey/fonctions.php b/htdocs/opensurvey/fonctions.php index 208646c0a23..0ea701ebf0b 100644 --- a/htdocs/opensurvey/fonctions.php +++ b/htdocs/opensurvey/fonctions.php @@ -115,7 +115,7 @@ function llxHeaderSurvey($title, $head = "", $disablejs = 0, $disablehead = 0, $ print '>'; print ''; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { - print ''; + print ''; } print ''; } diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 8ada0a9b291..517e201d20f 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -123,7 +123,7 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ print '>'; print ''; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { - print ''; + print ''; } print ''; } diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index b71f5a84cd0..56690f78a42 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -185,7 +185,7 @@ if ($urllogo) print '>'; print ''; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { - print ''; + print ''; } print ''; } diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 03dbf71051b..d90f8684673 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -788,7 +788,7 @@ if ($urllogo) print '>'; print ''; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { - print ''; + print ''; } print ''; } diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index e2d28044de5..ac92c958931 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -238,7 +238,7 @@ if ($urllogo) print '>'; print ''; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { - print ''; + print ''; } print ''; } diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 98907ee9d02..5a49cec5bbe 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -178,7 +178,7 @@ if ($urllogo) print '>'; print ''; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { - print ''; + print ''; } print ''; } diff --git a/htdocs/public/recruitment/view.php b/htdocs/public/recruitment/view.php index a76b49d1394..d8b2a4280cf 100644 --- a/htdocs/public/recruitment/view.php +++ b/htdocs/public/recruitment/view.php @@ -211,7 +211,7 @@ if ($urllogo) print '>'; print ''; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { - print ''; + print ''; } print ''; } @@ -278,7 +278,7 @@ if (empty($emailforcontact)) { $emailforcontact = $mysoc->email; } } -print ''; +print ''; print $tmpuser->getFullName(-1); print ' - '.dol_print_email($emailforcontact, 0, 0, 1, 0, 0, 1); print ''; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 39855b866cb..a786dc1ff1d 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -317,6 +317,7 @@ input.buttonpaymentstripe { } .logopublicpayment #dolpaymentlogo { max-height: 100px; + max-width: 320px; } a.buttonticket { @@ -1311,6 +1312,25 @@ select.widthcentpercentminusxx, input.widthcentpercentminusxx { width: calc(100% - 40px) !important; display: inline-block; } + + .logopublicpayment #dolpaymentlogo { + max-width: 260px; + } + #tablepublicpayment { + width: auto !important; + } + .poweredbypublicpayment { + float: unset !important; + top: unset !important; + bottom: 8px; + position: relative !important; + } + .poweredbyimg { + width: 48px; + } + input.buttonpayment, button.buttonpayment, div.buttonpayment { + min-width: 270px; + } } /* Force values for small screen 570 */ @@ -4156,7 +4176,7 @@ div.backgreypublicpayment { background-color: #f0f0f0; padding: 20px; border-bot color: #222; opacity: 0.3; } -#dolpaymenttable { min-width: 320px; font-size: 16px; } /* Width must have min to make stripe input area visible. Lower than 320 makes input area crazy for credit card that need zip code */ +#dolpaymenttable { min-width: 290px; font-size: 16px; } /* Width must have min to make stripe input area visible. Lower than 320 makes input area crazy for credit card that need zip code */ #tablepublicpayment { border: 1px solid #CCCCCC !important; width: 100%; padding: 20px; } #tablepublicpayment .CTableRow1 { background-color: #F0F0F0 !important; } #tablepublicpayment tr.liste_total { border-bottom: 1px solid #CCCCCC !important; } From 30f89b1216fcc670fbf15d00d3b03cec64eaa32a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 14 Nov 2020 18:37:05 +0100 Subject: [PATCH 079/124] doxygen --- .../doc/pdf_standard.modules.php | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 38f43a50910..176b09264d4 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -2,7 +2,7 @@ /* Copyright (C) 2015 Laurent Destailleur * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2016-2019 Philippe Grand - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * Copyright (C) 2018 Francis Appels * Copyright (C) 2019 Markus Welters * Copyright (C) 2019 Rafael Ingenleuf @@ -199,13 +199,13 @@ class pdf_standard extends ModeleExpenseReport /** * Function to build pdf onto disk * - * @param Object $object Object to generate - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * @param ExpenseReport $object Object to generate + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref + * @return int 1=OK, 0=KO */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { @@ -558,13 +558,13 @@ class pdf_standard extends ModeleExpenseReport } /** - * @param TCPDF $pdf Object PDF - * @param Object $object Object to show - * @param int $linenumber line number - * @param int $curY current y position - * @param int $default_font_size default siez of font - * @param Translate $outputlangs Object lang for output - * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) + * @param TCPDF $pdf Object PDF + * @param ExpenseReport $object Object to show + * @param int $linenumber line number + * @param int $curY current y position + * @param int $default_font_size default siez of font + * @param Translate $outputlangs Object lang for output + * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) * @return void */ protected function printLine(&$pdf, $object, $linenumber, $curY, $default_font_size, $outputlangs, $hidedetails = 0) @@ -644,10 +644,10 @@ class pdf_standard extends ModeleExpenseReport /** * Show top header of page. * - * @param TCPDF $pdf Object PDF - * @param Object $object Object to show - * @param int $showaddress 0=no, 1=yes - * @param Translate $outputlangs Object lang for output + * @param TCPDF $pdf Object PDF + * @param ExpenseReport $object Object to show + * @param int $showaddress 0=no, 1=yes + * @param Translate $outputlangs Object lang for output * @return void */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) @@ -981,11 +981,11 @@ class pdf_standard extends ModeleExpenseReport /** * Show payments table * - * @param TCPDF $pdf Object PDF - * @param Object $object Object invoice - * @param int $posy Position y in PDF - * @param Translate $outputlangs Object langs for output - * @return int <0 if KO, >0 if OK + * @param TCPDF $pdf Object PDF + * @param ExpenseReport $object Object expensereport + * @param int $posy Position y in PDF + * @param Translate $outputlangs Object langs for output + * @return int <0 if KO, >0 if OK */ protected function tablePayments(&$pdf, $object, $posy, $outputlangs) { @@ -1093,11 +1093,11 @@ class pdf_standard extends ModeleExpenseReport /** * Show footer of page. Need this->emetteur object * - * @param TCPDF $pdf PDF - * @param Object $object Object to show - * @param Translate $outputlangs Object lang for output - * @param int $hidefreetext 1=Hide free text - * @return int Return height of bottom margin including footer text + * @param TCPDF $pdf PDF + * @param ExpenseReport $object Object to show + * @param Translate $outputlangs Object lang for output + * @param int $hidefreetext 1=Hide free text + * @return int Return height of bottom margin including footer text */ protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { From 61d72b53bed6528ae7cd8adad5282713788520e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 14 Nov 2020 20:24:26 +0100 Subject: [PATCH 080/124] doxygen --- htdocs/core/modules/delivery/doc/pdf_storm.modules.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php index 10e3fa364d5..7a61ca75f94 100644 --- a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php @@ -652,7 +652,7 @@ class pdf_storm extends ModelePDFDeliveryOrder * Show miscellaneous information (payment mode, payment term, ...) * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Delivery $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object * @return void @@ -730,7 +730,7 @@ class pdf_storm extends ModelePDFDeliveryOrder * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Delivery $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @return void @@ -906,8 +906,8 @@ class pdf_storm extends ModelePDFDeliveryOrder /** * Show footer of page. Need this->emetteur object * - * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param TCPDF $pdf PDF + * @param Delivery $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return int Return height of bottom margin including footer text @@ -924,7 +924,7 @@ class pdf_storm extends ModelePDFDeliveryOrder /** * Define Array Column Field * - * @param object $object common object + * @param Delivery $object common object * @param Translate $outputlangs langs * @param int $hidedetails Do not show line details * @param int $hidedesc Do not show desc From d5f93e8c351faada2f4e1651fa9ba9467e457fc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 14 Nov 2020 20:26:13 +0100 Subject: [PATCH 081/124] Update pdf_typhon.modules.php --- htdocs/core/modules/delivery/doc/pdf_typhon.modules.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php index dbeab0a11d2..ad2abfbf885 100644 --- a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php @@ -175,7 +175,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder /** * Function to build pdf onto disk * - * @param Object $object Object to generate + * @param Delivery $object Object to generate * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -628,7 +628,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder * Show miscellaneous information (payment mode, payment term, ...) * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Delivery $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object * @return void @@ -723,7 +723,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Delivery $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @return void @@ -897,7 +897,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param Delivery $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return int Return height of bottom margin including footer text From 50e3fffbd834759b869e6e71f7ea09f6fea37d49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 14 Nov 2020 20:35:52 +0100 Subject: [PATCH 082/124] doxygen --- .../bank/doc/pdf_sepamandate.modules.php | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php index 3c9a1b60b52..50ad60725ad 100644 --- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php @@ -90,16 +90,16 @@ class pdf_sepamandate extends ModeleBankAccountDoc // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Fonction generant le projet sur le disque + * Function to create pdf of company bank account sepa mandate * - * @param Project $object Object project a generer - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details (not used for this template) - * @param int $hidedesc Do not show desc (not used for this template) - * @param int $hideref Do not show ref (not used for this template) - * @param null|array $moreparams More parameters - * @return int 1 if OK, <=0 if KO + * @param CompanyBankAccount $object Object project a generer + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details (not used for this template) + * @param int $hidedesc Do not show desc (not used for this template) + * @param int $hideref Do not show ref (not used for this template) + * @param null|array $moreparams More parameters + * @return int 1 if OK, <=0 if KO */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { @@ -447,10 +447,10 @@ class pdf_sepamandate extends ModeleBankAccountDoc /** * Show miscellaneous information (payment mode, payment term, ...) * - * @param TCPDF $pdf Object PDF - * @param Object $object Object to show - * @param int $posy Y - * @param Translate $outputlangs Langs object + * @param TCPDF $pdf Object PDF + * @param CompanyBankAccount $object Object to show + * @param int $posy Y + * @param Translate $outputlangs Langs object * @return void */ protected function _tableau_info(&$pdf, $object, $posy, $outputlangs) @@ -485,11 +485,11 @@ class pdf_sepamandate extends ModeleBankAccountDoc /** * Show area for the customer to sign * - * @param TCPDF $pdf Object PDF - * @param Facture $object Object invoice - * @param int $posy Position depart - * @param Translate $outputlangs Objet langs - * @return int Position pour suite + * @param TCPDF $pdf Object PDF + * @param CompanyBankAccount $object Object invoice + * @param int $posy Position depart + * @param Translate $outputlangs Objet langs + * @return int Position pour suite */ protected function _signature_area(&$pdf, $object, $posy, $outputlangs) { @@ -527,10 +527,10 @@ class pdf_sepamandate extends ModeleBankAccountDoc /** * Show top header of page. * - * @param TCPDF $pdf Object PDF - * @param Project $object Object to show - * @param int $showaddress 0=no, 1=yes - * @param Translate $outputlangs Object lang for output + * @param TCPDF $pdf Object PDF + * @param CompanyBankAccount $object Object to show + * @param int $showaddress 0=no, 1=yes + * @param Translate $outputlangs Object lang for output * @return void */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) @@ -615,13 +615,13 @@ class pdf_sepamandate extends ModeleBankAccountDoc // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** - * Show footer of page. Need this->emetteur object + * Show footer of page. Need this->emetteur object * - * @param TCPDF $pdf PDF - * @param Project $object Object to show - * @param Translate $outputlangs Object lang for output - * @param int $hidefreetext 1=Hide free text - * @return integer + * @param TCPDF $pdf PDF + * @param CompanyBankAccount $object Object to show + * @param Translate $outputlangs Object lang for output + * @param int $hidefreetext 1=Hide free text + * @return integer */ protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { From a2fc7ce8c93d234ec8a8c96418f6d9b71d1efd19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 14 Nov 2020 20:37:54 +0100 Subject: [PATCH 083/124] doxygen --- htdocs/core/modules/bank/doc/pdf_ban.modules.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/bank/doc/pdf_ban.modules.php b/htdocs/core/modules/bank/doc/pdf_ban.modules.php index 8182c6f5ea7..e4531140f8f 100644 --- a/htdocs/core/modules/bank/doc/pdf_ban.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_ban.modules.php @@ -93,7 +93,7 @@ class pdf_ban extends ModeleBankAccountDoc /** * Fonction generant le projet sur le disque * - * @param Project $object Object project a generer + * @param Account $object Object Account to generate * @param Translate $outputlangs Lang output object * @return int 1 if OK, <=0 if KO */ @@ -114,8 +114,7 @@ class pdf_ban extends ModeleBankAccountDoc //$nblines = count($object->lines); // This is set later with array of tasks // Definition of $dir and $file - if ($object->specimen) - { + if ($object->specimen) { $dir = $conf->bank->dir_output; $file = $dir."/SPECIMEN.pdf"; } else { @@ -293,7 +292,7 @@ class pdf_ban extends ModeleBankAccountDoc * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Project $object Object to show + * @param Account $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @return void @@ -378,7 +377,7 @@ class pdf_ban extends ModeleBankAccountDoc * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Project $object Object to show + * @param Account $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return integer From 1db8afb4a99706f37d0dd388e9b68abcf03a9400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 14 Nov 2020 20:40:17 +0100 Subject: [PATCH 084/124] doxygen --- htdocs/core/modules/commande/doc/pdf_proforma.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php index d1df957b453..fa555db2ced 100644 --- a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php @@ -63,7 +63,7 @@ class pdf_proforma extends pdf_eratosthene * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Commande $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @param string $titlekey Translation key to show as title of document From e1c148a9948e23440e0960c01d60ac07ca0e2ae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 14 Nov 2020 20:44:44 +0100 Subject: [PATCH 085/124] doxygen --- .../commande/doc/pdf_einstein.modules.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 922a6248394..5ff40a84529 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -7,7 +7,7 @@ * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2015 Marcos García * Copyright (C) 2017-2018 Ferran Marcet - * Copyright (C) 2018-2019 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -204,7 +204,7 @@ class pdf_einstein extends ModelePDFCommandes /** * Function to build pdf onto disk * - * @param Object $object Object to generate + * @param Commande $object Object to generate * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -655,7 +655,7 @@ class pdf_einstein extends ModelePDFCommandes * Show payments table * * @param TCPDF $pdf Object PDF - * @param Object $object Object order + * @param Commande $object Object order * @param int $posy Position y in PDF * @param Translate $outputlangs Object langs for output * @return int <0 if KO, >0 if OK @@ -671,7 +671,7 @@ class pdf_einstein extends ModelePDFCommandes * Show miscellaneous information (payment mode, payment term, ...) * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Commande $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object * @return int @@ -754,8 +754,8 @@ class pdf_einstein extends ModelePDFCommandes $pdf->MultiCell(80, 4, $dlp, 0, 'L'); $posy = $pdf->GetY() + 1; - } elseif ($object->availability_code || $object->availability) // Show availability conditions - { + } elseif ($object->availability_code || $object->availability) { + // Show availability conditions $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("AvailabilityPeriod").':'; @@ -859,7 +859,7 @@ class pdf_einstein extends ModelePDFCommandes * Show total to pay * * @param TCPDF $pdf Object PDF - * @param Facture $object Object invoice + * @param Commande $object Object invoice * @param int $deja_regle Montant deja regle * @param int $posy Position depart * @param Translate $outputlangs Objet langs @@ -1242,7 +1242,7 @@ class pdf_einstein extends ModelePDFCommandes * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Commande $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @param Translate $outputlangsbis Object lang for output bis @@ -1495,7 +1495,7 @@ class pdf_einstein extends ModelePDFCommandes * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param Commande $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return int Return height of bottom margin including footer text From 9c258b5dd438518e7a80ff0dca5872aa1c2cfaa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 14 Nov 2020 20:46:49 +0100 Subject: [PATCH 086/124] Update pdf_eratosthene.modules.php --- .../commande/doc/pdf_eratosthene.modules.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 992f877d23f..21a6d4a6763 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -7,7 +7,7 @@ * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2015 Marcos García * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2018-2019 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -188,7 +188,7 @@ class pdf_eratosthene extends ModelePDFCommandes /** * Function to build pdf onto disk * - * @param Object $object Object to generate + * @param Commande $object Object to generate * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -876,7 +876,7 @@ class pdf_eratosthene extends ModelePDFCommandes * Show payments table * * @param TCPDF $pdf Object PDF - * @param Object $object Object order + * @param Commande $object Object order * @param int $posy Position y in PDF * @param Translate $outputlangs Object langs for output * @return int <0 if KO, >0 if OK @@ -889,7 +889,7 @@ class pdf_eratosthene extends ModelePDFCommandes * Show miscellaneous information (payment mode, payment term, ...) * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Commande $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object * @return int Pos y @@ -1075,7 +1075,7 @@ class pdf_eratosthene extends ModelePDFCommandes * Show total to pay * * @param TCPDF $pdf Object PDF - * @param Facture $object Object invoice + * @param Commande $object Object invoice * @param int $deja_regle Montant deja regle * @param int $posy Position depart * @param Translate $outputlangs Objet langs @@ -1404,7 +1404,7 @@ class pdf_eratosthene extends ModelePDFCommandes * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Commande $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @param Translate $outputlangsbis Object lang for output bis @@ -1658,7 +1658,7 @@ class pdf_eratosthene extends ModelePDFCommandes * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param Commande $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return int Return height of bottom margin including footer text @@ -1676,7 +1676,7 @@ class pdf_eratosthene extends ModelePDFCommandes /** * Define Array Column Field * - * @param object $object common object + * @param Commande $object common object * @param Translate $outputlangs langs * @param int $hidedetails Do not show line details * @param int $hidedesc Do not show desc From c12c0a0d2fa4bd1d246e814440cf110e376206e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 14 Nov 2020 20:50:15 +0100 Subject: [PATCH 087/124] Update pdf_strato.modules.php --- .../core/modules/contract/doc/pdf_strato.modules.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 92542fd9f3e..08fefaf5634 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -6,7 +6,7 @@ * Copyright (C) 2011 Fabrice CHERRIER * Copyright (C) 2013-2020 Philippe Grand * Copyright (C) 2015 Marcos García - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -164,8 +164,8 @@ class pdf_strato extends ModelePDFContract /** * Function to build pdf onto disk * - * @param CommonObject $object Id of object to generate - * @param object $outputlangs Lang output object + * @param Contrat $object Object to generate + * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details * @param int $hidedesc Do not show desc @@ -580,7 +580,7 @@ class pdf_strato extends ModelePDFContract * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param CommonObject $object Object to show + * @param Contrat $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @return void @@ -756,7 +756,7 @@ class pdf_strato extends ModelePDFContract * Show footer of page. Need this->emetteur object * * @param PDF $pdf PDF - * @param CommonObject $object Object to show + * @param Contrat $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return integer From 84ea018d81e8799729705cdadc88f29c9903ee57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 14 Nov 2020 21:05:53 +0100 Subject: [PATCH 088/124] doxygen --- .../modules/expedition/doc/pdf_espadon.modules.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 15f425ba422..6c91b1f986d 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014-2015 Marcos García - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -146,7 +146,7 @@ class pdf_espadon extends ModelePdfExpedition /** * Function to build pdf onto disk * - * @param Object $object Object expedition to generate (or id if old method) + * @param Expedition $object Object expedition to generate (or id if old method) * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -672,7 +672,7 @@ class pdf_espadon extends ModelePdfExpedition * Show total to pay * * @param TCPDF $pdf Object PDF - * @param Facture $object Object invoice + * @param Expedition $object Object expedition * @param int $deja_regle Amount already paid * @param int $posy Start Position * @param Translate $outputlangs Objet langs @@ -823,7 +823,7 @@ class pdf_espadon extends ModelePdfExpedition * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Expedition $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @return void @@ -1066,7 +1066,7 @@ class pdf_espadon extends ModelePdfExpedition * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param Expedition $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return int Return height of bottom margin including footer text @@ -1081,7 +1081,7 @@ class pdf_espadon extends ModelePdfExpedition /** * Define Array Column Field * - * @param object $object common object + * @param Expedition $object common object * @param Translate $outputlangs langs * @param int $hidedetails Do not show line details * @param int $hidedesc Do not show desc From 0b097c74fa021ac283ed1207a78937001dad4dc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 14 Nov 2020 21:07:34 +0100 Subject: [PATCH 089/124] Update pdf_merou.modules.php --- htdocs/core/modules/expedition/doc/pdf_merou.modules.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index e02463c51f3..56b4147f7e9 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -146,7 +146,7 @@ class pdf_merou extends ModelePdfExpedition /** * Function to build pdf onto disk * - * @param Object $object Object expedition to generate (or id if old method) + * @param Expedition $object Object expedition to generate (or id if old method) * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -481,7 +481,7 @@ class pdf_merou extends ModelePdfExpedition * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param Expedition $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return void @@ -510,7 +510,7 @@ class pdf_merou extends ModelePdfExpedition * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Expedition $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @return void From d6afdda8fee7c5b91f67e6ce89c724ec2fbfb1f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 14 Nov 2020 21:09:02 +0100 Subject: [PATCH 090/124] Update pdf_rouget.modules.php --- .../modules/expedition/doc/pdf_rouget.modules.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 3a2d9a170eb..cb272a7bb95 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014-2015 Marcos García - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -178,7 +178,7 @@ class pdf_rouget extends ModelePdfExpedition /** * Function to build pdf onto disk * - * @param Object $object Object expedition to generate (or id if old method) + * @param Expedition $object Object expedition to generate (or id if old method) * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -662,8 +662,8 @@ class pdf_rouget extends ModelePdfExpedition /** * Show total to pay * - * @param TCPDF $pdf Object PDF - * @param Facture $object Object invoice + * @param TCPDF $pdf Object PDF + * @param Expedition $object Object invoice * @param int $deja_regle Montant deja regle * @param int $posy Position depart * @param Translate $outputlangs Objet langs @@ -858,7 +858,7 @@ class pdf_rouget extends ModelePdfExpedition * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Expedition $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @return void @@ -1101,7 +1101,7 @@ class pdf_rouget extends ModelePdfExpedition * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param Expedition $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return int Return height of bottom margin including footer text From 9075e30a9428210912c5979dae8fe79106dab211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 14 Nov 2020 21:19:28 +0100 Subject: [PATCH 091/124] doxygen --- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 8323400d16c..573778a2df7 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -220,7 +220,7 @@ class pdf_crabe extends ModelePDFFactures /** * Function to build pdf onto disk * - * @param Object $object Object to generate + * @param Facture $object Object to generate * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -782,7 +782,7 @@ class pdf_crabe extends ModelePDFFactures * Show payments table * * @param TCPDF $pdf Object PDF - * @param Object $object Object invoice + * @param Facture $object Object invoice * @param int $posy Position y in PDF * @param Translate $outputlangs Object langs for output * @param int $heightforfooter height for footer @@ -967,7 +967,7 @@ class pdf_crabe extends ModelePDFFactures * Show miscellaneous information (payment mode, payment term, ...) * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Facture $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object * @return void @@ -1588,7 +1588,7 @@ class pdf_crabe extends ModelePDFFactures * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Facture $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @return void @@ -1891,7 +1891,7 @@ class pdf_crabe extends ModelePDFFactures * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param Facture $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return int Return height of bottom margin including footer text From 518ad097d06a674e3b9dbbea417dba8ef2ac65a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 14 Nov 2020 21:21:58 +0100 Subject: [PATCH 092/124] Update pdf_sponge.modules.php --- .../core/modules/facture/doc/pdf_sponge.modules.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 26f4127570b..8b89f044a5f 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -197,7 +197,7 @@ class pdf_sponge extends ModelePDFFactures /** * Function to build pdf onto disk * - * @param Object $object Object to generate + * @param Facture $object Object to generate * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -926,7 +926,7 @@ class pdf_sponge extends ModelePDFFactures * Show payments table * * @param TCPDF $pdf Object PDF - * @param Object $object Object invoice + * @param Facture $object Object invoice * @param int $posy Position y in PDF * @param Translate $outputlangs Object langs for output * @return int <0 if KO, >0 if OK @@ -1064,7 +1064,7 @@ class pdf_sponge extends ModelePDFFactures * Show miscellaneous information (payment mode, payment term, ...) * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Facture $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object * @return int Pos y @@ -1829,7 +1829,7 @@ class pdf_sponge extends ModelePDFFactures * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Facture $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @param Translate $outputlangsbis Object lang for output bis @@ -2150,7 +2150,7 @@ class pdf_sponge extends ModelePDFFactures * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param Facture $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return int Return height of bottom margin including footer text @@ -2165,7 +2165,7 @@ class pdf_sponge extends ModelePDFFactures /** * Define Array Column Field * - * @param object $object common object + * @param Facture $object common object * @param Translate $outputlangs langs * @param int $hidedetails Do not show line details * @param int $hidedesc Do not show desc From b994d0d84bd0b1660ed136c2145663d3eba5fc5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 14 Nov 2020 21:26:18 +0100 Subject: [PATCH 093/124] doxygen --- htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index 951e953da25..c79b2ac4137 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -156,7 +156,7 @@ class pdf_soleil extends ModelePDFFicheinter /** * Function to build pdf onto disk * - * @param Object $object Object to generate + * @param Fichinter $object Object to generate * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -537,7 +537,7 @@ class pdf_soleil extends ModelePDFFicheinter * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Fichinter $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @return void @@ -710,7 +710,7 @@ class pdf_soleil extends ModelePDFFicheinter * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param Fichinter $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return integer From da0bdd0907f24d52e663cadb48ec8c058c647137 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 14 Nov 2020 22:04:14 +0100 Subject: [PATCH 094/124] doxygen --- htdocs/core/modules/product/doc/pdf_standard.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php index b38de420b97..a4032c6a13a 100644 --- a/htdocs/core/modules/product/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php @@ -690,7 +690,7 @@ class pdf_standard extends ModelePDFProduct * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Product $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @param string $titlekey Translation key to show as title of document @@ -837,7 +837,7 @@ class pdf_standard extends ModelePDFProduct * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param Product $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return int Return height of bottom margin including footer text From 92c28efe42d8573171683ab3032d5d0df7c38a61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 14 Nov 2020 22:12:05 +0100 Subject: [PATCH 095/124] doxygen --- .../core/modules/propale/doc/pdf_azur.modules.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 5892870809d..d8a4a75dac2 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -204,7 +204,7 @@ class pdf_azur extends ModelePDFPropales /** * Function to build pdf onto disk * - * @param Object $object Object to generate + * @param Propal $object Object to generate * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -827,8 +827,8 @@ class pdf_azur extends ModelePDFPropales /** * Show payments table * - * @param TCPDF $pdf Object PDF - * @param Object $object Object proposal + * @param TCPDF $pdf Object PDF + * @param Propal $object Object proposal * @param int $posy Position y in PDF * @param Translate $outputlangs Object langs for output * @return int <0 if KO, >0 if OK @@ -844,7 +844,7 @@ class pdf_azur extends ModelePDFPropales * Show miscellaneous information (payment mode, payment term, ...) * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Propal $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object * @return void @@ -1415,7 +1415,7 @@ class pdf_azur extends ModelePDFPropales * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Propal $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @return void @@ -1666,7 +1666,7 @@ class pdf_azur extends ModelePDFPropales * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param Propal $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return int Return height of bottom margin including footer text @@ -1684,7 +1684,7 @@ class pdf_azur extends ModelePDFPropales * Show area for the customer to sign * * @param TCPDF $pdf Object PDF - * @param Facture $object Object invoice + * @param Propal $object Object invoice * @param int $posy Position depart * @param Translate $outputlangs Objet langs * @return int Position pour suite From 41906fb5ee3fa267e273e857595980a98751a9d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 14 Nov 2020 22:15:05 +0100 Subject: [PATCH 096/124] Update pdf_cyan.modules.php --- .../modules/propale/doc/pdf_cyan.modules.php | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index e93648a86af..8abedb8b621 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -187,7 +187,7 @@ class pdf_cyan extends ModelePDFPropales /** * Function to build pdf onto disk * - * @param Object $object Object to generate + * @param Propal $object Object to generate * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -967,8 +967,8 @@ class pdf_cyan extends ModelePDFPropales /** * Show payments table * - * @param TCPDF $pdf Object PDF - * @param Object $object Object proposal + * @param TCPDF $pdf Object PDF + * @param Propal $object Object proposal * @param int $posy Position y in PDF * @param Translate $outputlangs Object langs for output * @return int <0 if KO, >0 if OK @@ -981,7 +981,7 @@ class pdf_cyan extends ModelePDFPropales * Show miscellaneous information (payment mode, payment term, ...) * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Propal $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object * @return int Pos y @@ -1158,8 +1158,8 @@ class pdf_cyan extends ModelePDFPropales /** * Show total to pay * - * @param TCPDF $pdf Object PDF - * @param Facture $object Object invoice + * @param TCPDF $pdf Object PDF + * @param Propal $object Object proposal * @param int $deja_regle Montant deja regle * @param int $posy Position depart * @param Translate $outputlangs Objet langs @@ -1507,7 +1507,7 @@ class pdf_cyan extends ModelePDFPropales * Show top header of page. * * @param TCPDF $pdf Object PDF - * @param Object $object Object to show + * @param Propal $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @param Translate $outputlangsbis Object lang for output bis @@ -1553,8 +1553,7 @@ class pdf_cyan extends ModelePDFPropales } else { $logo = $logodir.'/logos/'.$this->emetteur->logo; } - if (is_readable($logo)) - { + if (is_readable($logo)) { $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } else { @@ -1762,7 +1761,7 @@ class pdf_cyan extends ModelePDFPropales * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param Propal $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return int Return height of bottom margin including footer text @@ -1777,8 +1776,8 @@ class pdf_cyan extends ModelePDFPropales /** * Show area for the customer to sign * - * @param TCPDF $pdf Object PDF - * @param Facture $object Object invoice + * @param TCPDF $pdf Object PDF + * @param Propal $object Object proposal * @param int $posy Position depart * @param Translate $outputlangs Objet langs * @return int Position pour suite @@ -1813,7 +1812,7 @@ class pdf_cyan extends ModelePDFPropales /** * Define Array Column Field * - * @param object $object common object + * @param Propal $object object proposal * @param Translate $outputlangs langs * @param int $hidedetails Do not show line details * @param int $hidedesc Do not show desc From 52b4e2fbc530630bd120158f56aca412bbf4b97d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 14 Nov 2020 22:25:25 +0100 Subject: [PATCH 097/124] doxygen --- htdocs/compta/tva/class/tva.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index b767e78294d..51cac4c7394 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -65,6 +65,11 @@ class Tva extends CommonObject */ public $fk_bank; + /** + * @var int accountid + */ + public $accountid; + /** * @var int ID */ From 44c59888535e51f37fd645a133971619593e9341 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 15 Nov 2020 10:42:15 +0100 Subject: [PATCH 098/124] Fix #15377 ticket list filter on author --- htdocs/ticket/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 08419e5c46d..bc54195c467 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -229,7 +229,7 @@ if ($socid > 0) foreach ($search as $key => $val) { - if ($key == 'fk_statut') + if ($key == 'fk_statut' && !empty($search['fk_statut'])) { $tmpstatus = ''; if ($search['fk_statut'] == 'openall' || in_array('openall', $search['fk_statut'])) $tmpstatus .= ($tmpstatus ? ',' : '')."'".Ticket::STATUS_NOT_READ."', '".Ticket::STATUS_READ."', '".Ticket::STATUS_ASSIGNED."', '".Ticket::STATUS_IN_PROGRESS."', '".Ticket::STATUS_NEED_MORE_INFO."', '".Ticket::STATUS_WAITING."'"; @@ -238,7 +238,7 @@ foreach ($search as $key => $val) elseif (is_array($search[$key]) && count($search[$key])) $sql .= natural_search($key, join(',', $search[$key]), 2); continue; } - if ($key == 'fk_user_assign') + if ($key == 'fk_user_assign' || $key == 'fk_user_create') { if ($search[$key] > 0) $sql .= natural_search($key, $search[$key], 2); continue; @@ -536,7 +536,7 @@ foreach ($object->fields as $key => $val) print ''; $formTicket->selectSeveritiesTickets(dol_escape_htmltag($search[$key]), 'search_'.$key.'', '', 2, 1, 1, 0, ($val['css'] ? $val['css'] : 'maxwidth150')); print ''; - } elseif ($key == 'fk_user_assign') { + } elseif ($key == 'fk_user_assign' || $key == 'fk_user_create') { print ''; print $form->select_dolusers($search[$key], 'search_'.$key, 1, null, 0, '', '', '0', 0, 0, '', 0, '', ($val['css'] ? $val['css'] : 'maxwidth150')); print ''; From 894e586669f422720a5e23fe32daa35e46ba9c75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 15 Nov 2020 13:39:48 +0100 Subject: [PATCH 099/124] add translation --- htdocs/langs/en_US/admin.lang | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 9e715bd08d2..ac3fb07e796 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1420,6 +1420,7 @@ AdherentMailRequired=Email required to create a new member MemberSendInformationByMailByDefault=Checkbox to send mail confirmation to members (validation or new subscription) is on by default VisitorCanChooseItsPaymentMode=Visitor can choose from available payment modes MEMBER_REMINDER_EMAIL=Enable automatic reminder by email of expired subscriptions. Note: Module %s must be enabled and correctly setup to send reminders. +MembersDocModules=Document templates for documents generated from member record ##### LDAP setup ##### LDAPSetup=LDAP Setup LDAPGlobalParameters=Global parameters @@ -2079,4 +2080,4 @@ DictionaryProductNature= Nature of product CountryIfSpecificToOneCountry=Country (if specific to a given country) YouMayFindSecurityAdviceHere=You may find security advisory here ModuleActivatedMayExposeInformation=This module may expose sensitive data. If you don't need it, disable it. -ModuleActivatedDoNotUseInProduction=A module designed for the development has been enabled. Do not enable it on a production environment. \ No newline at end of file +ModuleActivatedDoNotUseInProduction=A module designed for the development has been enabled. Do not enable it on a production environment. From d8a0d85cc89eed8d09b7b25b0363c2cea5f2a718 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Nov 2020 13:51:08 +0100 Subject: [PATCH 100/124] Add log --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4d6ddce37f7..8e516e286c7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -108,10 +108,8 @@ install: echo "Updating Composer" rm $TRAVIS_BUILD_DIR/composer.json rm $TRAVIS_BUILD_DIR/composer.lock + composer -V composer self-update - # To have composer making parallel downloads - # This plugin is for Composer1; Composer2 is very fast on its own. Uninstall this plugin and update the Composer itself. - # composer global require hirak/prestissimo composer -n init composer -n config vendor-dir htdocs/includes echo @@ -147,7 +145,9 @@ install: - | echo "Adding path of binaries tools installed by composer to the PATH" - export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH" + export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$TRAVIS_BUILD_DIR/htdocs/includes:$PATH" + echo $PATH + ls $TRAVIS_BUILD_DIR/htdocs/includes/bin echo @@ -178,7 +178,7 @@ before_script: # Check PHP echo "PHP version" php -i | head - - # Check Parallel-lin version + # Check Parallel-lint version echo "Parallel-lint version" which parallel-lint parallel-lint -V From bea2ce6ccab22f974536efd7e6256e9acdd47070 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Nov 2020 14:14:17 +0100 Subject: [PATCH 101/124] Test --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 8e516e286c7..146ee612bd7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -148,6 +148,9 @@ install: export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$TRAVIS_BUILD_DIR/htdocs/includes:$PATH" echo $PATH ls $TRAVIS_BUILD_DIR/htdocs/includes/bin + ls $TRAVIS_BUILD_DIR/htdocs/includes/php-parallel-lint + ls $TRAVIS_BUILD_DIR/htdocs/includes/phpunit + ls $TRAVIS_BUILD_DIR/htdocs/includes/squizlabs/php_codesniffer/bin echo From 3442f881d6f9403827ebca1ad5e25cb126dde912 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Nov 2020 14:15:14 +0100 Subject: [PATCH 102/124] Test --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 146ee612bd7..ff16c8520ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -145,7 +145,7 @@ install: - | echo "Adding path of binaries tools installed by composer to the PATH" - export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$TRAVIS_BUILD_DIR/htdocs/includes:$PATH" + export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$TRAVIS_BUILD_DIR/htdocs/includes/php-parallel-lint:$TRAVIS_BUILD_DIR/htdocs/includes/phpunit:$TRAVIS_BUILD_DIR/htdocs/includes/squizlabs/php_codesniffer/bin:$TRAVIS_BUILD_DIR/htdocs/includes:$PATH" echo $PATH ls $TRAVIS_BUILD_DIR/htdocs/includes/bin ls $TRAVIS_BUILD_DIR/htdocs/includes/php-parallel-lint From 993741e33c38d8567d5c13418d70b89aa1e8b37e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Nov 2020 14:23:21 +0100 Subject: [PATCH 103/124] Test for vendor dir --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index ff16c8520ba..659e81dcd83 100644 --- a/.travis.yml +++ b/.travis.yml @@ -112,6 +112,7 @@ install: composer self-update composer -n init composer -n config vendor-dir htdocs/includes + composer -n config -g vendor-dir htdocs/includes echo - | From 8ac7c420c8bfc88485543272faa9901579ac909a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Nov 2020 14:24:37 +0100 Subject: [PATCH 104/124] Test --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 659e81dcd83..1441a3329d1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -146,8 +146,9 @@ install: - | echo "Adding path of binaries tools installed by composer to the PATH" - export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$TRAVIS_BUILD_DIR/htdocs/includes/php-parallel-lint:$TRAVIS_BUILD_DIR/htdocs/includes/phpunit:$TRAVIS_BUILD_DIR/htdocs/includes/squizlabs/php_codesniffer/bin:$TRAVIS_BUILD_DIR/htdocs/includes:$PATH" + export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$TRAVIS_BUILD_DIR/vendor/bin:$TRAVIS_BUILD_DIR/htdocs/includes:$PATH" echo $PATH + ls $TRAVIS_BUILD_DIR/vendor ls $TRAVIS_BUILD_DIR/htdocs/includes/bin ls $TRAVIS_BUILD_DIR/htdocs/includes/php-parallel-lint ls $TRAVIS_BUILD_DIR/htdocs/includes/phpunit From 8eab783796e3fd2ebae49f4b6172a73fd93d3618 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Nov 2020 14:30:36 +0100 Subject: [PATCH 105/124] Fix travis --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1441a3329d1..5ae5310f6e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -150,9 +150,6 @@ install: echo $PATH ls $TRAVIS_BUILD_DIR/vendor ls $TRAVIS_BUILD_DIR/htdocs/includes/bin - ls $TRAVIS_BUILD_DIR/htdocs/includes/php-parallel-lint - ls $TRAVIS_BUILD_DIR/htdocs/includes/phpunit - ls $TRAVIS_BUILD_DIR/htdocs/includes/squizlabs/php_codesniffer/bin echo From 0bcc4bf9bd7ce420c77d4a6bd8aed28577ecdac4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Nov 2020 14:33:07 +0100 Subject: [PATCH 106/124] Travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5ae5310f6e8..639183de6ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -303,7 +303,7 @@ script: echo - | - echo "Checking coding style (excluding Pull Requests builds to not overload travis, excluding also for some jobs to avoid duplicate tests)" + echo "Checking coding style (excluding Pull Requests builds to not overload travis, excluding also some jobs to avoid duplicate tests)" # Ensure we catch errors set -e # Exclusions are defined in the ruleset.xml file From 2e0e42e91818f2acf8e13406181697a9ae6f3245 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Nov 2020 14:37:21 +0100 Subject: [PATCH 107/124] Fix warning --- htdocs/core/class/commonobject.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 22eef562930..741f5f086a9 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -51,6 +51,11 @@ abstract class CommonObject */ public $id; + /** + * @var int The environment ID when using a multicompany module + */ + public $entity; + /** * @var string Error string * @see $errors From 5c15162c40d48c37beb9277e5c60d01910054022 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Nov 2020 15:10:15 +0100 Subject: [PATCH 108/124] Fix warning --- .../commande/doc/pdf_einstein.modules.php | 2 +- .../commande/doc/pdf_eratosthene.modules.php | 2 +- .../delivery/doc/pdf_storm.modules.php | 2 +- .../delivery/doc/pdf_typhon.modules.php | 2 +- .../expedition/doc/pdf_espadon.modules.php | 2 +- .../expedition/doc/pdf_rouget.modules.php | 2 +- .../modules/facture/doc/pdf_crabe.modules.php | 2 +- .../facture/doc/pdf_sponge.modules.php | 2 +- .../modules/propale/doc/pdf_azur.modules.php | 2 +- .../modules/propale/doc/pdf_cyan.modules.php | 2 +- .../reception/doc/pdf_squille.modules.php | 2 +- .../doc/pdf_canelle.modules.php | 2 +- .../supplier_order/doc/pdf_cornas.modules.php | 2 +- .../doc/pdf_muscadet.modules.php | 2 +- htdocs/product/stock/replenish.php | 21 ++++++++++++------- 15 files changed, 27 insertions(+), 22 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 922a6248394..8aa01f3ba5c 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -343,7 +343,7 @@ class pdf_einstein extends ModelePDFCommandes // Incoterm $height_incoterms = 0; - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 992f877d23f..e959ce37508 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -381,7 +381,7 @@ class pdf_eratosthene extends ModelePDFCommandes // Incoterm $height_incoterms = 0; - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) diff --git a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php index 10e3fa364d5..5540f0caa9d 100644 --- a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php @@ -346,7 +346,7 @@ class pdf_storm extends ModelePDFDeliveryOrder // Incoterm $height_incoterms = 0; - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) diff --git a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php index dbeab0a11d2..24587bb4da7 100644 --- a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php @@ -318,7 +318,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder // Incoterm $height_incoterms = 0; - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 15f425ba422..683aed88f3e 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -319,7 +319,7 @@ class pdf_espadon extends ModelePdfExpedition // Incoterm $height_incoterms = 0; - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 3a2d9a170eb..4a1a46187c3 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -338,7 +338,7 @@ class pdf_rouget extends ModelePdfExpedition // Incoterm $height_incoterms = 0; - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 8323400d16c..9a7b8557e15 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -420,7 +420,7 @@ class pdf_crabe extends ModelePDFFactures $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); // Incoterm - if ($conf->incoterm->enabled) + if (! empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 26f4127570b..bc81696031d 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -422,7 +422,7 @@ class pdf_sponge extends ModelePDFFactures // Incoterm $height_incoterms = 0; - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 5892870809d..f98f071030a 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -396,7 +396,7 @@ class pdf_azur extends ModelePDFPropales $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); // Incoterm - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index e93648a86af..32d74c9b71b 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -384,7 +384,7 @@ class pdf_cyan extends ModelePDFPropales // Incoterm $height_incoterms = 0; - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index 6c7c5f3a2a5..446b03daf0a 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -254,7 +254,7 @@ class pdf_squille extends ModelePdfReception // Incoterm $height_incoterms = 0; - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php index 6b50925a304..517f96a99d6 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -336,7 +336,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); // Incoterm - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) 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 b9efff8303b..0d7cfcdb90d 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -342,7 +342,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); // Incoterm - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) 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 c41771d33c8..a496bd8ba87 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -370,7 +370,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); // Incoterm - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 4fb8e24370c..860044433d7 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -437,7 +437,7 @@ if ($usevirtualstock) $sql .= ' HAVING ('; $sql .= ' ('.$sqldesiredtock.' >= 0 AND ('.$sqldesiredtock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; $sql .= ' - ('.$sqlCommandesCli.' - '.$sqlExpeditionsCli.') + ('.$sqlCommandesFourn.' - '.$sqlReceptionFourn.') + ('.$sqlProductionToProduce.' - '.$sqlProductionToConsume.')))'; - $sql .= ' OR '; + $sql .= ' OR'; if ($includeproductswithoutdesiredqty == 'on') { $sql .= ' (('.$sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; } else { @@ -448,9 +448,9 @@ if ($usevirtualstock) if ($salert == 'on') // Option to see when stock is lower than alert { - $sql .= ' AND (('; + $sql .= ' AND ('; if ($includeproductswithoutdesiredqty == 'on') { - $sql .= $sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; + $sql .= '('.$sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; } else { $sql .= $sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; } @@ -459,20 +459,25 @@ if ($usevirtualstock) $alertchecked = 'checked'; } } else { - $sql .= ' HAVING (('.$sqldesiredtock.' >= 0 AND ('.$sqldesiredtock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; + $sql .= ' HAVING ('; + $sql .= '('.$sqldesiredtock.' >= 0 AND ('.$sqldesiredtock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; + $sql .= ' OR'; if ($includeproductswithoutdesiredqty == 'on') { - $sql .= ' OR (('.$sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").'))))'; + $sql .= ' (('.$sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; } else { - $sql .= ' OR ('.$sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").'))))'; + $sql .= ' ('.$sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; } + $sql .= ')'; if ($salert == 'on') // Option to see when stock is lower than alert { + $sql .= ' AND ('; if ($includeproductswithoutdesiredqty == 'on') { - $sql .= ' AND (('.$sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; + $sql .= ' ('.$sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").'))'; } else { - $sql .= ' AND ('.$sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; + $sql .= ' '.$sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").'))'; } + $sql .= ')'; $alertchecked = 'checked'; } } From 89a77fad2c05449d728d6c82f7c1bcc6f6cbc482 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Nov 2020 16:56:30 +0100 Subject: [PATCH 109/124] Fix warning --- htdocs/core/class/commondocgenerator.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index f3b1e7afc81..26debedc9a7 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1296,7 +1296,7 @@ abstract class CommonDocGenerator $html = ''; $fields = array(); - if (is_array($extrafields->attributes[$object->table_element]['label'])) { + if (is_array($extrafields->attributes[$object->table_element]) && is_array($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) { // Enable extrafield ? From c96fd8c727f7454a2484e72a6b1247a5f1a94636 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 15 Nov 2020 16:58:40 +0100 Subject: [PATCH 110/124] fix warnings --- htdocs/expedition/class/expedition.class.php | 57 ++++++++------------ 1 file changed, 22 insertions(+), 35 deletions(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index bc97a26d7ff..abc59080912 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1060,13 +1060,13 @@ class Expedition extends CommonObject // Clean parameters if (isset($this->ref)) $this->ref = trim($this->ref); - if (isset($this->entity)) $this->entity = trim($this->entity); + if (isset($this->entity)) $this->entity = (int) $this->entity; if (isset($this->ref_customer)) $this->ref_customer = trim($this->ref_customer); - if (isset($this->socid)) $this->socid = trim($this->socid); - if (isset($this->fk_user_author)) $this->fk_user_author = trim($this->fk_user_author); - if (isset($this->fk_user_valid)) $this->fk_user_valid = trim($this->fk_user_valid); - if (isset($this->fk_delivery_address)) $this->fk_delivery_address = trim($this->fk_delivery_address); - if (isset($this->shipping_method_id)) $this->shipping_method_id = trim($this->shipping_method_id); + if (isset($this->socid)) $this->socid = (int) $this->socid; + if (isset($this->fk_user_author)) $this->fk_user_author = (int) $this->fk_user_author; + if (isset($this->fk_user_valid)) $this->fk_user_valid = (int) $this->fk_user_valid; + if (isset($this->fk_delivery_address)) $this->fk_delivery_address = (int) $this->fk_delivery_address; + if (isset($this->shipping_method_id)) $this->shipping_method_id = (int) $this->shipping_method_id; if (isset($this->tracking_number)) $this->tracking_number = trim($this->tracking_number); if (isset($this->statut)) $this->statut = (int) $this->statut; if (isset($this->trueDepth)) $this->trueDepth = trim($this->trueDepth); @@ -1122,15 +1122,11 @@ class Expedition extends CommonObject $resql = $this->db->query($sql); if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } - if (!$error) - { - if (!$notrigger) - { - // Call trigger - $result = $this->call_trigger('SHIPPING_MODIFY', $user); - if ($result < 0) { $error++; } - // End call triggers - } + if (!$error && !$notrigger) { + // Call trigger + $result = $this->call_trigger('SHIPPING_MODIFY', $user); + if ($result < 0) { $error++; } + // End call triggers } // Commit or rollback @@ -1171,21 +1167,16 @@ class Expedition extends CommonObject // Add a protection to refuse deleting if shipment has at least one delivery $this->fetchObjectLinked($this->id, 'shipping', 0, 'delivery'); // Get deliveries linked to this shipment - if (count($this->linkedObjectsIds) > 0) - { + if (count($this->linkedObjectsIds) > 0) { $this->error = 'ErrorThereIsSomeDeliveries'; $error++; } - if (!$error) - { - if (!$notrigger) - { - // Call trigger - $result = $this->call_trigger('SHIPPING_CANCEL', $user); - if ($result < 0) { $error++; } - // End call triggers - } + if (!$error && !$notrigger) { + // Call trigger + $result = $this->call_trigger('SHIPPING_CANCEL', $user); + if ($result < 0) { $error++; } + // End call triggers } // Stock control @@ -1383,15 +1374,11 @@ class Expedition extends CommonObject $error++; } - if (!$error) - { - if (!$notrigger) - { - // Call trigger - $result = $this->call_trigger('SHIPPING_DELETE', $user); - if ($result < 0) { $error++; } - // End call triggers - } + if (!$error && !$notrigger) { + // Call trigger + $result = $this->call_trigger('SHIPPING_DELETE', $user); + if ($result < 0) { $error++; } + // End call triggers } // Stock control From 011e78699623e8794e46af507f28f8458aa3b2c0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Nov 2020 17:00:37 +0100 Subject: [PATCH 111/124] Update pdf_sepamandate.modules.php --- htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php index 50ad60725ad..a07592d339a 100644 --- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php @@ -92,7 +92,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc /** * Function to create pdf of company bank account sepa mandate * - * @param CompanyBankAccount $object Object project a generer + * @param CompanyBankAccount $object Object bank account to generate document for * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details (not used for this template) From 31c73403c013285b1a1512d39b9628005ab1415a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Nov 2020 17:04:07 +0100 Subject: [PATCH 112/124] Update pdf_eratosthene.modules.php --- htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 21a6d4a6763..af39b725adc 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -1074,8 +1074,8 @@ class pdf_eratosthene extends ModelePDFCommandes /** * Show total to pay * - * @param TCPDF $pdf Object PDF - * @param Commande $object Object invoice + * @param TCPDF $pdf Object PDF + * @param Commande $object Object to show * @param int $deja_regle Montant deja regle * @param int $posy Position depart * @param Translate $outputlangs Objet langs From 5e1cd459b107fd8ab971dc5db019124a297503ce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Nov 2020 23:47:53 +0100 Subject: [PATCH 113/124] Fix travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 4e947325633..8a782146c26 100644 --- a/.travis.yml +++ b/.travis.yml @@ -120,6 +120,7 @@ install: composer self-update composer -n init composer -n config vendor-dir htdocs/includes + composer -n config -g vendor-dir htdocs/includes echo - | From 217aa9c4204c49f2b217e5f5f745fbc0f3b7bc21 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Nov 2020 23:50:11 +0100 Subject: [PATCH 114/124] Clean CI --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index af695d4672e..082847d8c30 100644 --- a/.travis.yml +++ b/.travis.yml @@ -112,7 +112,6 @@ install: rm $TRAVIS_BUILD_DIR/composer.lock composer self-update # To have composer making parallel downloads - composer global require hirak/prestissimo composer -n init composer -n config vendor-dir htdocs/includes composer -n config -g vendor-dir htdocs/includes From 65144f4d5ad7dc80167e810144bcf39e507e3c17 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Nov 2020 11:37:28 +0100 Subject: [PATCH 115/124] fix warning --- htdocs/core/class/commondocgenerator.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 26debedc9a7..67232bc9da1 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1296,7 +1296,7 @@ abstract class CommonDocGenerator $html = ''; $fields = array(); - if (is_array($extrafields->attributes[$object->table_element]) && is_array($extrafields->attributes[$object->table_element]['label'])) { + if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) { // Enable extrafield ? From 6c42535eb25acf550d9f69d5fc2ad424a651fa8c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Nov 2020 12:20:18 +0100 Subject: [PATCH 116/124] Maxi debug v13 --- htdocs/comm/propal/card.php | 26 ++++++++------ htdocs/comm/propal/class/propal.class.php | 31 ++++++++++------ htdocs/commande/card.php | 20 ++++++----- htdocs/commande/class/commande.class.php | 16 +++++---- htdocs/commande/list.php | 2 +- htdocs/compta/facture/class/facture.class.php | 4 +-- ...box_supplier_orders_awaiting_reception.php | 1 - .../commande/doc/pdf_einstein.modules.php | 4 +-- .../commande/doc/pdf_eratosthene.modules.php | 4 +-- .../modules/delivery/mod_delivery_saphir.php | 2 +- .../modules/propale/doc/pdf_azur.modules.php | 4 +-- .../modules/propale/doc/pdf_cyan.modules.php | 4 +-- .../supplier_order/doc/pdf_cornas.modules.php | 4 +-- .../doc/pdf_muscadet.modules.php | 4 +-- .../doc/pdf_aurore.modules.php | 8 ++--- htdocs/expedition/card.php | 7 ++-- htdocs/expedition/list.php | 5 +-- htdocs/expedition/shipment.php | 8 ++--- .../class/fournisseur.commande.class.php | 35 ++++++++++++------- htdocs/fourn/commande/card.php | 13 +++---- htdocs/install/upgrade2.php | 10 +++--- htdocs/reception/card.php | 7 ++-- htdocs/reception/list.php | 34 +++++++++--------- htdocs/supplier_proposal/card.php | 6 ++-- .../class/supplier_proposal.class.php | 16 ++++++--- 25 files changed, 157 insertions(+), 118 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 8613828f632..3a80ae22306 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -171,13 +171,14 @@ if (empty($reshook)) GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int') ); - if (!empty($object->date_livraison) && !empty($date_delivery)) + $date_delivery_old = (empty($object->delivery_date) ? $object->date_livraison : $object->delivery_date); + if (!empty($date_delivery_old) && !empty($date_delivery)) { //Attempt to get the date without possible hour rounding errors $old_date_delivery = dol_mktime(12, 0, 0, - dol_print_date($object->date_livraison, '%m'), - dol_print_date($object->date_livraison, '%d'), - dol_print_date($object->date_livraison, '%Y') + dol_print_date($date_delivery_old, '%m'), + dol_print_date($date_delivery_old, '%d'), + dol_print_date($date_delivery_old, '%Y') ); //Calculate the difference and apply if necessary $difference = $date_delivery - $old_date_delivery; @@ -341,7 +342,9 @@ if (empty($reshook)) if ($object->fetch(GETPOST('copie_propal', 'int')) > 0) { $object->ref = GETPOST('ref'); $object->datep = $datep; - $object->date_livraison = $date_delivery; + $object->date = $datep; + $object->date_livraison = $date_delivery; // deprecated + $object->delivery_date = $date_delivery; $object->availability_id = GETPOST('availability_id'); $object->demand_reason_id = GETPOST('demand_reason_id'); $object->fk_delivery_address = GETPOST('fk_address', 'int'); @@ -355,8 +358,9 @@ if (empty($reshook)) $object->socid = GETPOST('socid', 'int'); $object->contact_id = GETPOST('contactid', 'int'); $object->fk_project = GETPOST('projectid', 'int'); - $object->model_pdf = GETPOST('model'); + $object->model_pdf = GETPOST('model', 'alphanohtml'); $object->author = $user->id; // deprecated + $object->user_author_id = $user->id; $object->note_private = GETPOST('note_private', 'restricthtml'); $object->note_public = GETPOST('note_public', 'restricthtml'); $object->statut = Propal::STATUS_DRAFT; @@ -372,7 +376,9 @@ if (empty($reshook)) $object->ref = GETPOST('ref'); $object->ref_client = GETPOST('ref_client'); $object->datep = $datep; + $object->date = $datep; $object->date_livraison = $date_delivery; + $object->delivery_date = $date_delivery; $object->availability_id = GETPOST('availability_id', 'int'); $object->demand_reason_id = GETPOST('demand_reason_id', 'int'); $object->fk_delivery_address = GETPOST('fk_address', 'int'); @@ -1823,8 +1829,8 @@ if ($action == 'create') // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)')) ); - if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->date_livraison)) { - $formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->date_livraison); + if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->delivery_date)) { + $formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->delivery_date); } // Incomplete payment. We ask if reason = discount or other $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmClonePropal', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); @@ -2048,9 +2054,9 @@ if ($action == 'create') // Delivery date $langs->load('deliveries'); print ''; - print $form->editfieldkey($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $usercancreate, 'datepicker'); + print $form->editfieldkey($langs->trans('DeliveryDate'), 'date_livraison', $object->delivery_date, $object, $usercancreate, 'datepicker'); print ''; - print $form->editfieldval($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $usercancreate, 'datepicker'); + print $form->editfieldval($langs->trans('DeliveryDate'), 'date_livraison', $object->delivery_date, $object, $usercancreate, 'datepicker'); print ''; print ''; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 27f57569c3a..4f2159a200e 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -991,6 +991,9 @@ class Propal extends CommonObject $this->multicurrency_tx = 1; } + // Set tmp vars + $delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date; + dol_syslog(get_class($this)."::create"); // Check parameters @@ -1078,7 +1081,7 @@ class Propal extends CommonObject $sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : 'NULL'); $sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL'); $sql .= ", '".$this->db->escape($this->ref_client)."'"; - $sql .= ", ".($this->date_livraison != '' ? "'".$this->db->idate($this->date_livraison)."'" : "NULL"); + $sql .= ", ".(empty($delivery_date) ? "NULL" : "'".$this->db->idate($delivery_date)."'"); $sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : 'NULL'); $sql .= ", ".$this->availability_id; $sql .= ", ".$this->demand_reason_id; @@ -1441,7 +1444,7 @@ class Propal extends CommonObject $sql .= ", p.date_valid as datev"; $sql .= ", p.datep as dp"; $sql .= ", p.fin_validite as dfv"; - $sql .= ", p.date_livraison as date_livraison"; + $sql .= ", p.date_livraison as delivery_date"; $sql .= ", p.model_pdf, p.last_main_doc, p.ref_client, p.extraparams"; $sql .= ", p.note_private, p.note_public"; $sql .= ", p.fk_projet as fk_project, p.fk_statut"; @@ -1523,8 +1526,8 @@ class Propal extends CommonObject $this->date = $this->db->jdate($obj->dp); // Proposal date $this->datep = $this->db->jdate($obj->dp); // deprecated $this->fin_validite = $this->db->jdate($obj->dfv); - $this->date_livraison = $this->db->jdate($obj->date_livraison); - $this->delivery_date = $this->db->jdate($obj->date_livraison); + $this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated + $this->delivery_date = $this->db->jdate($obj->delivery_date); $this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null; $this->availability_id = $obj->fk_availability; $this->availability_code = $obj->availability_code; @@ -2111,7 +2114,7 @@ class Propal extends CommonObject { $this->oldcopy = clone $this; $this->date_livraison = $delivery_date; - $this->date_delivery = $delivery_date; + $this->delivery_date = $delivery_date; } if (!$notrigger && empty($error)) @@ -3574,16 +3577,24 @@ class Propal extends CommonObject if (isset($this->statut)) { $label .= ' '.$this->getLibStatut(5); } - if (!empty($this->ref)) + if (!empty($this->ref)) { $label .= '
'.$langs->trans('Ref').': '.$this->ref; - if (!empty($this->ref_client)) + } + if (!empty($this->ref_client)) { $label .= '
'.$langs->trans('RefCustomer').': '.$this->ref_client; - if (!empty($this->total_ht)) + } + if (!empty($this->total_ht)) { $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); - if (!empty($this->total_tva)) + } + if (!empty($this->total_tva)) { $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); - if (!empty($this->total_ttc)) + } + if (!empty($this->total_ttc)) { $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->delivery_date)) { + $label .= '
'.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour'); + } if ($option == '') { $url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id.$get_params; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index fd4c895caec..cb629e2c1f9 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -120,6 +120,8 @@ if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WA $error = 0; +$date_delivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); + /* * Actions @@ -274,7 +276,7 @@ if (empty($reshook)) $object->fk_account = GETPOST('fk_account', 'int'); $object->availability_id = GETPOST('availability_id'); $object->demand_reason_id = GETPOST('demand_reason_id'); - $object->date_livraison = $datelivraison; + $object->date_livraison = $datelivraison; // deprecated $object->delivery_date = $datelivraison; $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); $object->warehouse_id = GETPOST('warehouse_id', 'int'); @@ -539,10 +541,10 @@ if (empty($reshook)) } } elseif ($action == 'setdate_livraison' && $usercancreate) { // print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; - $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); + $date_delivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); $object->fetch($id); - $result = $object->setDeliveryDate($user, $datedelivery); + $result = $object->setDeliveryDate($user, $date_delivery); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } @@ -1507,7 +1509,8 @@ if ($action == 'create' && $usercancreate) $remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0)); $dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER) ?-1 : ''; - $datedelivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : ''); + $date_delivery = (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : ''); + if (empty($date_delivery)) $date_delivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : ''); if (!empty($conf->multicurrency->enabled)) { @@ -1620,8 +1623,7 @@ if ($action == 'create' && $usercancreate) // Date delivery planned print ''.$langs->trans("DateDeliveryPlanned").''; print ''; - //print dol_print_date($object->date_livraison, "day"); // date_livraison come from order and will be stored into date_delivery planed. - $date_delivery = ($date_delivery ? $date_delivery : $object->date_livraison); // $date_delivery comes from GETPOST + $date_delivery = ($date_delivery ? $date_delivery : $object->date_delivery); print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1); print "\n"; print ''; @@ -2138,12 +2140,12 @@ if ($action == 'create' && $usercancreate) print '
'; print ''; print ''; - print $form->selectDate($object->date_livraison ? $object->date_livraison : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); + print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); print ''; print '
'; } else { - print $object->date_livraison ? dol_print_date($object->date_livraison, 'dayhour') : ' '; - if ($object->hasDelay() && !empty($object->date_livraison)) { + print $object->delivery_date ? dol_print_date($object->delivery_date, 'dayhour') : ' '; + if ($object->hasDelay() && !empty($object->delivery_date)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 5c341ac0ffb..b77f7712f90 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -886,8 +886,9 @@ class Commande extends CommonOrder // Clean parameters $this->brouillon = 1; // set command as draft - // $date_commande is deprecated + // Set tmp vars $date = ($this->date_commande ? $this->date_commande : $this->date); + $delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date; // Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate) if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $date); @@ -960,7 +961,7 @@ class Commande extends CommonOrder $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->$delivery_date ? "'".$this->db->idate($this->$delivery_date)."'" : "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'); @@ -1359,7 +1360,7 @@ class Commande extends CommonOrder $this->fk_account = $object->fk_account; $this->availability_id = $object->availability_id; $this->demand_reason_id = $object->demand_reason_id; - $this->date_livraison = $object->date_livraison; + $this->date_livraison = $object->date_livraison; // deprecated $this->delivery_date = $object->date_livraison; $this->shipping_method_id = $object->shipping_method_id; $this->warehouse_id = $object->warehouse_id; @@ -1784,7 +1785,7 @@ class Commande extends CommonOrder $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.date_livraison as delivery_date'; $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'; @@ -1870,8 +1871,8 @@ class Commande extends CommonOrder $this->availability = $obj->availability_label; $this->demand_reason_id = $obj->fk_input_reason; $this->demand_reason_code = $obj->demand_reason_code; - $this->date_livraison = $this->db->jdate($obj->date_livraison); - $this->delivery_date = $this->db->jdate($obj->date_livraison); + $this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated + $this->delivery_date = $this->db->jdate($obj->delivery_date); $this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null; $this->warehouse_id = ($obj->fk_warehouse > 0) ? $obj->fk_warehouse : null; $this->fk_delivery_address = $obj->fk_delivery_address; @@ -3660,6 +3661,9 @@ class Commande extends CommonOrder if (!empty($this->total_ttc)) { $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); } + if (!empty($this->delivery_date)) { + $label .= '
'.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour'); + } } $linkclose = ''; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 1c9cffcdacd..3e7a8d416cf 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -931,7 +931,7 @@ if ($resql) $generic_commande->statut = $obj->fk_statut; $generic_commande->billed = $obj->billed; $generic_commande->date = $db->jdate($obj->date_commande); - $generic_commande->date_livraison = $db->jdate($obj->date_delivery); + $generic_commande->date_livraison = $db->jdate($obj->date_delivery); // deprecated $generic_commande->delivery_date = $db->jdate($obj->date_delivery); $generic_commande->ref_client = $obj->ref_client; $generic_commande->total_ht = $obj->total_ht; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 9c78fa6acb9..51051625db6 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1338,8 +1338,8 @@ class Facture extends CommonInvoice $this->mode_reglement_id = $object->mode_reglement_id; $this->availability_id = $object->availability_id; $this->demand_reason_id = $object->demand_reason_id; - $this->date_livraison = $object->date_livraison; - $this->delivery_date = $object->date_livraison; + $this->delivery_date = (empty($object->delivery_date) ? $object->date_livraison : $object->delivery_date); + $this->date_livraison = $object->delivery_date; // deprecated $this->fk_delivery_address = $object->fk_delivery_address; // deprecated $this->contact_id = $object->contact_id; $this->ref_client = $object->ref_client; diff --git a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php index 57656915d62..9aeba738caf 100644 --- a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php +++ b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php @@ -115,7 +115,6 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes $delivery_date = $this->db->jdate($objp->delivery_date); $datem = $this->db->jdate($objp->tms); - $supplierorderstatic->date_livraison = $delivery_date; $supplierorderstatic->delivery_date = $delivery_date; $supplierorderstatic->statut = $objp->fk_statut; diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 9a618053ff2..114a3906392 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -741,7 +741,7 @@ class pdf_einstein extends ModelePDFCommandes }*/ // Show planed date of delivery - if (!empty($object->date_livraison)) + if (!empty($object->delivery_date)) { $outputlangs->load("sendings"); $pdf->SetFont('', 'B', $default_font_size - 2); @@ -750,7 +750,7 @@ 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->delivery_date, "daytext", false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); $posy = $pdf->GetY() + 1; diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 28c255e973b..1f266851a0c 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -958,7 +958,7 @@ class pdf_eratosthene extends ModelePDFCommandes }*/ // Show planed date of delivery - if (!empty($object->date_livraison)) + if (!empty($object->delivery_date)) { $outputlangs->load("sendings"); $pdf->SetFont('', 'B', $default_font_size - 2); @@ -967,7 +967,7 @@ class pdf_eratosthene 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->delivery_date, "daytext", false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); $posy = $pdf->GetY() + 1; diff --git a/htdocs/core/modules/delivery/mod_delivery_saphir.php b/htdocs/core/modules/delivery/mod_delivery_saphir.php index df1a15598b1..ca0de68a670 100644 --- a/htdocs/core/modules/delivery/mod_delivery_saphir.php +++ b/htdocs/core/modules/delivery/mod_delivery_saphir.php @@ -139,7 +139,7 @@ class mod_delivery_saphir extends ModeleNumRefDeliveryOrder return 0; } - $numFinal = get_next_value($db, $mask, 'delivery', 'ref', '', $objsoc, $object->date_livraison); + $numFinal = get_next_value($db, $mask, 'delivery', 'ref', '', $objsoc, $object->delivery_date); return $numFinal; } diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index aff0e7c4457..3405b6a2774 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -870,7 +870,7 @@ class pdf_azur extends ModelePDFPropales $posxval = 52; // Show shipping date - if (!empty($object->date_livraison)) + if (!empty($object->delivery_date)) { $outputlangs->load("sendings"); $pdf->SetFont('', 'B', $default_font_size - 2); @@ -879,7 +879,7 @@ class pdf_azur extends ModelePDFPropales $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->delivery_date, "daytext", false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); $posy = $pdf->GetY() + 1; diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 9be74e97fb9..8199f3ac11e 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -1006,7 +1006,7 @@ class pdf_cyan extends ModelePDFPropales $posxval = 52; // Show shipping date - if (!empty($object->date_livraison)) + if (!empty($object->delivery_date)) { $outputlangs->load("sendings"); $pdf->SetFont('', 'B', $default_font_size - 2); @@ -1015,7 +1015,7 @@ class pdf_cyan extends ModelePDFPropales $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->delivery_date, "daytext", false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); $posy = $pdf->GetY() + 1; 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 0d7cfcdb90d..681b5316682 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -1276,11 +1276,11 @@ class pdf_cornas extends ModelePDFSuppliersOrders $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)) + if (!empty($object->delivery_date)) { $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'); + $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->delivery_date, $usehourmin, false, $outputlangs, true), '', 'R'); } if ($object->thirdparty->code_fournisseur) 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 a496bd8ba87..13111da6fa9 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -1190,11 +1190,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $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)) + if (!empty($object->delivery_date)) { $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'); + $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->delivery_date, $usehourmin, false, $outputlangs, true), '', 'R'); } if ($object->thirdparty->code_fournisseur) 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 f6dc1d789f0..8a3880dc93e 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -724,7 +724,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $posxval = 52; // Show shipping date - if (!empty($object->date_livraison)) + if (!empty($object->delivery_date)) { $outputlangs->load("sendings"); $pdf->SetFont('', 'B', $default_font_size - 2); @@ -733,7 +733,7 @@ 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->delivery_date, "daytext", false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); $posy = $pdf->GetY() + 1; @@ -745,7 +745,7 @@ 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->delivery_date,"daytext",false,$outputlangs,true); $pdf->MultiCell(80, 4, '', 0, 'L'); $posy = $pdf->GetY() + 1; @@ -1325,7 +1325,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $posy+=4; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierProposalDate")." : " . dol_print_date($object->date_livraison, "day", false, $outputlangs, true), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierProposalDate")." : " . dol_print_date($object->delivery_date, "day", false, $outputlangs, true), '', 'R'); */ if ($object->thirdparty->code_fournisseur) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 77e25704a6b..5fa0ebe26ea 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -105,6 +105,8 @@ $hookmanager->initHooks(array('expeditioncard', 'globalcard')); $permissiondellink = $user->rights->expedition->delivery->creer; // Used by the include of actions_dellink.inc.php //var_dump($object->lines[0]->detail_batch); +$date_delivery = dol_mktime(GETPOST('date_deliveryhour', 'int'), GETPOST('date_deliverymin', 'int'), 0, GETPOST('date_deliverymonth', 'int'), GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int')); + /* * Actions @@ -201,8 +203,6 @@ if (empty($reshook)) $object->size_units = GETPOST('size_units', 'int'); $object->weight_units = GETPOST('weight_units', 'int'); - $date_delivery = dol_mktime(GETPOST('date_deliveryhour', 'int'), GETPOST('date_deliverymin', 'int'), 0, GETPOST('date_deliverymonth', 'int'), GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int')); - // We will loop on each line of the original document to complete the shipping object with various info and quantity to deliver $classname = ucfirst($object->origin); $objectsrc = new $classname($db); @@ -936,8 +936,7 @@ if ($action == 'create') // Date delivery planned print ''.$langs->trans("DateDeliveryPlanned").''; print ''; - //print dol_print_date($object->date_livraison, "day"); // date_livraison come from order and will be stored into date_delivery planed. - $date_delivery = ($date_delivery ? $date_delivery : $object->date_livraison); // $date_delivery comes from GETPOST + $date_delivery = ($date_delivery ? $date_delivery : $object->delivery_date); // $date_delivery comes from GETPOST print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1); print "\n"; print ''; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 09cec584c43..77a62bf8561 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -212,7 +212,7 @@ llxHeader('', $langs->trans('ListOfSendings'), $helpurl); $sql = 'SELECT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; -$sql .= " e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.weight, e.weight_units, e.date_delivery as date_livraison, l.date_delivery as date_reception, e.fk_statut, e.billed, e.tracking_number,"; +$sql .= " e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.weight, e.weight_units, e.date_delivery as delivery_date, l.date_delivery as date_reception, e.fk_statut, e.billed, e.tracking_number,"; $sql .= " s.rowid as socid, s.nom as name, 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,"; @@ -618,6 +618,7 @@ if ($resql) $object = new Expedition($db); $object->fetch($obj->rowid); + print ''; // Ref @@ -705,7 +706,7 @@ if ($resql) if (!empty($arrayfields['e.date_delivery']['checked'])) { print ''; - print dol_print_date($db->jdate($obj->date_livraison), "dayhour"); + print dol_print_date($db->jdate($obj->delivery_date), "dayhour"); /*$now = time(); if ( ($now - $db->jdate($obj->date_expedition)) > $conf->warnings->lim && $obj->statutid == 1 ) { diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 62e6181abcf..39772360227 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -354,7 +354,7 @@ if ($id > 0 || !empty($ref)) print ''.$langs->trans('Date').''; print ''; print dol_print_date($object->date, 'day'); - if ($object->hasDelay() && empty($object->date_livraison)) { + if ($object->hasDelay() && empty($object->delivery_date)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } print ''; @@ -374,12 +374,12 @@ if ($id > 0 || !empty($ref)) print '
'; print ''; print ''; - print $form->selectDate($object->date_livraison ? $object->date_livraison : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); + print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); print ''; print '
'; } else { - print dol_print_date($object->date_livraison, 'dayhour'); - if ($object->hasDelay() && !empty($object->date_livraison)) { + print dol_print_date($object->delivery_date, 'dayhour'); + if ($object->hasDelay() && !empty($object->delivery_date)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 2bc539ea07e..5f2771594de 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -375,7 +375,7 @@ class CommandeFournisseur extends CommonOrder $this->date_approve = $this->db->jdate($obj->date_approve); $this->date_approve2 = $this->db->jdate($obj->date_approve2); $this->date_commande = $this->db->jdate($obj->date_commande); // date we make the order to supplier - $this->date_livraison = $this->db->jdate($obj->delivery_date); + $this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated $this->delivery_date = $this->db->jdate($obj->delivery_date); $this->remise_percent = $obj->remise_percent; $this->methode_commande_id = $obj->fk_input_method; @@ -778,16 +778,24 @@ class CommandeFournisseur extends CommonOrder if (isset($this->statut)) { $label .= ' '.$this->getLibStatut(5); } - if (!empty($this->ref)) + if (!empty($this->ref)) { $label .= '
'.$langs->trans('Ref').': '.$this->ref; - if (!empty($this->ref_supplier)) + } + if (!empty($this->ref_supplier)) { $label .= '
'.$langs->trans('RefSupplier').': '.$this->ref_supplier; - if (!empty($this->total_ht)) + } + if (!empty($this->total_ht)) { $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); - if (!empty($this->total_tva)) + } + if (!empty($this->total_tva)) { $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); - if (!empty($this->total_ttc)) + } + if (!empty($this->total_ttc)) { $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->delivery_date)) { + $label .= '
'.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour'); + } } $picto = 'order'; @@ -1257,9 +1265,10 @@ class CommandeFournisseur extends CommonOrder $error = 0; $now = dol_now(); - // $date_commande is deprecated + // set tmp vars $date = ($this->date_commande ? $this->date_commande : $this->date); // in case of date is set if (empty($date)) $date = $now; + $delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date; // Clean parameters if (empty($this->source)) $this->source = 0; @@ -1308,7 +1317,7 @@ class CommandeFournisseur extends CommonOrder $sql .= ", ".$this->socid; $sql .= ", ".($this->fk_project > 0 ? $this->fk_project : "null"); $sql .= ", '".$this->db->idate($date)."'"; - $sql .= ", ".($this->date_livraison ? "'".$this->db->idate($this->date_livraison)."'" : "null"); + $sql .= ", ".($delivery_date ? "'".$this->db->idate($delivery_date)."'" : "null"); $sql .= ", ".$user->id; $sql .= ", ".self::STATUS_DRAFT; $sql .= ", ".$this->db->escape($this->source); @@ -2925,7 +2934,7 @@ class CommandeFournisseur extends CommonOrder { $response->nbtodo++; - $commandestatic->date_livraison = $this->db->jdate($obj->delivery_date); + $commandestatic->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated $commandestatic->delivery_date = $this->db->jdate($obj->delivery_date); $commandestatic->date_commande = $this->db->jdate($obj->date_commande); $commandestatic->statut = $obj->fk_statut; @@ -3079,10 +3088,10 @@ class CommandeFournisseur extends CommonOrder { global $conf; - if (empty($this->date_delivery) && !empty($this->date_livraison)) $this->date_delivery = $this->date_livraison; // For backward compatibility + if (empty($this->delivery_date) && !empty($this->date_livraison)) $this->delivery_date = $this->date_livraison; // For backward compatibility $now = dol_now(); - $date_to_test = empty($this->date_delivery) ? $this->date_commande : $this->date_delivery; + $date_to_test = empty($this->delivery_date) ? $this->date_commande : $this->delivery_date; return ($this->statut > 0 && $this->statut < 5) && $date_to_test && $date_to_test < ($now - $conf->commande->fournisseur->warning_delay); } @@ -3096,9 +3105,9 @@ class CommandeFournisseur extends CommonOrder { global $conf, $langs; - if (empty($this->date_delivery) && !empty($this->date_livraison)) $this->date_delivery = $this->date_livraison; // For backward compatibility + if (empty($this->delivery_date) && !empty($this->date_livraison)) $this->delivery_date = $this->date_livraison; // For backward compatibility - if (empty($this->date_delivery)) $text = $langs->trans("OrderDate").' '.dol_print_date($this->date_commande, 'day'); + if (empty($this->delivery_date)) $text = $langs->trans("OrderDate").' '.dol_print_date($this->date_commande, 'day'); else $text = $text = $langs->trans("DeliveryDate").' '.dol_print_date($this->date_delivery, 'day'); $text .= ' '.($conf->commande->fournisseur->warning_delay > 0 ? '+' : '-').' '.round(abs($conf->commande->fournisseur->warning_delay) / 3600 / 24, 1).' '.$langs->trans("days").' < '.$langs->trans("Today"); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index ad4662a156c..b4f3570ff34 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1145,7 +1145,7 @@ if (empty($reshook)) $object->fk_account = GETPOST('fk_account', 'int'); $object->note_private = GETPOST('note_private', 'restricthtml'); $object->note_public = GETPOST('note_public', 'restricthtml'); - $object->date_livraison = $datelivraison; + $object->date_livraison = $datelivraison; // deprecated $object->delivery_date = $datelivraison; $object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); @@ -1200,7 +1200,8 @@ if (empty($reshook)) $result = $srcobject->fetch($object->origin_id); if ($result > 0) { - $object->setDeliveryDate($user, $srcobject->date_livraison); + $tmpdate = ($srcobject->delivery_date ? $srcobject->delivery_date : $srcobject->date_livraison); + $object->setDeliveryDate($user, $tmpdate); $object->set_id_projet($user, $srcobject->fk_project); $lines = $srcobject->lines; @@ -1552,7 +1553,7 @@ if ($action == 'create') $remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0)); $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : ''; - $datedelivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : ''); + $datedelivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : '')); if (!empty($conf->multicurrency->enabled)) { @@ -2161,14 +2162,14 @@ if ($action == 'create') print ''; $usehourmin = 0; if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin = 1; - print $form->selectDate($object->date_livraison ? $object->date_livraison : -1, 'liv_', $usehourmin, $usehourmin, '', "setdate_livraison"); + print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', $usehourmin, $usehourmin, '', "setdate_livraison"); print ''; print ''; } else { $usehourmin = 'day'; if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin = 'dayhour'; - print $object->date_livraison ? dol_print_date($object->date_livraison, $usehourmin) : ' '; - if ($object->hasDelay() && !empty($object->date_livraison)) { + print $object->delivery_date ? dol_print_date($object->delivery_date, $usehourmin) : ' '; + if ($object->hasDelay() && !empty($object->delivery_date)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } } diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 7b41e7030b1..a77606abb3f 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -2068,8 +2068,8 @@ function migrate_commande_livraison($db, $langs, $conf) $db->begin(); - $sql = "SELECT l.rowid, l.fk_commande"; - $sql .= ", c.ref_client, c.date_livraison"; + $sql = "SELECT l.rowid, l.fk_commande,"; + $sql .= " c.ref_client, c.date_livraison as delivery_date"; $sql .= " FROM ".MAIN_DB_PREFIX."livraison as l, ".MAIN_DB_PREFIX."commande as c"; $sql .= " WHERE c.rowid = l.fk_commande"; $resql = $db->query($sql); @@ -2090,7 +2090,7 @@ function migrate_commande_livraison($db, $langs, $conf) if ($resql2) { - $delivery_date = $db->jdate($obj->date_livraison); + $delivery_date = $db->jdate($obj->delivery_date); $sqlu = "UPDATE ".MAIN_DB_PREFIX."livraison SET"; $sqlu .= " ref_client='".$db->escape($obj->ref_client)."'"; @@ -3007,7 +3007,7 @@ function migrate_customerorder_shipping($db, $langs, $conf) if ($db->query($sqlAdd1) && $db->query($sqlAdd2)) { - $sqlSelect = "SELECT e.rowid as shipping_id, c.ref_client, c.date_livraison"; + $sqlSelect = "SELECT e.rowid as shipping_id, c.ref_client, c.date_livraison as delivery_date"; $sqlSelect .= " FROM ".MAIN_DB_PREFIX."expedition as e"; $sqlSelect .= ", ".MAIN_DB_PREFIX."element_element as el"; $sqlSelect .= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON c.rowid = el.fk_source AND el.sourcetype = 'commande'"; @@ -3028,7 +3028,7 @@ function migrate_customerorder_shipping($db, $langs, $conf) $sqlUpdate = "UPDATE ".MAIN_DB_PREFIX."expedition SET"; $sqlUpdate .= " ref_customer = '".$db->escape($obj->ref_client)."'"; - $sqlUpdate .= ", date_delivery = '".$db->escape($obj->date_livraison ? $obj->date_livraison : 'null')."'"; + $sqlUpdate .= ", date_delivery = '".$db->escape($obj->delivery_date ? $obj->delivery_date : 'null')."'"; $sqlUpdate .= " WHERE rowid = ".$obj->shipping_id; $result = $db->query($sqlUpdate); diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 62fc287fba3..169ffd327ad 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -111,6 +111,8 @@ $hookmanager->initHooks(array('receptioncard', 'globalcard')); $permissiondellink = $user->rights->reception->creer; // Used by the include of actions_dellink.inc.php //var_dump($object->lines[0]->detail_batch); +$date_delivery = dol_mktime(GETPOST('date_deliveryhour', 'int'), GETPOST('date_deliverymin', 'int'), 0, GETPOST('date_deliverymonth', 'int'), GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int')); + /* * Actions @@ -226,8 +228,6 @@ if (empty($reshook)) $object->size_units = GETPOST('size_units', 'int'); $object->weight_units = GETPOST('weight_units', 'int'); - $date_delivery = dol_mktime(GETPOST('date_deliveryhour', 'int'), GETPOST('date_deliverymin', 'int'), 0, GETPOST('date_deliverymonth', 'int'), GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int')); - // On va boucler sur chaque ligne du document d'origine pour completer objet reception // avec info diverses + qte a livrer @@ -777,8 +777,7 @@ if ($action == 'create') // Date delivery planned print ''.$langs->trans("DateDeliveryPlanned").''; print ''; - //print dol_print_date($object->date_livraison,"day"); // date_livraison come from order and will be stored into date_delivery planed. - $date_delivery = ($date_delivery ? $date_delivery : $object->date_livraison); // $date_delivery comes from GETPOST + $date_delivery = ($date_delivery ? $date_delivery : $object->delivery_date); // $date_delivery comes from GETPOST print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1); print "\n"; print ''; diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index b99ba707251..4df73cce925 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -409,7 +409,7 @@ $formfile = new FormFile($db); $helpurl = 'EN:Module_Receptions|FR:Module_Receptions|ES:Módulo_Receptiones'; llxHeader('', $langs->trans('ListOfReceptions'), $helpurl); -$sql = "SELECT e.rowid, e.ref, e.ref_supplier, e.date_reception as date_reception, e.date_delivery as date_livraison, l.date_delivery as date_reception, e.fk_statut, e.billed,"; +$sql = "SELECT e.rowid, e.ref, e.ref_supplier, e.date_reception as date_reception, e.date_delivery as delivery_date, l.date_delivery as date_reception2, e.fk_statut, e.billed,"; $sql .= ' s.rowid as socid, s.nom as name, 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,"; @@ -499,21 +499,21 @@ if ($resql) $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; - if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage; - if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; - if ($sall) $param .= "&sall=".$sall; - if ($search_ref_rcp) $param .= "&search_ref_rcp=".$search_ref_rcp; - if ($search_ref_liv) $param .= "&search_ref_liv=".$search_ref_liv; - if ($search_company) $param .= "&search_company=".$search_company; - if ($optioncss != '') $param .= '&optioncss='.$optioncss; - if ($search_billed != '' && $search_billed >= 0)$param .= "&search_billed=".$search_billed; - if ($search_town) $param .= "&search_town=".$search_town; - if ($search_zip) $param .= "&search_zip=".$search_zip; - if ($search_state) $param .= "&search_state=".$search_state; - if ($search_status) $param .= "&search_status=".$search_status; - if ($search_country) $param .= "&search_country=".$search_country; - if ($search_type_thirdparty) $param .= "&search_type_thirdparty=".$search_type_thirdparty; - if ($search_ref_supplier) $param .= "&search_ref_supplier=".$search_ref_supplier; + 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_rcp) $param .= "&search_ref_rcp=".urlencode($search_ref_rcp); + if ($search_ref_liv) $param .= "&search_ref_liv=".urlencode($search_ref_liv); + if ($search_company) $param .= "&search_company=".urlencode($search_company); + if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); + if ($search_billed != '' && $search_billed >= 0) $param .= "&search_billed=".urlencode($search_billed); + 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_status) $param .= "&search_status=".urlencode($search_status); + if ($search_country) $param .= "&search_country=".urlencode($search_country); + if ($search_type_thirdparty) $param .= "&search_type_thirdparty=".urlencode($search_type_thirdparty); + if ($search_ref_supplier) $param .= "&search_ref_supplier=".urlencode($search_ref_supplier); // Add $param from extra fields foreach ($search_array_options as $key => $val) { @@ -838,7 +838,7 @@ if ($resql) if (!empty($arrayfields['e.date_delivery']['checked'])) { print ''; - print dol_print_date($db->jdate($obj->date_livraison), "day"); + print dol_print_date($db->jdate($obj->delivery_date), "day"); /*$now = time(); if ( ($now - $db->jdate($obj->date_reception)) > $conf->warnings->lim && $obj->statutid == 1 ) { diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 5a5e73a1927..eb918d8b3b4 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -257,7 +257,7 @@ if (empty($reshook)) { if ($object->fetch(GETPOST('copie_supplier_proposal')) > 0) { $object->ref = GETPOST('ref'); - $object->date_livraison = $date_delivery; + $object->date_livraison = $date_delivery; // deprecated $object->delivery_date = $date_delivery; $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); $object->cond_reglement_id = GETPOST('cond_reglement_id'); @@ -1565,11 +1565,11 @@ if ($action == 'create') print '
'; print ''; print ''; - print $form->selectDate($object->date_livraison, 'liv_', '', '', '', "editdate_livraison"); + print $form->selectDate($object->delivery_date, 'liv_', '', '', '', "editdate_livraison"); print ''; print '
'; } else { - print dol_print_date($object->date_livraison, 'daytext'); + print dol_print_date($object->delivery_date, 'daytext'); } print ''; print ''; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 59305cf7548..74bbf1afa7e 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -109,6 +109,12 @@ class SupplierProposal extends CommonObject */ public $date; + /** + * @var integer|string date_livraison + * @deprecated + */ + public $date_livraison; + /** * @var integer|string date_livraison */ @@ -855,8 +861,6 @@ class SupplierProposal extends CommonObject dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); return -3; } - - // Check parameters if (!empty($this->ref)) // We check that ref is not already used { $result = self::isExistingObject($this->element, 0, $this->ref); // Check ref is not yet used @@ -869,6 +873,9 @@ class SupplierProposal extends CommonObject } } + // Set tmp vars + $delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date; + // Multicurrency if (!empty($this->multicurrency_code)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $now); if (empty($this->fk_multicurrency)) @@ -923,7 +930,7 @@ class SupplierProposal extends CommonObject $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->date_livraison != '' ? "'".$this->db->idate($this->date_livraison)."'" : "null"); + $sql .= ", ".($delivery_date ? "'".$this->db->idate($delivery_date)."'" : "null"); $sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : 'NULL'); $sql .= ", ".($this->fk_project ? $this->fk_project : "null"); $sql .= ", ".$conf->entity; @@ -1256,7 +1263,7 @@ class SupplierProposal extends CommonObject $this->datev = $this->db->jdate($obj->datev); // TODO deprecated $this->date_creation = $this->db->jdate($obj->datec); //Creation date $this->date_validation = $this->db->jdate($obj->datev); //Validation date - $this->date_livraison = $this->db->jdate($obj->delivery_date); + $this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated $this->delivery_date = $this->db->jdate($obj->delivery_date); $this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null; @@ -1538,6 +1545,7 @@ class SupplierProposal extends CommonObject if ($this->db->query($sql)) { $this->date_livraison = $delivery_date; + $this->delivery_date = $delivery_date; return 1; } else { $this->error = $this->db->error(); From 928330c44b74f73b38b0b3b4c267891306807a93 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Nov 2020 12:42:59 +0100 Subject: [PATCH 117/124] Fix link to reconciliation page --- htdocs/compta/bank/bankentries_list.php | 2 +- htdocs/compta/bank/list.php | 18 +++++++++--------- htdocs/langs/en_US/compta.lang | 2 +- htdocs/langs/en_US/main.lang | 1 + 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 437516df50b..f8b978ca4c8 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1093,7 +1093,7 @@ if ($resql) } print ''; - print ''; + print ''; print '