From 0d6967b77a35b36a74bb8f6d4a3f83c35ebb1aaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 28 Mar 2023 22:16:04 +0200 Subject: [PATCH 1/4] work on printing --- htdocs/core/modules/printing/printgcp.modules.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index c1b6ba6c86e..0a2d59368ec 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -121,7 +121,7 @@ class printing_printgcp extends PrintingDriver $this->google_id = getDolGlobalString('OAUTH_GOOGLE_ID'); $this->google_secret = getDolGlobalString('OAUTH_GOOGLE_SECRET'); // Token storage - $storage = new DoliStorage($this->db, $this->conf, $keyforprovider); + $storage = new DoliStorage($this->db, $conf, $keyforprovider); //$storage->clearToken($this->OAUTH_SERVICENAME_GOOGLE); // Setup the credentials for the requests $credentials = new Credentials( @@ -255,12 +255,13 @@ class printing_printgcp extends PrintingDriver */ public function getlistAvailablePrinters() { + global $conf; $ret = array(); $keyforprovider = ''; // @FIXME // Token storage - $storage = new DoliStorage($this->db, $this->conf, $keyforprovider); + $storage = new DoliStorage($this->db, $conf, $keyforprovider); // Setup the credentials for the requests $credentials = new Credentials( $this->google_id, @@ -376,7 +377,7 @@ class printing_printgcp extends PrintingDriver * @return array status array */ public function sendPrintToPrinter($printerid, $printjobtitle, $filepath, $contenttype) - { + {global $conf; // Check if printer id if (empty($printerid)) { return array('status' =>0, 'errorcode' =>'', 'errormessage'=>'No provided printer ID'); @@ -401,7 +402,7 @@ class printing_printgcp extends PrintingDriver $keyforprovider = ''; // @FIXME // Dolibarr Token storage - $storage = new DoliStorage($this->db, $this->conf, $keyforprovider); + $storage = new DoliStorage($this->db, $conf, $keyforprovider); // Setup the credentials for the requests $credentials = new Credentials( $this->google_id, From 997e24aab0c0a33dc6fd64bd735e6ca84b0c6de1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 28 Mar 2023 22:17:38 +0200 Subject: [PATCH 2/4] work on printing --- htdocs/core/modules/printing/printgcp.modules.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index 0a2d59368ec..d62dbd94ab2 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -377,7 +377,8 @@ class printing_printgcp extends PrintingDriver * @return array status array */ public function sendPrintToPrinter($printerid, $printjobtitle, $filepath, $contenttype) - {global $conf; + { + global $conf; // Check if printer id if (empty($printerid)) { return array('status' =>0, 'errorcode' =>'', 'errormessage'=>'No provided printer ID'); @@ -454,7 +455,7 @@ class printing_printgcp extends PrintingDriver $keyforprovider = ''; // @FIXME // Token storage - $storage = new DoliStorage($this->db, $this->conf, $keyforprovider); + $storage = new DoliStorage($this->db, $conf, $keyforprovider); // Setup the credentials for the requests $credentials = new Credentials( $this->google_id, From d8a8be385b889ceab2fc94238121b304b3fbc428 Mon Sep 17 00:00:00 2001 From: hystepik Date: Wed, 29 Mar 2023 11:10:58 +0200 Subject: [PATCH 3/4] New : Creation of login from lastname and firstname --- htdocs/user/card.php | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index dfd90b4dc0f..124c61dc737 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -893,7 +893,7 @@ if ($action == 'create' || $action == 'adduserldap') { print ''; print $ldap_lastname; } else { - print ''; + print ''; } print ''; @@ -904,7 +904,7 @@ if ($action == 'create' || $action == 'adduserldap') { print ''; print $ldap_firstname; } else { - print ''; + print ''; } print ''; @@ -918,10 +918,28 @@ if ($action == 'create' || $action == 'adduserldap') { print ''; print $ldap_loginsmb; } else { - print ''; + print ''; } print ''; + if (!empty($conf->use_javascript_ajax)) { + print ''; + } + $generated_password = ''; if (empty($ldap_sid)) { // ldap_sid is for activedirectory $generated_password = getRandomPassword(false); From 2721ccd23c6886ae1ceef2c55a43aab2b30ede05 Mon Sep 17 00:00:00 2001 From: priojk Date: Wed, 29 Mar 2023 11:43:31 +0200 Subject: [PATCH 4/4] add hook to modify amount to pay --- htdocs/compta/facture/prelevement.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 319b93c4dcb..17b45162974 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -676,6 +676,16 @@ if ($object->id > 0) { $resteapayer = price2num($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT'); + // Hook to change amount for other reasons, e.g. apply cash discount for payment before agreed date + $parameters = array('remaintopay' => $resteapayer); + $reshook = $hookmanager->executeHooks('finalizeAmountOfSupplierInvoice', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + print $hookmanager->resPrint; + if (!empty($remaintopay = $hookmanager->resArray['remaintopay'])) { + $resteapayer = $remaintopay; + } + } + // TODO Replace this by an include with same code to show already done payment visible in invoice card print ''.$langs->trans('RemainderToPay').''.price($resteapayer, 1, '', 1, - 1, - 1, $conf->currency).'';