Merge branch 'develop' into fixloan2

This commit is contained in:
Laurent Destailleur 2020-06-16 22:40:45 +02:00 committed by GitHub
commit faf4da0d68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 106 additions and 37 deletions

View File

@ -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 = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$cat->id.'&type='.$cat->type.'" class="'.$forced_color.'">';
$linkend = '</a>';
$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[] = "<a href='".DOL_URL_ROOT."/".$url."?catid=".$cat->id."'>".($addpicto ? img_object('', 'category') : '').$cat->label."</a>";
}

View File

@ -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);

View File

@ -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();

View File

@ -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 .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= '<input type="hidden" name="type" value="'.$type.'">';
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
@ -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);

View File

@ -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(' &gt;&gt; ', '', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text
$ways = $c->print_all_ways(' &gt;&gt; ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text
foreach ($ways as $way)
{
$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.$way.'</li>';

View File

@ -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 "<!-- JS CODE TO ENABLE for google analtics tag -->\n";
print "

View File

@ -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)
{

View File

@ -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 "<!-- JS CODE TO ENABLE for google analtics tag -->\n";
print "

View File

@ -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 "<!-- JS CODE TO ENABLE for google analtics tag -->\n";
print "

View File

@ -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);

View File

@ -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

View File

@ -0,0 +1,22 @@
-- ===================================================================
-- Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
--
-- 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 <https://www.gnu.org/licenses/>.
--
-- ===================================================================
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);

View File

@ -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

View File

@ -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: <?php echo $borderwidth ?>px;
border-top-color: rgb(<?php echo $colortopbordertitle1 ?>);
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(<?php echo $colortopbordertitle1 ?>);
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;

View File

@ -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;
}