diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 3076b9ecacd..748a9501101 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1347,7 +1347,7 @@ class Categorie extends CommonObject * separated by $sep (" >> " by default) * * @param string $sep Separator - * @param string $url Url + * @param string $url Url ('', 'none' or 'urltouse') * @param int $nocolor 0 * @param string $addpicto Add picto into link * @return array @@ -1386,6 +1386,10 @@ class Categorie extends CommonObject $link = ''; $linkend = ''; $w[] = $link.($addpicto ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend; + } elseif ($url == 'none') { + $link = ''; + $linkend = ''; + $w[] = $link.($addpicto ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend; } else { $w[] = "".($addpicto ? img_object('', 'category') : '').$cat->label.""; } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 791273a4fda..369f4f0ee25 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3981,16 +3981,19 @@ class Facture extends CommonInvoice // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Create a withdrawal request for a standing order. + * Create a withdrawal request for a direct debit order or a credit transfer order. * Use the remain to pay excluding all existing open direct debit requests. * - * @param User $fuser User asking the direct debit transfer - * @param float $amount Amount we request direct debit for - * @return int <0 if KO, >0 if OK + * @param User $fuser User asking the direct debit transfer + * @param float $amount Amount we request direct debit for + * @param string $type 'direct-debit' or 'bank-transfer' + * @param string $sourcetype Source ('facture' or 'supplier_invoice') + * @return int <0 if KO, >0 if OK */ - public function demande_prelevement($fuser, $amount = 0) + public function demande_prelevement($fuser, $amount = 0, $type = 'direct-debit', $sourcetype = 'facture') { // phpcs:enable + global $conf; $error = 0; @@ -4004,7 +4007,12 @@ class Facture extends CommonInvoice $sql = 'SELECT count(*)'; $sql .= ' FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande'; - $sql .= ' WHERE fk_facture = '.$this->id; + if ($type == 'bank-transfer') { + $sql .= ' WHERE fk_facture_fourn = '.$this->id; + } else { + $sql .= ' WHERE fk_facture = '.$this->id; + } + $sql .= ' AND ext_payment_id IS NULL'; // To exclude record done for some online payments $sql .= ' AND traite = 0'; dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG); @@ -4029,16 +4037,24 @@ class Facture extends CommonInvoice if (is_numeric($amount) && $amount != 0) { - $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'prelevement_facture_demande'; - $sql .= ' (fk_facture, amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib)'; + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'prelevement_facture_demande('; + if ($type == 'bank-transfer') { + $sql .= 'fk_facture_fourn, '; + } else { + $sql .= 'fk_facture, '; + } + $sql .= ' amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib, sourcetype, entity)'; $sql .= ' VALUES ('.$this->id; $sql .= ",'".price2num($amount)."'"; $sql .= ",'".$this->db->idate($now)."'"; $sql .= ",".$fuser->id; - $sql .= ",'".$bac->code_banque."'"; - $sql .= ",'".$bac->code_guichet."'"; - $sql .= ",'".$bac->number."'"; - $sql .= ",'".$bac->cle_rib."')"; + $sql .= ",'".$this->db->escape($bac->code_banque)."'"; + $sql .= ",'".$this->db->escape($bac->code_guichet)."'"; + $sql .= ",'".$this->db->escape($bac->number)."'"; + $sql .= ",'".$this->db->escape($bac->cle_rib)."'"; + $sql .= ",'".$this->db->escape($sourcetype)."'"; + $sql .= ",".$conf->entity; + $sql .= ")"; dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index c21d19ad538..574b1f7d52a 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -376,7 +376,7 @@ if ($massaction == 'makepayment'){ foreach ($listofbills as $aBill) { $db->begin(); - $result = $aBill->demande_prelevement($user, $aBill->resteapayer); + $result = $aBill->demande_prelevement($user, $aBill->resteapayer, 'direct-debit', 'facture'); if ($result > 0) { $db->commit(); diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index ba6cc96e3dd..10cde50f478 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -24,7 +24,7 @@ /** * \file htdocs/compta/facture/prelevement.php * \ingroup facture - * \brief Management of direct debit order of invoices + * \brief Management of direct debit order or credit tranfer of invoices */ require '../../main.inc.php'; @@ -83,7 +83,13 @@ if (empty($reshook)) { $db->begin(); - $result = $object->demande_prelevement($user, GETPOST('withdraw_request_amount')); + $newtype = $type; + $sourcetype = 'facture'; + if ($type == 'bank-transfer') { + $sourcetype = 'supplier_invoice'; + } + + $result = $object->demande_prelevement($user, price2num(GETPOST('withdraw_request_amount', 'alpha')), $newtype, $sourcetype); if ($result > 0) { $db->commit(); @@ -101,7 +107,7 @@ if (empty($reshook)) { if ($object->id > 0) { - $result = $object->demande_prelevement_delete($user, GETPOST('did')); + $result = $object->demande_prelevement_delete($user, GETPOST('did', 'int')); if ($result == 0) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); @@ -197,6 +203,7 @@ if ($object->id > 0) $morehtmlref .= '
'; $morehtmlref .= ''; $morehtmlref .= ''; + $morehtmlref .= ''; $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); $morehtmlref .= ''; $morehtmlref .= '
'; @@ -490,6 +497,7 @@ if ($object->id > 0) $sql .= " WHERE fk_facture = ".$object->id; } $sql .= " AND pfd.traite = 0"; + $sql .= " AND pfd.ext_payment_id IS NULL"; $sql .= " ORDER BY pfd.date_demande DESC"; $result_sql = $db->query($sql); @@ -511,6 +519,7 @@ if ($object->id > 0) $sql .= " WHERE fk_facture = ".$object->id; } $sql .= " AND pfd.traite = 0"; + $sql .= " AND pfd.ext_payment_id IS NULL"; $result_sql = $db->query($sql); if ($result_sql) @@ -594,6 +603,7 @@ if ($object->id > 0) $sql .= " WHERE fk_facture = ".$object->id; } $sql .= " AND pfd.traite = 0"; + $sql .= " AND pfd.ext_payment_id IS NULL"; $sql .= " ORDER BY pfd.date_demande DESC"; $result_sql = $db->query($sql); @@ -646,6 +656,7 @@ if ($object->id > 0) $sql .= " WHERE fk_facture = ".$object->id; } $sql .= " AND pfd.traite = 1"; + $sql .= " AND pfd.ext_payment_id IS NULL"; $sql .= " ORDER BY pfd.date_demande DESC"; $result = $db->query($sql); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 289b92f84ae..efae43e02ee 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6554,9 +6554,10 @@ class Form * @param int $id Id of object * @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact'). Old mode (0, 1, 2, ...) is deprecated. * @param int $rendermode 0=Default, use multiselect. 1=Emulate multiselect (recommended) + * @param int $nolink 1=Do not add html links * @return string String with categories */ - public function showCategories($id, $type, $rendermode = 0) + public function showCategories($id, $type, $rendermode = 0, $nolink = 0) { global $db; @@ -6570,7 +6571,7 @@ class Form $toprint = array(); foreach ($categories as $c) { - $ways = $c->print_all_ways(' >> ', '', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text + $ways = $c->print_all_ways(' >> ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text foreach ($ways as $way) { $toprint[] = '
  • color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.$way.'
  • '; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 119a981891c..2187d6dc655 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7508,7 +7508,7 @@ function printCommonFooter($zone = 'private') if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AN_ID)) { $tmptagarray = explode(',', $conf->global->MAIN_GOOGLE_AN_ID); - foreach($tmptagarray as $tmptag) { + foreach ($tmptagarray as $tmptag) { print "\n"; print "\n"; print " diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 4094da1375f..82b9e8cee9b 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -62,6 +62,7 @@ function facture_prepare_head($object) $sql = "SELECT COUNT(pfd.rowid) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql .= " WHERE pfd.fk_facture = ".$object->id; + $sql .= " AND pfd.ext_payment_id IS NULL"; $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 6f2ca762a7c..a12616e2bd5 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -339,7 +339,7 @@ if (!empty($morelogincontent) && is_array($morelogincontent)) { if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AN_ID)) { $tmptagarray = explode(',', $conf->global->MAIN_GOOGLE_AN_ID); - foreach($tmptagarray as $tmptag) { + foreach ($tmptagarray as $tmptag) { print "\n"; print "\n"; print " diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index 4a37ea8ab3e..5cd672ddea4 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -229,7 +229,7 @@ if (!empty($morelogincontent) && is_array($morelogincontent)) { if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AN_ID)) { $tmptagarray = explode(',', $conf->global->MAIN_GOOGLE_AN_ID); - foreach($tmptagarray as $tmptag) { + foreach ($tmptagarray as $tmptag) { print "\n"; print "\n"; print " diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 41d439d1e95..59c5a01d406 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -307,6 +307,8 @@ ALTER TABLE llx_emailcollector_emailcollector ADD COLUMN hostcharset varchar(16) ALTER TABLE llx_adherent_type MODIFY subscription varchar(3) NOT NULL DEFAULT '1'; ALTER TABLE llx_adherent_type MODIFY vote varchar(3) NOT NULL DEFAULT '1'; + +UPDATE llx_prelevement_facture_demande SET entity = 1 WHERE entity IS NULL; - -ALTER TABLE llx_loan_schedule ADD column fk_payment_loan INTEGER; +ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture (fk_facture); +ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture_fourn (fk_facture_fourn); 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 14c176b1c20..db7cddbd018 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 @@ -32,6 +32,8 @@ ALTER TABLE llx_prelevement_bons ADD COLUMN type varchar(16) DEFAULT 'debit-order'; +ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture (fk_facture); +ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture_fourn (fk_facture_fourn); -- For v13 diff --git a/htdocs/install/mysql/tables/llx_prelevement_facture_demande.key.sql b/htdocs/install/mysql/tables/llx_prelevement_facture_demande.key.sql new file mode 100644 index 00000000000..4f9aedb9cdf --- /dev/null +++ b/htdocs/install/mysql/tables/llx_prelevement_facture_demande.key.sql @@ -0,0 +1,22 @@ +-- =================================================================== +-- Copyright (C) 2005 Rodolphe Quiedeville +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- =================================================================== + + +ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture (fk_facture); +ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture_fourn (fk_facture_fourn); + diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index fa72439b831..bd43c885244 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1983,7 +1983,7 @@ SmallerThan=Smaller than LargerThan=Larger than IfTrackingIDFoundEventWillBeLinked=Note that If a tracking ID is found into incoming email, the event will be automatically linked to the related objects. WithGMailYouCanCreateADedicatedPassword=With a GMail account, if you enabled the 2 steps validation, it is recommanded to create a dedicated second password for the application instead of using your own account passsword from https://myaccount.google.com/. -EmailCollectorTargetDir=It may be a desired behaviour to move the email into another tag/directory when it was processed successfully. Just set a value here to use this feature. Note that you must also use a read/write login account. +EmailCollectorTargetDir=It may be a desired behaviour to move the email into another tag/directory when it was processed successfully. Just set name of directory here to use this feature (Do NOT use special characters in name). Note that you must also use a read/write login account. EmailCollectorLoadThirdPartyHelp=You can use this action to use the email content to find and load an existing thirdparty in your database. The found (or created) thirdparty will be used for following actions that need it. In the parameter field you can use for example 'EXTRACT:BODY:Name:\s([^\s]*)' if you want to extract the name of the thirdparty from a string 'Name: name to find' found into the body. EndPointFor=End point for %s : %s DeleteEmailCollector=Delete email collector diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index f74183b633e..428902d1782 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -2977,22 +2977,22 @@ td.border, div.tagtable div div.border { } table.liste, table.noborder, table.formdoc, div.noborder { width: 100%; - border-collapse: separate !important; border-spacing: 0px; - border-top-width: px; border-top-color: rgb(); border-top-style: solid; - /* border-top-width: 2px; - border-top-color: var(--colorbackhmenu1); - border-top-style: solid; */ - - /*border-bottom-width: 1px; - border-bottom-color: rgb(); - border-bottom-style: solid;*/ - margin: 0px 0px 5px 0px; + + /*width: calc(100% - 7px); + border-collapse: separate !important; + border-spacing: 0px; + border-top-width: 0px; + border-top-color: rgb(215,215,215); + border-top-style: solid; + margin: 0px 0px 5px 2px; + box-shadow: 1px 1px 5px #ddd; + */ } #tablelines { border-bottom-width: 1px; diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index 604aff91a3e..c5f4b8d248c 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -28,9 +28,9 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> } .info-box-more { float: right; - top: 6px; + top: 5px; position: absolute; - right: 10px; + right: 8px; } .info-box small { @@ -385,6 +385,16 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO = min-width: 350px; max-width: 350px; } +.info-box-title { + width: calc(100% - 20px); +} +@media only screen and (max-width: 767px) { + .info-box-module { + min-width: 260px; + } +} + + .info-box-module .info-box-content { height: 6.4em; }