diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php
index 129fedf3867..34ef8de30cb 100644
--- a/htdocs/accountancy/bookkeeping/list.php
+++ b/htdocs/accountancy/bookkeeping/list.php
@@ -44,14 +44,14 @@ $search_mvt_num = GETPOST('search_mvt_num', 'int');
$search_doc_type = GETPOST("search_doc_type", 'alpha');
$search_doc_ref = GETPOST("search_doc_ref", 'alpha');
$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
-$search_date_end = dol_mktime(0, 0, 0, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
+$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
$search_date_creation_start = dol_mktime(0, 0, 0, GETPOST('date_creation_startmonth', 'int'), GETPOST('date_creation_startday', 'int'), GETPOST('date_creation_startyear', 'int'));
-$search_date_creation_end = dol_mktime(0, 0, 0, GETPOST('date_creation_endmonth', 'int'), GETPOST('date_creation_endday', 'int'), GETPOST('date_creation_endyear', 'int'));
+$search_date_creation_end = dol_mktime(23, 59, 59, GETPOST('date_creation_endmonth', 'int'), GETPOST('date_creation_endday', 'int'), GETPOST('date_creation_endyear', 'int'));
$search_date_modification_start = dol_mktime(0, 0, 0, GETPOST('date_modification_startmonth', 'int'), GETPOST('date_modification_startday', 'int'), GETPOST('date_modification_startyear', 'int'));
-$search_date_modification_end = dol_mktime(0, 0, 0, GETPOST('date_modification_endmonth', 'int'), GETPOST('date_modification_endday', 'int'), GETPOST('date_modification_endyear', 'int'));
+$search_date_modification_end = dol_mktime(23, 59, 59, GETPOST('date_modification_endmonth', 'int'), GETPOST('date_modification_endday', 'int'), GETPOST('date_modification_endyear', 'int'));
$search_date_export_start = dol_mktime(0, 0, 0, GETPOST('date_export_startmonth', 'int'), GETPOST('date_export_startday', 'int'), GETPOST('date_export_startyear', 'int'));
-$search_date_export_end = dol_mktime(0, 0, 0, GETPOST('date_export_endmonth', 'int'), GETPOST('date_export_endday', 'int'), GETPOST('date_export_endyear', 'int'));
+$search_date_export_end = dol_mktime(23, 59, 59, GETPOST('date_export_endmonth', 'int'), GETPOST('date_export_endday', 'int'), GETPOST('date_export_endyear', 'int'));
//var_dump($search_date_start);exit;
if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) {
diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php
index 2cb28b59584..db37a762599 100644
--- a/htdocs/accountancy/bookkeeping/listbyaccount.php
+++ b/htdocs/accountancy/bookkeeping/listbyaccount.php
@@ -39,7 +39,7 @@ $langs->loadLangs(array("accountancy"));
$action = GETPOST('action', 'alpha');
$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
-$search_date_end = dol_mktime(0, 0, 0, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
+$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
$search_accountancy_code = GETPOST("search_accountancy_code");
diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php
index 838e7cd9a5c..dad19ffafcd 100644
--- a/htdocs/adherents/list.php
+++ b/htdocs/adherents/list.php
@@ -857,7 +857,7 @@ while ($i < min($num, $limit))
else
{
print '
';
- if ($obj->subscription == 'yes')
+ if (!empty($obj->subscription))
{
print $langs->trans("SubscriptionNotReceived");
if ($obj->statut > 0) print " ".img_warning();
diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php
index 4590254ebf6..0e7ad2e9a84 100644
--- a/htdocs/adherents/type.php
+++ b/htdocs/adherents/type.php
@@ -511,7 +511,7 @@ if ($rowid > 0)
$sql .= " AND t.rowid = ".$object->id;
if ($sall)
{
- $sql .= natural_search(array("f.firstname", "d.lastname", "d.societe", "d.email", "d.login", "d.address", "d.town", "d.note_public", "d.note_private"), $sall);
+ $sql .= natural_search(array("d.firstname", "d.lastname", "d.societe", "d.email", "d.login", "d.address", "d.town", "d.note_public", "d.note_private"), $sall);
}
if ($status != '')
{
@@ -710,7 +710,7 @@ if ($rowid > 0)
else
{
print ' | ';
- if ($objp->subscription == 'yes')
+ if (!empty($objp->subscription))
{
print $langs->trans("SubscriptionNotReceived");
if ($objp->statut > 0) print " ".img_warning();
diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php
index 6987a27dacd..b43daf4bf0c 100644
--- a/htdocs/comm/mailing/class/advtargetemailing.class.php
+++ b/htdocs/comm/mailing/class/advtargetemailing.class.php
@@ -640,6 +640,10 @@ class AdvanceTargetingMailing extends CommonObject
if ($arrayquery['options_'.$key]!=''){
$sqlwhere[]= " (te.".$key." = ".$arrayquery['options_'.$key].")";
}
+ } elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'link') {
+ if ($arrayquery['options_'.$key] > 0) {
+ $sqlwhere[]= " (te.".$key." = ".((int) $arrayquery['options_'.$key]).")";
+ }
} else {
if (is_array($arrayquery['options_'.$key])) {
$sqlwhere[]= " (te.".$key." IN ('".implode("','", $arrayquery['options_'.$key])."'))";
@@ -666,7 +670,6 @@ class AdvanceTargetingMailing extends CommonObject
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
-
$this->thirdparty_lines[$i] = $obj->rowid;
$i++;
diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php
index 59da7387f62..dc892029829 100644
--- a/htdocs/compta/paiement/card.php
+++ b/htdocs/compta/paiement/card.php
@@ -109,28 +109,70 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->facture->
$object->fetch($id);
if ($object->valide($user) > 0)
{
- $db->commit();
-
// Loop on each invoice linked to this payment to rebuild PDF
- $factures = array();
- foreach ($factures as $id)
- {
- $fac = new Facture($db);
- $fac->fetch($id);
+ if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
+ $outputlangs = $langs;
+ if (!empty($_REQUEST['lang_id']))
+ {
+ $outputlangs = new Translate("", $conf);
+ $outputlangs->setDefaultLang($_REQUEST['lang_id']);
+ }
- $outputlangs = $langs;
- if (!empty($_REQUEST['lang_id']))
- {
- $outputlangs = new Translate("", $conf);
- $outputlangs->setDefaultLang($_REQUEST['lang_id']);
- }
- if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
- $fac->generateDocument($fac->modelpdf, $outputlangs);
- }
+ $hidedetails = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0;
+ $hidedesc = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0;
+ $hideref = !empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0;
+
+ $sql = 'SELECT f.rowid as facid';
+ $sql .= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture as f,'.MAIN_DB_PREFIX.'societe as s';
+ $sql .= ' WHERE pf.fk_facture = f.rowid';
+ $sql .= ' AND f.fk_soc = s.rowid';
+ $sql .= ' AND f.entity IN ('.getEntity('invoice').')';
+ $sql .= ' AND pf.fk_paiement = '.$object->id;
+ $resql = $db->query($sql);
+ if ($resql)
+ {
+ $i = 0;
+ $num = $db->num_rows($resql);
+
+ if ($num > 0)
+ {
+ while ($i < $num)
+ {
+ $objp = $db->fetch_object($resql);
+
+ $invoice = new Facture($db);
+
+ if ($invoice->fetch($objp->facid) <= 0) {
+ $errors++;
+ setEventMessage($invoice->error, $invoice->errors, 'errors');
+ break;
+ }
+
+ if ($invoice->generateDocument($invoice->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref) < 0) {
+ $errors++;
+ setEventMessage($invoice->error, $invoice->errors, 'errors');
+ break;
+ }
+
+ $i++;
+ }
+ }
+
+ $db->free($resql);
+ }
+ else
+ {
+ $errors++;
+ setEventMessage($db->error, $db->errors, 'errors');
+ }
}
- header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id);
- exit;
+ if (! $errors) {
+ $db->commit();
+
+ header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id);
+ exit;
+ }
}
else
{
diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php
index 05d2fe0c08b..221ff3de042 100644
--- a/htdocs/compta/paiement/class/paiement.class.php
+++ b/htdocs/compta/paiement/class/paiement.class.php
@@ -440,8 +440,13 @@ class Paiement extends CommonObject
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
+
+ $hidedetails = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0;
+ $hidedesc = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0;
+ $hideref = !empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0;
+
$ret = $invoice->fetch($facid); // Reload to get new records
- $result = $invoice->generateDocument($invoice->modelpdf, $outputlangs);
+ $result = $invoice->generateDocument($invoice->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0) {
setEventMessages($invoice->error, $invoice->errors, 'errors');
$error++;
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 14251ce2912..63964142f8b 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -16,7 +16,7 @@
* Copyright (C) 2012 Cedric Salvador
* Copyright (C) 2012-2015 Raphaël Doursenaud
* Copyright (C) 2014 Alexandre Spangaro
- * Copyright (C) 2018 Ferran Marcet
+ * Copyright (C) 2018-2021 Ferran Marcet
* Copyright (C) 2018-2019 Frédéric France
* Copyright (C) 2018 Nicolas ZABOURI
* Copyright (C) 2018 Christophe Battarel
@@ -7020,7 +7020,7 @@ class Form
print '';
print ' | ';
print ''.$objp->ref.' | ';
- print ''.$objp->ref_client.' | ';
+ print ''.(!empty($objp->ref_client)?$objp->ref_client:$objp->ref_supplier).' | ';
print ''.price($objp->total_ht).' | ';
print ''.$objp->name.' | ';
print '';
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index 48ab350d60f..16f52ad80e3 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -902,11 +902,11 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
't.email',
);
//Social media
- foreach ($socialnetworks as $key => $value) {
- if ($value['active']) {
- $searchAddressPhoneDBFields['t.'.$key] = "t.socialnetworks->'$.".$key."'";
- }
- }
+ // foreach ($socialnetworks as $key => $value) {
+ // if ($value['active']) {
+ // $searchAddressPhoneDBFields['t.'.$key] = "t.socialnetworks->'$.".$key."'";
+ // }
+ // }
if (!$sortorder) $sortorder = "ASC";
if (!$sortfield) $sortfield = "t.lastname";
diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php
index 403c4daefe9..5e78b77dce8 100644
--- a/htdocs/core/tpl/login.tpl.php
+++ b/htdocs/core/tpl/login.tpl.php
@@ -289,9 +289,9 @@ if (! empty($_SESSION['dol_loginmesg']))
if (!empty($conf->global->MAIN_EASTER_EGG_COMMITSTRIP)) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
if (substr($langs->defaultlang, 0, 2)=='fr') {
- $resgetcommitstrip = getURLContent("http://www.commitstrip.com/fr/feed/");
+ $resgetcommitstrip = getURLContent("https://www.commitstrip.com/fr/feed/");
} else {
- $resgetcommitstrip = getURLContent("http://www.commitstrip.com/en/feed/");
+ $resgetcommitstrip = getURLContent("https://www.commitstrip.com/en/feed/");
}
if ($resgetcommitstrip && $resgetcommitstrip['http_code'] == '200')
{
diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php
index 8874a62bc3b..4a8879c60bd 100644
--- a/htdocs/societe/societecontact.php
+++ b/htdocs/societe/societecontact.php
@@ -331,7 +331,7 @@ if ($id > 0 || ! empty($ref))
else
{
print '';
- if ($objp->subscription == 'yes')
+ if (!empty($objp->subscription))
{
print $langs->trans("SubscriptionNotReceived");
if ($objp->statut > 0) print " ".img_warning();
|