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 01/10] 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 02/10] 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 03/10] 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 04/10] 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 05/10] 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 06/10] 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 71f09dc2d86a6e9670f1c7fb51bf84ac091e34fe Mon Sep 17 00:00:00 2001 From: "jove@bisquerra.com" Date: Wed, 11 Nov 2020 21:51:32 +0100 Subject: [PATCH 07/10] 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 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 08/10] 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 026d73d9f960aad29df608527e6fc45f2144c73f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Nov 2020 12:39:56 +0100 Subject: [PATCH 09/10] 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 10/10] 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 "\n"; // Receipt printer module +print '\n"; +} else { + print ''; + print $langs->trans("ModuleReceiptPrinterMustBeEnabled"); + print ''; } +print "\n"; // TakePOS Connector 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 "
'; +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 "
';